From 10430ff37627fc6eaf0cc7d636c081af60faba9b Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 07:28:09 -0700 Subject: [PATCH] Codegen for openapi v163 --- 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(