Package com.stripe.model.testhelpers
Class TestClock
java.lang.Object
com.stripe.model.StripeObject
com.stripe.net.ApiResource
com.stripe.model.testhelpers.TestClock
- All Implemented Interfaces:
HasId
,StripeActiveObject
,StripeObjectInterface
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON, INTERNAL_GSON
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadvance
(TestClockAdvanceParams params) Starts advancing a test clock to a specified time in the future.advance
(TestClockAdvanceParams params, RequestOptions options) Starts advancing a test clock to a specified time in the future.Starts advancing a test clock to a specified time in the future.advance
(Map<String, Object> params, RequestOptions options) Starts advancing a test clock to a specified time in the future.protected boolean
static TestClock
create
(TestClockCreateParams params) Creates a new test clock that can be attached to new customers and quotes.static TestClock
create
(TestClockCreateParams params, RequestOptions options) Creates a new test clock that can be attached to new customers and quotes.static TestClock
Creates a new test clock that can be attached to new customers and quotes.static TestClock
create
(Map<String, Object> params, RequestOptions options) Creates a new test clock that can be attached to new customers and quotes.delete()
Deletes a test clock.delete
(RequestOptions options) Deletes a test clock.Deletes a test clock.delete
(Map<String, Object> params, RequestOptions options) Deletes a test clock.boolean
Time at which the object was created.Always true for a deleted object.Time at which this clock is scheduled to auto delete.Time at which all objects belonging to this clock are frozen.getId()
Unique identifier for the object.Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.getName()
The custom name supplied at creation.String representing the object's type.The status of the Test Clock.int
hashCode()
static TestClockCollection
list
(TestClockListParams params) Returns a list of your test clocks.static TestClockCollection
list
(TestClockListParams params, RequestOptions options) Returns a list of your test clocks.static TestClockCollection
Returns a list of your test clocks.static TestClockCollection
list
(Map<String, Object> params, RequestOptions options) Returns a list of your test clocks.static TestClock
Retrieves a test clock.static TestClock
retrieve
(String testClock, RequestOptions options) Retrieves a test clock.static TestClock
retrieve
(String testClock, TestClockRetrieveParams params, RequestOptions options) Retrieves a test clock.static TestClock
Retrieves a test clock.void
setCreated
(Long created) Time at which the object was created.void
setDeleted
(Boolean deleted) Always true for a deleted object.void
setDeletesAfter
(Long deletesAfter) Time at which this clock is scheduled to auto delete.void
setFrozenTime
(Long frozenTime) Time at which all objects belonging to this clock are frozen.void
Unique identifier for the object.void
setLivemode
(Boolean livemode) Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
The custom name supplied at creation.void
String representing the object's type.void
setResponseGetter
(StripeResponseGetter responseGetter) Thefrozen_time
that the Test Clock is advancing towards.void
The status of the Test Clock.void
setStatusDetails
(TestClock.StatusDetails statusDetails) Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setStripeResponseGetter, urlEncode, urlEncodeId
Methods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
TestClock
public TestClock()
-
-
Method Details
-
advance
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes toReady
.- Throws:
StripeException
-
advance
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes toReady
.- Throws:
StripeException
-
advance
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes toReady
.- Throws:
StripeException
-
advance
public TestClock advance(TestClockAdvanceParams params, RequestOptions options) throws StripeException Starts advancing a test clock to a specified time in the future. Advancement is done when status changes toReady
.- Throws:
StripeException
-
create
Creates a new test clock that can be attached to new customers and quotes.- Throws:
StripeException
-
create
public static TestClock create(Map<String, Object> params, RequestOptions options) throws StripeExceptionCreates a new test clock that can be attached to new customers and quotes.- Throws:
StripeException
-
create
Creates a new test clock that can be attached to new customers and quotes.- Throws:
StripeException
-
create
public static TestClock create(TestClockCreateParams params, RequestOptions options) throws StripeException Creates a new test clock that can be attached to new customers and quotes.- Throws:
StripeException
-
delete
Deletes a test clock.- Throws:
StripeException
-
delete
Deletes a test clock.- Throws:
StripeException
-
delete
Deletes a test clock.- Throws:
StripeException
-
delete
Deletes a test clock.- Throws:
StripeException
-
list
Returns a list of your test clocks.- Throws:
StripeException
-
list
public static TestClockCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionReturns a list of your test clocks.- Throws:
StripeException
-
list
Returns a list of your test clocks.- Throws:
StripeException
-
list
public static TestClockCollection list(TestClockListParams params, RequestOptions options) throws StripeException Returns a list of your test clocks.- Throws:
StripeException
-
retrieve
Retrieves a test clock.- Throws:
StripeException
-
retrieve
Retrieves a test clock.- Throws:
StripeException
-
retrieve
public static TestClock retrieve(String testClock, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves a test clock.- Throws:
StripeException
-
retrieve
public static TestClock retrieve(String testClock, TestClockRetrieveParams params, RequestOptions options) throws StripeException Retrieves a test clock.- Throws:
StripeException
-
setResponseGetter
Thefrozen_time
that the Test Clock is advancing towards.- Specified by:
setResponseGetter
in interfaceStripeActiveObject
- Overrides:
setResponseGetter
in classApiResource
- Parameters:
responseGetter
- theStripeResponseGetter
instance to use for making further requests.
-
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getDeleted
Always true for a deleted object. -
getDeletesAfter
Time at which this clock is scheduled to auto delete. -
getFrozenTime
Time at which all objects belonging to this clock are frozen. -
getLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
getName
The custom name supplied at creation. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
test_helpers.test_clock
. -
getStatus
The status of the Test Clock.One of
advancing
,internal_failure
, orready
. -
getStatusDetails
-
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setDeleted
Always true for a deleted object. -
setDeletesAfter
Time at which this clock is scheduled to auto delete. -
setFrozenTime
Time at which all objects belonging to this clock are frozen. -
setId
Unique identifier for the object. -
setLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
setName
The custom name supplied at creation. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
test_helpers.test_clock
. -
setStatus
The status of the Test Clock.One of
advancing
,internal_failure
, orready
. -
setStatusDetails
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object.
-