PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.8
Booking for Appointments and Events Calendar – Amelia v2.4.8
2.4.8 2.4.7 2.4.6 2.4.5 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 / Billing / CreditGrant.php
ameliabooking / vendor / stripe / stripe-php / lib / Billing Last commit date
Alert.php 7 months ago AlertTriggered.php 7 months ago CreditBalanceSummary.php 7 months ago CreditBalanceTransaction.php 7 months ago CreditGrant.php 7 months ago Meter.php 7 months ago MeterEvent.php 7 months ago MeterEventAdjustment.php 7 months ago MeterEventSummary.php 7 months ago
CreditGrant.php
135 lines
1 <?php
2
3 // File generated from our OpenAPI spec
4 namespace AmeliaVendor\Stripe\Billing;
5
6 /**
7 * A credit grant is an API resource that documents the allocation of some billing credits to a customer.
8 *
9 * Related guide: <a href="https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits">Billing credits</a>
10 *
11 * @property string $id Unique identifier for the object.
12 * @property string $object String representing the object's type. Objects of the same type share the same value.
13 * @property (object{monetary: null|(object{currency: string, value: int}&\AmeliaVendor\Stripe\StripeObject), type: string}&\AmeliaVendor\Stripe\StripeObject) $amount
14 * @property (object{scope: (object{price_type?: string, prices?: ((object{id: null|string}&\AmeliaVendor\Stripe\StripeObject))[]}&\AmeliaVendor\Stripe\StripeObject)}&\AmeliaVendor\Stripe\StripeObject) $applicability_config
15 * @property string $category The category of this credit grant. This is for tracking purposes and isn't displayed to the customer.
16 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17 * @property string|\AmeliaVendor\Stripe\Customer $customer ID of the customer receiving the billing credits.
18 * @property null|int $effective_at The time when the billing credits become effective-when they're eligible for use.
19 * @property null|int $expires_at The time when the billing credits expire. If not present, the billing credits don't expire.
20 * @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.
21 * @property \AmeliaVendor\Stripe\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.
22 * @property null|string $name A descriptive name shown in dashboard.
23 * @property null|int $priority The priority for applying this credit grant. The highest priority is 0 and the lowest is 100.
24 * @property null|string|\AmeliaVendor\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this credit grant belongs to.
25 * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
26 * @property null|int $voided_at The time when this credit grant was voided. If not present, the credit grant hasn't been voided.
27 */
28 class CreditGrant extends \AmeliaVendor\Stripe\ApiResource
29 {
30 const OBJECT_NAME = 'billing.credit_grant';
31 use \AmeliaVendor\Stripe\ApiOperations\Update;
32 const CATEGORY_PAID = 'paid';
33 const CATEGORY_PROMOTIONAL = 'promotional';
34 /**
35 * Creates a credit grant.
36 *
37 * @param null|array{amount: array{monetary?: array{currency: string, value: int}, type: string}, applicability_config: array{scope: array{price_type?: string, prices?: array{id: string}[]}}, category: string, customer: string, effective_at?: int, expand?: string[], expires_at?: int, metadata?: array<string, string>, name?: string, priority?: int} $params
38 * @param null|array|string $options
39 *
40 * @return CreditGrant the created resource
41 *
42 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
43 */
44 public static function create($params = null, $options = null)
45 {
46 self::_validateParams($params);
47 $url = static::classUrl();
48 list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
49 $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
50 $obj->setLastResponse($response);
51 return $obj;
52 }
53 /**
54 * Retrieve a list of credit grants.
55 *
56 * @param null|array{customer?: string, ending_before?: string, expand?: string[], limit?: int, starting_after?: string} $params
57 * @param null|array|string $opts
58 *
59 * @return \AmeliaVendor\Stripe\Collection<CreditGrant> of ApiResources
60 *
61 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
62 */
63 public static function all($params = null, $opts = null)
64 {
65 $url = static::classUrl();
66 return static::_requestPage($url, \AmeliaVendor\Stripe\Collection::class, $params, $opts);
67 }
68 /**
69 * Retrieves a credit grant.
70 *
71 * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
72 * @param null|array|string $opts
73 *
74 * @return CreditGrant
75 *
76 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
77 */
78 public static function retrieve($id, $opts = null)
79 {
80 $opts = \AmeliaVendor\Stripe\Util\RequestOptions::parse($opts);
81 $instance = new static($id, $opts);
82 $instance->refresh();
83 return $instance;
84 }
85 /**
86 * Updates a credit grant.
87 *
88 * @param string $id the ID of the resource to update
89 * @param null|array{expand?: string[], expires_at?: null|int, metadata?: array<string, string>} $params
90 * @param null|array|string $opts
91 *
92 * @return CreditGrant the updated resource
93 *
94 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
95 */
96 public static function update($id, $params = null, $opts = null)
97 {
98 self::_validateParams($params);
99 $url = static::resourceUrl($id);
100 list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
101 $obj = \AmeliaVendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
102 $obj->setLastResponse($response);
103 return $obj;
104 }
105 /**
106 * @param null|array $params
107 * @param null|array|string $opts
108 *
109 * @return CreditGrant the expired credit grant
110 *
111 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
112 */
113 public function expire($params = null, $opts = null)
114 {
115 $url = $this->instanceUrl() . '/expire';
116 list($response, $opts) = $this->_request('post', $url, $params, $opts);
117 $this->refreshFrom($response, $opts);
118 return $this;
119 }
120 /**
121 * @param null|array $params
122 * @param null|array|string $opts
123 *
124 * @return CreditGrant the voided credit grant
125 *
126 * @throws \AmeliaVendor\Stripe\Exception\ApiErrorException if the request fails
127 */
128 public function voidGrant($params = null, $opts = null)
129 {
130 $url = $this->instanceUrl() . '/void';
131 list($response, $opts) = $this->_request('post', $url, $params, $opts);
132 $this->refreshFrom($response, $opts);
133 return $this;
134 }
135 }