PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / stripe / stripe-php / lib / TestHelpers / TestClock.php
ameliabooking / vendor / stripe / stripe-php / lib / TestHelpers Last commit date
TestClock.php 6 months ago
TestClock.php
126 lines
1 <?php
2
3 // File generated from our OpenAPI spec
4
5 namespace AmeliaVendor\Stripe\TestHelpers;
6
7 /**
8 * A test clock enables deterministic control over objects in testmode. With a test clock, you can create
9 * 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,
10 * 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.
11 *
12 * @property string $id Unique identifier for the object.
13 * @property string $object String representing the object's type. Objects of the same type share the same value.
14 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
15 * @property int $deletes_after Time at which this clock is scheduled to auto delete.
16 * @property int $frozen_time Time at which all objects belonging to this clock are frozen.
17 * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
18 * @property null|string $name The custom name supplied at creation.
19 * @property string $status The status of the Test Clock.
20 * @property (object{advancing?: (object{target_frozen_time: int}&\AmeliaVendor\Stripe\StripeObject)}&\AmeliaVendor\Stripe\StripeObject) $status_details
21 */
22 class TestClock extends \AmeliaVendor\Stripe\ApiResource
23 {
24 const OBJECT_NAME = 'test_helpers.test_clock';
25
26 const STATUS_ADVANCING = 'advancing';
27 const STATUS_INTERNAL_FAILURE = 'internal_failure';
28 const STATUS_READY = 'ready';
29
30 /**
31 * Creates a new test clock that can be attached to new customers and quotes.
32 *
33 * @param null|array{expand?: string[], frozen_time: int, name?: string} $params
34 * @param null|array|string $options
35 *
36 * @return TestClock the created resource
37 *
38 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
39 */
40 public static function create($params = null, $options = null)
41 {
42 self::_validateParams($params);
43 $url = static::classUrl();
44
45 list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
46 $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
47 $obj->setLastResponse($response);
48
49 return $obj;
50 }
51
52 /**
53 * Deletes a test clock.
54 *
55 * @param null|array $params
56 * @param null|array|string $opts
57 *
58 * @return TestClock the deleted resource
59 *
60 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
61 */
62 public function delete($params = null, $opts = null)
63 {
64 self::_validateParams($params);
65
66 $url = $this->instanceUrl();
67 list($response, $opts) = $this->_request('delete', $url, $params, $opts);
68 $this->refreshFrom($response, $opts);
69
70 return $this;
71 }
72
73 /**
74 * Returns a list of your test clocks.
75 *
76 * @param null|array{ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
77 * @param null|array|string $opts
78 *
79 * @return \AmeliaVendor\Stripe\Collection<TestClock> of ApiResources
80 *
81 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
82 */
83 public static function all($params = null, $opts = null)
84 {
85 $url = static::classUrl();
86
87 return static::_requestPage($url, \AmeliaVendor\Stripe\Collection::class, $params, $opts);
88 }
89
90 /**
91 * Retrieves a test clock.
92 *
93 * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
94 * @param null|array|string $opts
95 *
96 * @return TestClock
97 *
98 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
99 */
100 public static function retrieve($id, $opts = null)
101 {
102 $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts);
103 $instance = new static($id, $opts);
104 $instance->refresh();
105
106 return $instance;
107 }
108
109 /**
110 * @param null|array $params
111 * @param null|array|string $opts
112 *
113 * @return TestClock the advanced test clock
114 *
115 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
116 */
117 public function advance($params = null, $opts = null)
118 {
119 $url = $this->instanceUrl() . '/advance';
120 list($response, $opts) = $this->_request('post', $url, $params, $opts);
121 $this->refreshFrom($response, $opts);
122
123 return $this;
124 }
125 }
126