Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/tutor-stripe/vendor/stripe/stripe-php/lib/Topup.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
// File generated from our OpenAPI spec
4
+
5
+
namespace Stripe;
6
+
7
+
/**
8
+
* To top up your Stripe balance, you create a top-up object. You can retrieve
9
+
* individual top-ups, as well as list all top-ups. Top-ups are identified by a
10
+
* unique, random ID.
11
+
*
12
+
* Related guide: <a href="https://stripe.com/docs/connect/top-ups">Topping up your platform account</a>
13
+
*
14
+
* @property string $id Unique identifier for the object.
15
+
* @property string $object String representing the object's type. Objects of the same type share the same value.
16
+
* @property int $amount Amount transferred.
17
+
* @property null|BalanceTransaction|string $balance_transaction ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up.
18
+
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
19
+
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
20
+
* @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users.
21
+
* @property null|int $expected_availability_date Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up.
22
+
* @property null|string $failure_code Error code explaining reason for top-up failure if available (see <a href="https://stripe.com/docs/api#errors">the errors section</a> for a list of codes).
23
+
* @property null|string $failure_message Message to user further explaining reason for top-up failure if available.
24
+
* @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.
25
+
* @property StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
26
+
* @property null|Source $source The source field is deprecated. It might not always be present in the API response.
27
+
* @property null|string $statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter.
28
+
* @property string $status The status of the top-up is either <code>canceled</code>, <code>failed</code>, <code>pending</code>, <code>reversed</code>, or <code>succeeded</code>.
29
+
* @property null|string $transfer_group A string that identifies this top-up as part of a group.
30
+
*/
31
+
class Topup extends ApiResource
32
+
{
33
+
const OBJECT_NAME = 'topup';
34
+
35
+
use ApiOperations\Update;
36
+
37
+
const STATUS_CANCELED = 'canceled';
38
+
const STATUS_FAILED = 'failed';
39
+
const STATUS_PENDING = 'pending';
40
+
const STATUS_REVERSED = 'reversed';
41
+
const STATUS_SUCCEEDED = 'succeeded';
42
+
43
+
/**
44
+
* Top up the balance of an account.
45
+
*
46
+
* @param null|array{amount: int, currency: string, description?: string, expand?: string[], metadata?: null|array<string, string>, source?: string, statement_descriptor?: string, transfer_group?: string} $params
47
+
* @param null|array|string $options
48
+
*
49
+
* @return Topup the created resource
50
+
*
51
+
* @throws Exception\ApiErrorException if the request fails
52
+
*/
53
+
public static function create($params = null, $options = null)
54
+
{
55
+
self::_validateParams($params);
56
+
$url = static::classUrl();
57
+
58
+
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
59
+
$obj = Util\Util::convertToStripeObject($response->json, $opts);
60
+
$obj->setLastResponse($response);
61
+
62
+
return $obj;
63
+
}
64
+
65
+
/**
66
+
* Returns a list of top-ups.
67
+
*
68
+
* @param null|array{amount?: array|int, created?: array|int, ending_before?: string, expand?: string[], limit?: int, starting_after?: string, status?: string} $params
69
+
* @param null|array|string $opts
70
+
*
71
+
* @return Collection<Topup> of ApiResources
72
+
*
73
+
* @throws Exception\ApiErrorException if the request fails
74
+
*/
75
+
public static function all($params = null, $opts = null)
76
+
{
77
+
$url = static::classUrl();
78
+
79
+
return static::_requestPage($url, Collection::class, $params, $opts);
80
+
}
81
+
82
+
/**
83
+
* Retrieves the details of a top-up that has previously been created. Supply the
84
+
* unique top-up ID that was returned from your previous request, and Stripe will
85
+
* return the corresponding top-up information.
86
+
*
87
+
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
88
+
* @param null|array|string $opts
89
+
*
90
+
* @return Topup
91
+
*
92
+
* @throws Exception\ApiErrorException if the request fails
93
+
*/
94
+
public static function retrieve($id, $opts = null)
95
+
{
96
+
$opts = Util\RequestOptions::parse($opts);
97
+
$instance = new static($id, $opts);
98
+
$instance->refresh();
99
+
100
+
return $instance;
101
+
}
102
+
103
+
/**
104
+
* Updates the metadata of a top-up. Other top-up details are not editable by
105
+
* design.
106
+
*
107
+
* @param string $id the ID of the resource to update
108
+
* @param null|array{description?: string, expand?: string[], metadata?: null|array<string, string>} $params
109
+
* @param null|array|string $opts
110
+
*
111
+
* @return Topup the updated resource
112
+
*
113
+
* @throws Exception\ApiErrorException if the request fails
114
+
*/
115
+
public static function update($id, $params = null, $opts = null)
116
+
{
117
+
self::_validateParams($params);
118
+
$url = static::resourceUrl($id);
119
+
120
+
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
121
+
$obj = Util\Util::convertToStripeObject($response->json, $opts);
122
+
$obj->setLastResponse($response);
123
+
124
+
return $obj;
125
+
}
126
+
127
+
/**
128
+
* @param null|array $params
129
+
* @param null|array|string $opts
130
+
*
131
+
* @return Topup the canceled topup
132
+
*
133
+
* @throws Exception\ApiErrorException if the request fails
134
+
*/
135
+
public function cancel($params = null, $opts = null)
136
+
{
137
+
$url = $this->instanceUrl() . '/cancel';
138
+
list($response, $opts) = $this->_request('post', $url, $params, $opts);
139
+
$this->refreshFrom($response, $opts);
140
+
141
+
return $this;
142
+
}
143
+
}
144
+