From 6935728d87858c96c5d99ac858eab135ac2d4046 Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Wed, 6 Jul 2022 12:31:58 -0700 Subject: [PATCH 1/6] Codegen for openapi v162 (#1318) --- OPENAPI_VERSION | 2 +- lib/CashBalance.php | 2 +- lib/Event.php | 5 + lib/Service/CustomerService.php | 2 +- tests/Stripe/GeneratedExamplesTest.php | 133 +++++++++++++------------ 5 files changed, 79 insertions(+), 65 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 515f433c0..b164d836d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v161 \ No newline at end of file +v162 \ No newline at end of file diff --git a/lib/CashBalance.php b/lib/CashBalance.php index c63f272f1..3e7396157 100644 --- a/lib/CashBalance.php +++ b/lib/CashBalance.php @@ -10,7 +10,7 @@ * 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 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. Amounts are represented in the smallest currency unit. * @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 diff --git a/lib/Event.php b/lib/Event.php index 91a39dd6c..e4c2ce3eb 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -118,6 +118,11 @@ class Event extends ApiResource const CUSTOMER_TAX_ID_UPDATED = 'customer.tax_id.updated'; const CUSTOMER_UPDATED = 'customer.updated'; const FILE_CREATED = 'file.created'; + const FINANCIAL_CONNECTIONS_ACCOUNT_CREATED = 'financial_connections.account.created'; + const FINANCIAL_CONNECTIONS_ACCOUNT_DEACTIVATED = 'financial_connections.account.deactivated'; + const FINANCIAL_CONNECTIONS_ACCOUNT_DISCONNECTED = 'financial_connections.account.disconnected'; + const FINANCIAL_CONNECTIONS_ACCOUNT_REACTIVATED = 'financial_connections.account.reactivated'; + const FINANCIAL_CONNECTIONS_ACCOUNT_REFRESHED_BALANCE = 'financial_connections.account.refreshed_balance'; const IDENTITY_VERIFICATION_SESSION_CANCELED = 'identity.verification_session.canceled'; const IDENTITY_VERIFICATION_SESSION_CREATED = 'identity.verification_session.created'; const IDENTITY_VERIFICATION_SESSION_PROCESSING = 'identity.verification_session.processing'; diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index 0b717130e..f7a9980f2 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -410,7 +410,7 @@ public function updateBalanceTransaction($parentId, $id, $params = null, $opts = } /** - * Updates a customer’s cash balance. + * Changes the settings on a customer’s cash balance. * * @param string $parentId * @param null|array $params diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index cd511e19b..6a7e825e5 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -211,6 +211,15 @@ public function testRetrieveSession() static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } + public function testUpcomingInvoice() + { + $this->expectsRequest('get', '/v1/invoices/upcoming'); + $result = $this->client->invoices->upcoming( + ['customer' => 'cus_9utnxg47pWjV1e'] + ); + static::assertInstanceOf(\Stripe\Invoice::class, $result); + } + public function testCreateOrder() { $this->expectsRequest('post', '/v1/orders'); @@ -320,6 +329,16 @@ public function testListLineItemsPaymentLink() static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); } + public function testListSetupAttempt() + { + $this->expectsRequest('get', '/v1/setup_attempts'); + $result = $this->client->setupAttempts->all( + ['limit' => 3, 'setup_intent' => 'si_xyz'] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\SetupAttempt::class, $result->data[0]); + } + public function testVerifyMicrodepositsSetupIntent() { $this->expectsRequest( @@ -399,6 +418,58 @@ public function testFundCashBalanceCustomer() static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } + public function testDeliverCardCard() + { + $this->expectsRequest( + 'post', + '/v1/test_helpers/issuing/cards/card_123/shipping/deliver' + ); + $result = $this->client->testHelpers->issuing->cards->deliverCard( + 'card_123', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + } + + public function testFailCardCard() + { + $this->expectsRequest( + 'post', + '/v1/test_helpers/issuing/cards/card_123/shipping/fail' + ); + $result = $this->client->testHelpers->issuing->cards->failCard( + 'card_123', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + } + + public function testReturnCardCard() + { + $this->expectsRequest( + 'post', + '/v1/test_helpers/issuing/cards/card_123/shipping/return' + ); + $result = $this->client->testHelpers->issuing->cards->returnCard( + 'card_123', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + } + + public function testShipCardCard() + { + $this->expectsRequest( + 'post', + '/v1/test_helpers/issuing/cards/card_123/shipping/ship' + ); + $result = $this->client->testHelpers->issuing->cards->shipCard( + 'card_123', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + } + public function testExpireRefund() { $this->expectsRequest('post', '/v1/test_helpers/refunds/re_123/expire'); @@ -572,68 +643,6 @@ public function testCreateToken() static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testListSetupAttempt() - { - $this->expectsRequest('get', '/v1/setup_attempts'); - $result = $this->client->setupAttempts->all( - ['limit' => 3, 'setup_intent' => 'si_xyz'] - ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SetupAttempt::class, $result->data[0]); - } - - public function testDeliverCardCard() - { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/cards/card_123/shipping/deliver' - ); - $result = $this->client->testHelpers->issuing->cards->deliverCard( - 'card_123', - [] - ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); - } - - public function testFailCardCard() - { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/cards/card_123/shipping/fail' - ); - $result = $this->client->testHelpers->issuing->cards->failCard( - 'card_123', - [] - ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); - } - - public function testReturnCardCard() - { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/cards/card_123/shipping/return' - ); - $result = $this->client->testHelpers->issuing->cards->returnCard( - 'card_123', - [] - ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); - } - - public function testShipCardCard() - { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/cards/card_123/shipping/ship' - ); - $result = $this->client->testHelpers->issuing->cards->shipCard( - 'card_123', - [] - ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); - } - public function testCreateAccountLink() { $this->expectsRequest('post', '/v1/account_links'); From 83bf6ce0592c2e0ad7ae0a42854bbd767cd07920 Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Thu, 7 Jul 2022 10:46:33 -0700 Subject: [PATCH 2/6] Codegen for openapi v163 (#1319) --- OPENAPI_VERSION | 2 +- lib/Coupon.php | 1 + lib/Price.php | 1 + lib/Subscription.php | 1 + tests/Stripe/GeneratedExamplesTest.php | 20 +++++++++++++++++++- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b164d836d..1f7b99f73 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v162 \ No newline at end of file +v163 \ No newline at end of file diff --git a/lib/Coupon.php b/lib/Coupon.php index 424c22226..ce9b611d5 100644 --- a/lib/Coupon.php +++ b/lib/Coupon.php @@ -21,6 +21,7 @@ * @property \Stripe\StripeObject $applies_to * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $currency If amount_off has been set, the three-letter ISO code for the currency of the amount to take off. + * @property \Stripe\StripeObject $currency_options Coupons defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency. * @property string $duration One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount. * @property null|int $duration_in_months If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once. * @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. diff --git a/lib/Price.php b/lib/Price.php index 43a651a3a..defb37d57 100644 --- a/lib/Price.php +++ b/lib/Price.php @@ -29,6 +29,7 @@ * @property string $billing_scheme Describes how to compute the price per period. Either per_unit or tiered. per_unit indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity (for prices with usage_type=licensed), or per unit of total usage (for prices with usage_type=metered). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property \Stripe\StripeObject $currency_options Prices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency. * @property null|\Stripe\StripeObject $custom_unit_amount When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. * @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 null|string $lookup_key A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. diff --git a/lib/Subscription.php b/lib/Subscription.php index 648504130..3166e6d40 100644 --- a/lib/Subscription.php +++ b/lib/Subscription.php @@ -23,6 +23,7 @@ * @property null|int $canceled_at If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with cancel_at_period_end, canceled_at will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. * @property string $collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property int $current_period_end End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. * @property int $current_period_start Start of the current period that the subscription has been invoiced for. * @property string|\Stripe\Customer $customer ID of the customer who owns the subscription. diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 6a7e825e5..5e30052c9 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -329,6 +329,24 @@ public function testListLineItemsPaymentLink() static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); } + public function testCreatePrice() + { + $this->expectsRequest('post', '/v1/prices'); + $result = $this->client->prices->create( + [ + 'unit_amount' => 2000, + 'currency' => 'usd', + 'currency_options' => [ + 'uah' => ['unit_amount' => 5000], + 'eur' => ['unit_amount' => 1800], + ], + 'recurring' => ['interval' => 'month'], + 'product' => 'prod_xxxxxxxxxxxxx', + ] + ); + static::assertInstanceOf(\Stripe\Price::class, $result); + } + public function testListSetupAttempt() { $this->expectsRequest('get', '/v1/setup_attempts'); @@ -2312,7 +2330,7 @@ public function testListPrice() static::assertInstanceOf(\Stripe\Price::class, $result->data[0]); } - public function testCreatePrice() + public function testCreatePrice2() { $this->expectsRequest('post', '/v1/prices'); $result = $this->client->prices->create( From ae44989a37e0785f325d696719afa46e3503dc7d Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 10:46:57 -0700 Subject: [PATCH 3/6] Bump version to 8.10.0 --- CHANGELOG.md | 27 +++++++++++++++++---------- VERSION | 2 +- lib/Stripe.php | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7126e89a5..00e8cf704 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,28 @@ # Changelog +## 8.10.0 - 2022-07-07 +* [#1319](https://github.com/stripe/stripe-php/pull/1319) API Updates + * Add support for `currency_options` on `Coupon` and `Price` + * Add support for `currency` on `Subscription` +* [#1318](https://github.com/stripe/stripe-php/pull/1318) API Updates + * Add support for new values financial_connections.account.created, financial_connections.account.deactivated, financial_connections.account.disconnected, financial_connections.account.reactivated, and financial_connections.account.refreshed_balance on `Event`. + ## 8.9.0 - 2022-06-29 * [#1316](https://github.com/stripe/stripe-php/pull/1316) API Updates - * Add support for `deliver_card`, `fail_card`, `return_card`, and `ship_card` test helper methods on resource `Issuing.Card` - * Add support for `subtotal_excluding_tax` on `CreditNote` and `Invoice` - * Add support for `amount_excluding_tax` and `unit_amount_excluding_tax` on `CreditNoteLineItem` and `InvoiceLineItem` - * Add support for `total_excluding_tax` on `Invoice` - * Change type of `PaymentLink.payment_method_types[]` from `literal('card')` to `enum` - * Add support for `promptpay` on `PaymentMethod` - * Add support for new value `promptpay` on enum `PaymentMethod.type` - * Add support for `hosted_regulatory_receipt_url` and `reversal_details` on `Treasury.ReceivedCredit` and `Treasury.ReceivedDebit` + * Add support for `deliver_card`, `fail_card`, `return_card`, and `ship_card` test helper methods on resource `Issuing.Card` + * Add support for `subtotal_excluding_tax` on `CreditNote` and `Invoice` + * Add support for `amount_excluding_tax` and `unit_amount_excluding_tax` on `CreditNoteLineItem` and `InvoiceLineItem` + * Add support for `total_excluding_tax` on `Invoice` + * Change type of `PaymentLink.payment_method_types[]` from `literal('card')` to `enum` + * Add support for `promptpay` on `PaymentMethod` + * Add support for new value `promptpay` on enum `PaymentMethod.type` + * Add support for `hosted_regulatory_receipt_url` and `reversal_details` on `Treasury.ReceivedCredit` and `Treasury.ReceivedDebit` ## 8.8.0 - 2022-06-23 * [#1302](https://github.com/stripe/stripe-php/pull/1302) API Updates * Add support for `custom_unit_amount` on `Price` * [#1301](https://github.com/stripe/stripe-php/pull/1301) API Updates - + Documentation updates. ## 8.7.0 - 2022-06-17 @@ -28,7 +35,7 @@ * [#1302](https://github.com/stripe/stripe-php/pull/1302) API Updates * Add support for `custom_unit_amount` on `Price` * [#1301](https://github.com/stripe/stripe-php/pull/1301) API Updates - + Documentation updates. ## 8.6.0 - 2022-06-08 diff --git a/VERSION b/VERSION index e5c15102d..7f6758ef9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.9.0 +8.10.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index e3d74d3c2..669c9b97e 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '8.9.0'; + const VERSION = '8.10.0'; /** * @return string the API key used for requests From e98543650f8bc7fa7034cd6cbd10552a84022c24 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 11:05:25 -0700 Subject: [PATCH 4/6] Set version to 8.10.0 to simplify merge --- VERSION | 2 +- lib/Stripe.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index e5c15102d..7f6758ef9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.9.0 +8.10.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index e3d74d3c2..669c9b97e 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '8.9.0'; + const VERSION = '8.10.0'; /** * @return string the API key used for requests From 45de6a73ea2d91add8007a4543958eec0b027eb9 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 11:05:26 -0700 Subject: [PATCH 5/6] Reset version to 8.9.0 --- VERSION | 2 +- lib/Stripe.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 7f6758ef9..e5c15102d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.10.0 +8.9.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index 669c9b97e..e3d74d3c2 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '8.10.0'; + const VERSION = '8.9.0'; /** * @return string the API key used for requests From 1384c856a07240c250627092b06c866a6d45c06a Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 11:05:55 -0700 Subject: [PATCH 6/6] Codegen for openapi v163 --- lib/PaymentIntent.php | 4 ++++ lib/Util/ApiVersion.php | 2 +- tests/Stripe/GeneratedExamplesTest.php | 20 +++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index b7d777abc..eafb9244c 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -49,6 +49,7 @@ * @property null|\Stripe\StripeObject $processing If present, this property tells you about the processing state of the payment. * @property null|string $receipt_email Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings. * @property null|string|\Stripe\Review $review ID of the review associated with this PaymentIntent, if any. + * @property string $secret_key_confirmation Indicates whether confirmation for this PaymentIntent using a secret key is required or optional. * @property null|string $setup_future_usage

Indicates that you intend to make future payments with this PaymentIntent's payment method.

Providing this parameter will attach the payment method to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be attached to a Customer after the transaction completes.

When processing card payments, Stripe also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.

* @property null|\Stripe\StripeObject $shipping Shipping information for this PaymentIntent. * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. @@ -68,6 +69,9 @@ class PaymentIntent extends ApiResource use ApiOperations\Search; use ApiOperations\Update; + const SECRET_KEY_CONFIRMATION_OPTIONAL = 'optional'; + const SECRET_KEY_CONFIRMATION_REQUIRED = 'required'; + const STATUS_CANCELED = 'canceled'; const STATUS_PROCESSING = 'processing'; const STATUS_REQUIRES_ACTION = 'requires_action'; diff --git a/lib/Util/ApiVersion.php b/lib/Util/ApiVersion.php index 178b8d4ba..3d2f87f38 100644 --- a/lib/Util/ApiVersion.php +++ b/lib/Util/ApiVersion.php @@ -6,5 +6,5 @@ class ApiVersion { - const CURRENT = '2020-08-27'; + const CURRENT = '2020-08-27; server_side_confirmation_beta=v1'; } diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 6a7e825e5..5e30052c9 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -329,6 +329,24 @@ public function testListLineItemsPaymentLink() static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); } + public function testCreatePrice() + { + $this->expectsRequest('post', '/v1/prices'); + $result = $this->client->prices->create( + [ + 'unit_amount' => 2000, + 'currency' => 'usd', + 'currency_options' => [ + 'uah' => ['unit_amount' => 5000], + 'eur' => ['unit_amount' => 1800], + ], + 'recurring' => ['interval' => 'month'], + 'product' => 'prod_xxxxxxxxxxxxx', + ] + ); + static::assertInstanceOf(\Stripe\Price::class, $result); + } + public function testListSetupAttempt() { $this->expectsRequest('get', '/v1/setup_attempts'); @@ -2312,7 +2330,7 @@ public function testListPrice() static::assertInstanceOf(\Stripe\Price::class, $result->data[0]); } - public function testCreatePrice() + public function testCreatePrice2() { $this->expectsRequest('post', '/v1/prices'); $result = $this->client->prices->create(