From d2d0737f87477f0aed2f1fe953a7b7f19b5858c2 Mon Sep 17 00:00:00 2001 From: Yejia Chen Date: Mon, 15 Nov 2021 15:47:33 -0500 Subject: [PATCH 1/2] Codegen for openapi b428029 --- init.php | 2 + lib/Checkout/Session.php | 29 +++++- lib/Price.php | 2 +- lib/Service/ChargeService.php | 7 +- lib/Service/Checkout/SessionService.php | 19 ++++ lib/Service/CoreServiceFactory.php | 2 + lib/Service/PaymentIntentService.php | 4 +- lib/Service/PaymentMethodService.php | 4 +- lib/Service/ShippingRateService.php | 70 +++++++++++++ lib/ShippingRate.php | 40 ++++++++ lib/StripeClient.php | 1 + lib/Terminal/ConnectionToken.php | 6 +- lib/Terminal/Location.php | 4 +- lib/Terminal/Reader.php | 2 +- lib/Util/ObjectTypes.php | 1 + tests/Stripe/GeneratedExamplesTest.php | 126 +++++++++++++++++++++--- 16 files changed, 293 insertions(+), 26 deletions(-) create mode 100644 lib/Service/ShippingRateService.php create mode 100644 lib/ShippingRate.php diff --git a/init.php b/init.php index df7764340..7dda8f163 100644 --- a/init.php +++ b/init.php @@ -143,6 +143,7 @@ require __DIR__ . '/lib/Review.php'; require __DIR__ . '/lib/SetupAttempt.php'; require __DIR__ . '/lib/SetupIntent.php'; +require __DIR__ . '/lib/ShippingRate.php'; require __DIR__ . '/lib/Sigma/ScheduledQueryRun.php'; require __DIR__ . '/lib/SKU.php'; require __DIR__ . '/lib/Source.php'; @@ -215,6 +216,7 @@ require __DIR__ . '/lib/Service/ReviewService.php'; require __DIR__ . '/lib/Service/SetupAttemptService.php'; require __DIR__ . '/lib/Service/SetupIntentService.php'; +require __DIR__ . '/lib/Service/ShippingRateService.php'; require __DIR__ . '/lib/Service/Sigma/ScheduledQueryRunService.php'; require __DIR__ . '/lib/Service/SkuService.php'; require __DIR__ . '/lib/Service/SourceService.php'; diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php index 08bd4d6f7..9601dd8d4 100644 --- a/lib/Checkout/Session.php +++ b/lib/Checkout/Session.php @@ -7,8 +7,9 @@ /** * A Checkout Session represents your customer's session as they pay for one-time * purchases or subscriptions through Checkout. We recommend - * creating a new Session each time your customer attempts to pay. + * href="https://stripe.com/docs/payments/checkout">Checkout or Payment Links. We + * recommend creating a new Session each time your customer attempts to pay. * * Once payment is successful, the Checkout Session will contain a reference to the * Customer, and either the @@ -53,6 +54,9 @@ * @property null|string|\Stripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in setup mode. * @property null|\Stripe\StripeObject $shipping Shipping information for this Checkout Session. * @property null|\Stripe\StripeObject $shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer. + * @property \Stripe\StripeObject[] $shipping_options The shipping rate options applied to this Session. + * @property null|string|\Stripe\ShippingRate $shipping_rate The ID of the ShippingRate for Checkout Sessions in payment mode. + * @property null|string $status The status of the Checkout Session, one of open, complete, or expired. * @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. submit_type can only be specified on Checkout Sessions in payment mode, but not Checkout Sessions in subscription or setup mode. * @property null|string|\Stripe\Subscription $subscription The ID of the subscription for Checkout Sessions in subscription mode. * @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful. @@ -80,11 +84,32 @@ class Session extends \Stripe\ApiResource const PAYMENT_STATUS_PAID = 'paid'; const PAYMENT_STATUS_UNPAID = 'unpaid'; + const STATUS_COMPLETE = 'complete'; + const STATUS_EXPIRED = 'expired'; + const STATUS_OPEN = 'open'; + const SUBMIT_TYPE_AUTO = 'auto'; const SUBMIT_TYPE_BOOK = 'book'; const SUBMIT_TYPE_DONATE = 'donate'; const SUBMIT_TYPE_PAY = 'pay'; + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Session the expired session + */ + public function expire($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/expire'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + const PATH_LINE_ITEMS = '/line_items'; /** diff --git a/lib/Price.php b/lib/Price.php index 8f994d548..878a7a2c4 100644 --- a/lib/Price.php +++ b/lib/Price.php @@ -30,7 +30,7 @@ * @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 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. + * @property null|string $lookup_key A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $nickname A brief description of the price, hidden from customers. * @property string|\Stripe\Product $product The ID of the product this price is associated with. diff --git a/lib/Service/ChargeService.php b/lib/Service/ChargeService.php index f5321b8ac..f8960edfb 100644 --- a/lib/Service/ChargeService.php +++ b/lib/Service/ChargeService.php @@ -27,9 +27,10 @@ public function all($params = null, $opts = null) * of the two-step payment flow, where first you created a * charge with the capture option set to false. * - * Uncaptured payments expire exactly seven days after they are created. If they - * are not captured by that point in time, they will be marked as refunded and will - * no longer be capturable. + * Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured + * by that point in time, they will be marked as refunded and will no longer be + * capturable. * * @param string $id * @param null|array $params diff --git a/lib/Service/Checkout/SessionService.php b/lib/Service/Checkout/SessionService.php index 9da378878..b42ab8a17 100644 --- a/lib/Service/Checkout/SessionService.php +++ b/lib/Service/Checkout/SessionService.php @@ -55,6 +55,25 @@ public function create($params = null, $opts = null) return $this->request('post', '/v1/checkout/sessions', $params, $opts); } + /** + * A Session can be expired when it is in one of these statuses: open. + * + * After it expires, a customer can’t complete a Session and customers loading the + * Session see a message saying the Session is expired. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Checkout\Session + */ + public function expire($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/checkout/sessions/%s/expire', $id), $params, $opts); + } + /** * Retrieves a Session object. * diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index 2e0c00dad..540d24d50 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -48,6 +48,7 @@ * @property ReviewService $reviews * @property SetupAttemptService $setupAttempts * @property SetupIntentService $setupIntents + * @property ShippingRateService $shippingRates * @property Sigma\SigmaServiceFactory $sigma * @property SkuService $skus * @property SourceService $sources @@ -109,6 +110,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'reviews' => ReviewService::class, 'setupAttempts' => SetupAttemptService::class, 'setupIntents' => SetupIntentService::class, + 'shippingRates' => ShippingRateService::class, 'sigma' => Sigma\SigmaServiceFactory::class, 'skus' => SkuService::class, 'sources' => SourceService::class, diff --git a/lib/Service/PaymentIntentService.php b/lib/Service/PaymentIntentService.php index 43aba46d8..07b81d5e5 100644 --- a/lib/Service/PaymentIntentService.php +++ b/lib/Service/PaymentIntentService.php @@ -48,8 +48,8 @@ public function cancel($id, $params = null, $opts = null) * Capture the funds of an existing uncaptured PaymentIntent when its status is * requires_capture. * - * Uncaptured PaymentIntents will be canceled exactly seven days after they are - * created. + * Uncaptured PaymentIntents will be canceled a set number of days after they are + * created (7 by default). * * Learn more about separate authorization * and capture. diff --git a/lib/Service/PaymentMethodService.php b/lib/Service/PaymentMethodService.php index 3bdebd971..e7f341a0b 100644 --- a/lib/Service/PaymentMethodService.php +++ b/lib/Service/PaymentMethodService.php @@ -7,7 +7,9 @@ class PaymentMethodService extends \Stripe\Service\AbstractService { /** - * Returns a list of PaymentMethods for a given Customer. + * Returns a list of PaymentMethods. For listing a customer’s payment methods, you + * should use List a Customer’s + * PaymentMethods. * * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts diff --git a/lib/Service/ShippingRateService.php b/lib/Service/ShippingRateService.php new file mode 100644 index 000000000..d7b55a8b3 --- /dev/null +++ b/lib/Service/ShippingRateService.php @@ -0,0 +1,70 @@ +requestCollection('get', '/v1/shipping_rates', $params, $opts); + } + + /** + * Creates a new shipping rate object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ShippingRate + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/shipping_rates', $params, $opts); + } + + /** + * Returns the shipping rate object with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ShippingRate + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/shipping_rates/%s', $id), $params, $opts); + } + + /** + * Updates an existing shipping rate object. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ShippingRate + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/shipping_rates/%s', $id), $params, $opts); + } +} diff --git a/lib/ShippingRate.php b/lib/ShippingRate.php new file mode 100644 index 000000000..9091b688c --- /dev/null +++ b/lib/ShippingRate.php @@ -0,0 +1,40 @@ +Checkout Sessions + * to collect shipping costs. + * + * @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 bool $active Whether the shipping rate can be used for new purchases. Defaults to true. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|\Stripe\StripeObject $delivery_estimate The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions. + * @property null|string $display_name The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. + * @property \Stripe\StripeObject $fixed_amount + * @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 $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $tax_behavior Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. + * @property null|string|\Stripe\TaxCode $tax_code A tax code ID. The Shipping tax code is txcd_92010001. + * @property string $type The type of calculation to use on the shipping rate. Can only be fixed_amount for now. + */ +class ShippingRate extends ApiResource +{ + const OBJECT_NAME = 'shipping_rate'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; + + const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive'; + const TAX_BEHAVIOR_INCLUSIVE = 'inclusive'; + const TAX_BEHAVIOR_UNSPECIFIED = 'unspecified'; + + const TYPE_FIXED_AMOUNT = 'fixed_amount'; +} diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 8eae9864e..10d324a94 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -48,6 +48,7 @@ * @property \Stripe\Service\ReviewService $reviews * @property \Stripe\Service\SetupAttemptService $setupAttempts * @property \Stripe\Service\SetupIntentService $setupIntents + * @property \Stripe\Service\ShippingRateService $shippingRates * @property \Stripe\Service\Sigma\SigmaServiceFactory $sigma * @property \Stripe\Service\SkuService $skus * @property \Stripe\Service\SourceService $sources diff --git a/lib/Terminal/ConnectionToken.php b/lib/Terminal/ConnectionToken.php index c6405b019..e49a0b0ec 100644 --- a/lib/Terminal/ConnectionToken.php +++ b/lib/Terminal/ConnectionToken.php @@ -7,11 +7,11 @@ /** * A Connection Token is used by the Stripe Terminal SDK to connect to a reader. * - * Related guide: Fleet Management. + * Related guide: Fleet + * Management. * * @property string $object String representing the object's type. Objects of the same type share the same value. - * @property string $location The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see the docs on scoping connection tokens. + * @property string $location The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see the docs on scoping connection tokens. * @property string $secret Your application should pass this token to the Stripe Terminal SDK. */ class ConnectionToken extends \Stripe\ApiResource diff --git a/lib/Terminal/Location.php b/lib/Terminal/Location.php index 422cd756a..21a2c6352 100644 --- a/lib/Terminal/Location.php +++ b/lib/Terminal/Location.php @@ -7,8 +7,8 @@ /** * A Location represents a grouping of readers. * - * Related guide: Fleet Management. + * Related guide: Fleet + * Management. * * @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. diff --git a/lib/Terminal/Reader.php b/lib/Terminal/Reader.php index bd578ea26..28edf434d 100644 --- a/lib/Terminal/Reader.php +++ b/lib/Terminal/Reader.php @@ -8,7 +8,7 @@ * A Reader represents a physical device for accepting payment details. * * Related guide: Connecting to a + * href="https://stripe.com/docs/terminal/payments/connect-reader">Connecting to a * Reader. * * @property string $id Unique identifier for the object. diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index c4fefc1b7..f60effdd1 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -79,6 +79,7 @@ class ObjectTypes \Stripe\Review::OBJECT_NAME => \Stripe\Review::class, \Stripe\SetupAttempt::OBJECT_NAME => \Stripe\SetupAttempt::class, \Stripe\SetupIntent::OBJECT_NAME => \Stripe\SetupIntent::class, + \Stripe\ShippingRate::OBJECT_NAME => \Stripe\ShippingRate::class, \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \Stripe\Sigma\ScheduledQueryRun::class, \Stripe\SKU::OBJECT_NAME => \Stripe\SKU::class, \Stripe\Source::OBJECT_NAME => \Stripe\Source::class, diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 22c291cf6..2e84cef16 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -1464,6 +1464,20 @@ public function testCreateUsageRecord() static::assertInstanceOf(\Stripe\UsageRecord::class, $result); } + public function testListUsageRecordSummary() + { + $this->expectsRequest( + 'get', + '/v1/subscription_items/si_xxxxxxxxxxxxx/usage_record_summaries' + ); + $result = $this->client->subscriptionItems->allUsageRecordSummaries( + 'si_xxxxxxxxxxxxx', + ['limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\UsageRecordSummary::class, $result->data[0]); + } + public function testCreateAccount() { $this->expectsRequest('post', '/v1/accounts'); @@ -1648,6 +1662,20 @@ public function testUpdateCapability() static::assertInstanceOf(\Stripe\Capability::class, $result); } + public function testListCapability() + { + $this->expectsRequest( + 'get', + '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities' + ); + $result = $this->client->accounts->allCapabilities( + 'acct_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Capability::class, $result->data[0]); + } + public function testListCountrySpec() { $this->expectsRequest('get', '/v1/country_specs'); @@ -1860,6 +1888,27 @@ public function testListTransferReversal() static::assertInstanceOf(\Stripe\TransferReversal::class, $result->data[0]); } + public function testRetrieveEarlyFraudWarning() + { + $this->expectsRequest( + 'get', + '/v1/radar/early_fraud_warnings/issfr_xxxxxxxxxxxxx' + ); + $result = $this->client->radar->earlyFraudWarnings->retrieve( + 'issfr_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Radar\EarlyFraudWarning::class, $result); + } + + public function testListEarlyFraudWarning() + { + $this->expectsRequest('get', '/v1/radar/early_fraud_warnings'); + $result = $this->client->radar->earlyFraudWarnings->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Radar\EarlyFraudWarning::class, $result->data[0]); + } + public function testApproveReview() { $this->expectsRequest('post', '/v1/reviews/prv_xxxxxxxxxxxxx/approve'); @@ -1930,6 +1979,51 @@ public function testListValueList() static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result->data[0]); } + public function testCreateValueListItem() + { + $this->expectsRequest('post', '/v1/radar/value_list_items'); + $result = $this->client->radar->valueListItems->create( + ['value_list' => 'rsl_xxxxxxxxxxxxx', 'value' => '1.2.3.4'] + ); + static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + } + + public function testRetrieveValueListItem() + { + $this->expectsRequest( + 'get', + '/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx' + ); + $result = $this->client->radar->valueListItems->retrieve( + 'rsli_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + } + + public function testDeleteValueListItem() + { + $this->expectsRequest( + 'delete', + '/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx' + ); + $result = $this->client->radar->valueListItems->delete( + 'rsli_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + } + + public function testListValueListItem() + { + $this->expectsRequest('get', '/v1/radar/value_list_items'); + $result = $this->client->radar->valueListItems->all( + ['limit' => 3, 'value_list' => 'rsl_xxxxxxxxxxxxx'] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result->data[0]); + } + public function testRetrieveAuthorization() { $this->expectsRequest( @@ -2406,6 +2500,27 @@ public function testDeleteSku() static::assertInstanceOf(\Stripe\SKU::class, $result); } + public function testRetrieveScheduledQueryRun() + { + $this->expectsRequest( + 'get', + '/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx' + ); + $result = $this->client->sigma->scheduledQueryRuns->retrieve( + 'sqr_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result); + } + + public function testListScheduledQueryRun() + { + $this->expectsRequest('get', '/v1/sigma/scheduled_query_runs'); + $result = $this->client->sigma->scheduledQueryRuns->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result->data[0]); + } + public function testCreateReportRun() { $this->expectsRequest('post', '/v1/reporting/report_runs'); @@ -2491,15 +2606,4 @@ public function testDeleteWebhookEndpoint() $result = $this->client->webhookEndpoints->delete('we_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } - - public function testListPaymentMethodsCustomer() - { - $this->expectsRequest('get', '/v1/customers/cus_xyz/payment_methods'); - $result = $this->client->customers->allPaymentMethods( - 'cus_xyz', - ['type' => 'card'] - ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result->data[0]); - } } From 9f589e2bc7a89976a95a1402244d7a86fb52b9c8 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Mon, 15 Nov 2021 23:53:06 -0500 Subject: [PATCH 2/2] Add generated tests. --- tests/Stripe/GeneratedExamplesTest.php | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 2e84cef16..fc45d921c 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -2606,4 +2606,57 @@ public function testDeleteWebhookEndpoint() $result = $this->client->webhookEndpoints->delete('we_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } + + public function testExpireSession() + { + $this->expectsRequest('post', '/v1/checkout/sessions/sess_xyz/expire'); + $result = $this->client->checkout->sessions->expire('sess_xyz', []); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + } + + public function testCreateShippingRate() + { + $this->expectsRequest('post', '/v1/shipping_rates'); + $result = $this->client->shippingRates->create( + [ + 'display_name' => 'Sample Shipper', + 'fixed_amount' => ['currency' => 'usd', 'amount' => 400], + 'type' => 'fixed_amount', + ] + ); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result); + } + + public function testListShippingRate() + { + $this->expectsRequest('get', '/v1/shipping_rates'); + $result = $this->client->shippingRates->all([]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result->data[0]); + } + + public function testCreateSession3() + { + $this->expectsRequest('post', '/v1/checkout/sessions'); + $result = $this->client->checkout->sessions->create( + [ + 'success_url' => 'https://example.com/success', + 'cancel_url' => 'https://example.com/cancel', + 'mode' => 'payment', + 'shipping_options' => [ + ['shipping_rate' => 'shr_standard'], + [ + 'shipping_rate_data' => [ + 'display_name' => 'Standard', + 'delivery_estimate' => [ + 'minimum' => ['unit' => 'day', 'value' => 5], + 'maximum' => ['unit' => 'day', 'value' => 7], + ], + ], + ], + ], + ] + ); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + } }