This PR introduces a new wait() method to the AccountPlan class, which simplifies the process of waiting for a payment plan to be selected. By integrating configurable polling intervals, timeouts, and abort signals, the method abstracts the common logic required in this scenario, making it easier for developers to implement and customize their workflows.
Changes
New wait() Method:
The wait() method repeatedly checks the account's payment plan status at a given interval until:
A valid plan is selected.
The timeout is reached.
The operation is aborted using an AbortSignal.
Available options:
interval (default: 1000ms): Sets the polling interval.
timeout (default: 15 minutes): Defines the maximum wait time.
signal: An optional AbortSignal to allow for cancellation.
This method improves the developer experience by abstracting the repetitive logic required to wait for a payment plan and offering flexibility through configurable options.
How to Test
Run the test suite with npm run build && npm run test.
Ensure all existing tests pass.
Verify that the new test cases for the wait() method in account.test.js are passing, including tests for:
Add
wait()
Method toAccountPlan
ClassSummary
This PR introduces a new
wait()
method to theAccountPlan
class, which simplifies the process of waiting for a payment plan to be selected. By integrating configurable polling intervals, timeouts, and abort signals, the method abstracts the common logic required in this scenario, making it easier for developers to implement and customize their workflows.Changes
wait()
Method:wait()
method repeatedly checks the account's payment plan status at a given interval until:AbortSignal
.interval
(default: 1000ms): Sets the polling interval.timeout
(default: 15 minutes): Defines the maximum wait time.signal
: An optionalAbortSignal
to allow for cancellation.How to Test
npm run build && npm run test
.wait()
method inaccount.test.js
are passing, including tests for: