View Source Stripe.TestHelpers.TestClock (Striped v0.5.0) (generated)

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.

Link to this section Summary

Types

t()

The test_helpers.test_clock type.

Functions

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

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

Returns a list of your test clocks.

Link to this section Types

@type t() :: %Stripe.TestHelpers.TestClock{
  created: integer(),
  deletes_after: integer(),
  frozen_time: integer(),
  id: binary(),
  livemode: boolean(),
  name: binary() | nil,
  object: binary(),
  status: binary()
}

The test_helpers.test_clock type.

  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • deletes_after Time at which this clock is scheduled to auto delete.
  • frozen_time Time at which all objects belonging to this clock are frozen.
  • id Unique identifier for the object.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • name The custom name supplied at creation.
  • object String representing the object's type. Objects of the same type share the same value.
  • status The status of the Test Clock.

Link to this section Functions

Link to this function

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

View Source
@spec advance(
  client :: Stripe.t(),
  test_clock :: binary(),
  params :: %{
    optional(:expand) => [binary()],
    optional(:frozen_time) => integer()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

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

Details

  • Method: post
  • Path: /v1/test_helpers/test_clocks/{test_clock}/advance
Link to this function

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

View Source
@spec create(
  client :: Stripe.t(),
  params :: %{
    optional(:expand) => [binary()],
    optional(:frozen_time) => integer(),
    optional(:name) => binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

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

Details

  • Method: post
  • Path: /v1/test_helpers/test_clocks
Link to this function

delete(client, test_clock, opts \\ [])

View Source
@spec delete(client :: Stripe.t(), test_clock :: binary(), opts :: Keyword.t()) ::
  {:ok, Stripe.DeletedTestHelpers.TestClock.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}

Deletes a test clock.

Details

  • Method: delete
  • Path: /v1/test_helpers/test_clocks/{test_clock}
Link to this function

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

View Source
@spec list(
  client :: Stripe.t(),
  params :: %{
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Returns a list of your test clocks.

Details

  • Method: get
  • Path: /v1/test_helpers/test_clocks
Link to this function

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

View Source
@spec retrieve(
  client :: Stripe.t(),
  test_clock :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves a test clock.

Details

  • Method: get
  • Path: /v1/test_helpers/test_clocks/{test_clock}