From ada45ba0fe4b37db2892e0cd6a39a0b95ecb48a2 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Mon, 2 May 2022 11:17:28 -0400 Subject: [PATCH] Codegen for openapi e0e5752 --- init.php | 1 + lib/CashBalance.php | 66 +++++++++++++++++++++++++++++++++ lib/Customer.php | 32 ++++++++++++++++ lib/Invoice.php | 1 + lib/Quote.php | 1 + lib/Service/CustomerService.php | 32 ++++++++++++++++ lib/Subscription.php | 1 + lib/SubscriptionSchedule.php | 1 + lib/TaxId.php | 3 +- lib/Util/ObjectTypes.php | 1 + 10 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 lib/CashBalance.php diff --git a/init.php b/init.php index e45f7da89..91ab70998 100644 --- a/init.php +++ b/init.php @@ -90,6 +90,7 @@ require __DIR__ . '/lib/BitcoinTransaction.php'; require __DIR__ . '/lib/Capability.php'; require __DIR__ . '/lib/Card.php'; +require __DIR__ . '/lib/CashBalance.php'; require __DIR__ . '/lib/Charge.php'; require __DIR__ . '/lib/Checkout/Session.php'; require __DIR__ . '/lib/Collection.php'; diff --git a/lib/CashBalance.php b/lib/CashBalance.php new file mode 100644 index 000000000..c63f272f1 --- /dev/null +++ b/lib/CashBalance.php @@ -0,0 +1,66 @@ +Cash balance represents real funds. Customers can add + * funds to their cash balance by sending a bank transfer. These funds can be used + * for payment and can eventually be paid out to your bank account. + * + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|\Stripe\StripeObject $available A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. + * @property string $customer The ID of the customer whose cash balance this object represents. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $settings + */ +class CashBalance extends ApiResource +{ + const OBJECT_NAME = 'cash_balance'; + + /** + * @return string the API URL for this balance transaction + */ + public function instanceUrl() + { + $customer = $this['customer']; + $customer = Util\Util::utf8($customer); + + $base = Customer::classUrl(); + $customerExtn = \urlencode($customer); + + return "{$base}/{$customerExtn}/cash_balance"; + } + + /** + * @param array|string $_id + * @param null|array|string $_opts + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function retrieve($_id, $_opts = null) + { + $msg = 'Customer Cash Balance cannot be retrieved without a ' . + 'customer ID. Retrieve a Customer Cash Balance using ' . + "`Customer::retrieveCashBalance('customer_id')`."; + + throw new Exception\BadMethodCallException($msg); + } + + /** + * @param string $_id + * @param null|array $_params + * @param null|array|string $_options + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function update($_id, $_params = null, $_options = null) + { + $msg = 'Customer Cash Balance cannot be updated without a ' . + 'customer ID. Retrieve a Customer Cash Balance using ' . + "`Customer::updateCashBalance('customer_id')`."; + + throw new Exception\BadMethodCallException($msg); + } +} diff --git a/lib/Customer.php b/lib/Customer.php index 57c5324bb..813ede338 100644 --- a/lib/Customer.php +++ b/lib/Customer.php @@ -16,6 +16,7 @@ * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\Stripe\StripeObject $address The customer's address. * @property int $balance Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized. + * @property null|\Stripe\CashBalance $cash_balance The current funds being held by Stripe on behalf of the customer. These funds can be applied towards payment intents with source "cash_balance".The settings[reconciliation_mode] field describes whether these funds are applied to such payment intents manually or automatically. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $currency Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes. * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source

ID of the default payment source for the customer.

If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method field instead.

@@ -116,6 +117,37 @@ public static function search($params = null, $opts = null) return self::_searchResource($url, $params, $opts); } + const PATH_CASH_BALANCE = '/cash_balance'; + + /** + * @param string $id the ID of the customer to which the cash balance belongs + * @param null|array $params + * @param null|array|string $opts + * @param mixed $cashBalanceId + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\cash_balance + */ + public static function retrieveCashBalance($id, $cashBalanceId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts); + } + + /** + * @param string $id the ID of the customer to which the cash balance belongs + * @param null|array $params + * @param null|array|string $opts + * @param mixed $cashBalanceId + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\cash_balance + */ + public static function updateCashBalance($id, $cashBalanceId, $params = null, $opts = null) + { + return self::_updateNestedResource($id, static::PATH_CASH_BALANCE, $params, $opts); + } const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; /** diff --git a/lib/Invoice.php b/lib/Invoice.php index eaa78a43f..a67323623 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -49,6 +49,7 @@ * @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due. * @property int $amount_paid The amount, in %s, that was paid. * @property int $amount_remaining The amount remaining, in %s, that is due. + * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the invoice. * @property null|int $application_fee_amount The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. * @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users. diff --git a/lib/Quote.php b/lib/Quote.php index f94076909..b3fcb3493 100644 --- a/lib/Quote.php +++ b/lib/Quote.php @@ -13,6 +13,7 @@ * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount_subtotal Total before any discounts or taxes are applied. * @property int $amount_total Total after discounts and taxes are applied. + * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the quote. * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote. * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote. * @property \Stripe\StripeObject $automatic_tax diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index d6086d8a2..fe4163b83 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -276,6 +276,22 @@ public function retrieveBalanceTransaction($parentId, $id, $params = null, $opts return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); } + /** + * Retrieves a customer’s cash balance. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\cash_balance + */ + public function retrieveCashBalance($parentId, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts); + } + /** * Retrieve a specified source for a given customer. * @@ -376,6 +392,22 @@ public function updateBalanceTransaction($parentId, $id, $params = null, $opts = return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); } + /** + * Updates a customer’s cash balance. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\cash_balance + */ + public function updateCashBalance($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts); + } + /** * @param string $parentId * @param string $id diff --git a/lib/Subscription.php b/lib/Subscription.php index 25224d690..7a02c2295 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -13,6 +13,7 @@ * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the subscription. * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. * @property \Stripe\StripeObject $automatic_tax * @property int $billing_cycle_anchor Determines the date of the first full invoice, and, for plans with month or year intervals, the day of the month for subsequent invoices. diff --git a/lib/SubscriptionSchedule.php b/lib/SubscriptionSchedule.php index d4a25ddfb..c1d4ce02f 100644 --- a/lib/SubscriptionSchedule.php +++ b/lib/SubscriptionSchedule.php @@ -14,6 +14,7 @@ * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the schedule. * @property null|int $canceled_at Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. * @property null|int $completed_at Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. diff --git a/lib/TaxId.php b/lib/TaxId.php index 0d9e7e7a5..f8e869339 100644 --- a/lib/TaxId.php +++ b/lib/TaxId.php @@ -18,7 +18,7 @@ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\Stripe\Customer $customer ID of the customer. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. - * @property string $type Type of the tax ID, one of ae_trn, au_abn, au_arn, bg_uic, br_cnpj, br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, ca_pst_sk, ca_qst, ch_vat, cl_tin, es_cif, eu_vat, gb_vat, ge_vat, hk_br, hu_tin, id_npwp, il_vat, in_gst, is_vat, jp_cn, jp_rn, kr_brn, li_uid, mx_rfc, my_frp, my_itn, my_sst, no_vat, nz_gst, ru_inn, ru_kpp, sa_vat, sg_gst, sg_uen, si_tin, th_vat, tw_vat, ua_vat, us_ein, or za_vat. Note that some legacy tax IDs have type unknown + * @property string $type Type of the tax ID, one of ae_trn, au_abn, au_arn, bg_uic, br_cnpj, br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, ca_pst_sk, ca_qst, ch_vat, cl_tin, es_cif, eu_oss_vat, eu_vat, gb_vat, ge_vat, hk_br, hu_tin, id_npwp, il_vat, in_gst, is_vat, jp_cn, jp_rn, kr_brn, li_uid, mx_rfc, my_frp, my_itn, my_sst, no_vat, nz_gst, ru_inn, ru_kpp, sa_vat, sg_gst, sg_uen, si_tin, th_vat, tw_vat, ua_vat, us_ein, or za_vat. Note that some legacy tax IDs have type unknown * @property string $value Value of the tax ID. * @property null|\Stripe\StripeObject $verification Tax ID verification information. */ @@ -43,6 +43,7 @@ class TaxId extends ApiResource const TYPE_CH_VAT = 'ch_vat'; const TYPE_CL_TIN = 'cl_tin'; const TYPE_ES_CIF = 'es_cif'; + const TYPE_EU_OSS_VAT = 'eu_oss_vat'; const TYPE_EU_VAT = 'eu_vat'; const TYPE_GB_VAT = 'gb_vat'; const TYPE_GE_VAT = 'ge_vat'; diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index 205c73112..b3b8400d9 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -25,6 +25,7 @@ class ObjectTypes \Stripe\BitcoinTransaction::OBJECT_NAME => \Stripe\BitcoinTransaction::class, \Stripe\Capability::OBJECT_NAME => \Stripe\Capability::class, \Stripe\Card::OBJECT_NAME => \Stripe\Card::class, + \Stripe\CashBalance::OBJECT_NAME => \Stripe\CashBalance::class, \Stripe\Charge::OBJECT_NAME => \Stripe\Charge::class, \Stripe\Checkout\Session::OBJECT_NAME => \Stripe\Checkout\Session::class, \Stripe\Collection::OBJECT_NAME => \Stripe\Collection::class,