StripeElixir.Services.TestHelpers.TestClockService (stripe_elixir v0.1.0)

Copy Markdown View Source

TestClock

A test clock enables deterministic control over objects in testmode. With a test clock, you can create objects at a frozen time in the past or future, and advance to a specific future time to observe webhooks and state changes. After the clock advances, you can either validate the current state of your scenario (and test your assumptions), change the current state of your scenario (and test more complex scenarios), or keep advancing forward in time.

Summary

Functions

advance(client, test_clock, params \\ %{}, opts \\ [])

@spec advance(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Advance a test clock

Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.

create(client, params \\ %{}, opts \\ [])

@spec create(StripeElixir.Client.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Create a test clock

Creates a new test clock that can be attached to new customers and quotes.

delete(client, test_clock, params \\ %{}, opts \\ [])

@spec delete(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Delete a test clock

Deletes a test clock.

list(client, params \\ %{}, opts \\ [])

@spec list(StripeElixir.Client.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

List all test clocks

Returns a list of your test clocks.

retrieve(client, test_clock, params \\ %{}, opts \\ [])

@spec retrieve(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Retrieve a test clock

Retrieves a test clock.