From 69b4b8fbdf2ce086979fed5a8e61bb9117f69cde Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 29 Jun 2022 15:09:03 -0400 Subject: [PATCH 1/4] Codegen for openapi v161 --- OPENAPI_VERSION | 2 +- init.php | 4 + lib/Checkout/Session.php | 2 +- lib/CreditNote.php | 1 + lib/CreditNoteLineItem.php | 2 + lib/Customer.php | 2 +- lib/FinancialConnections/Account.php | 2 +- lib/Invoice.php | 2 + lib/InvoiceLineItem.php | 2 + lib/Order.php | 2 +- lib/PaymentLink.php | 2 +- lib/PaymentMethod.php | 1 + lib/Quote.php | 4 +- lib/SKU.php | 2 +- lib/Service/CreditNoteService.php | 2 +- lib/Service/CustomerService.php | 2 +- .../FinancialConnections/AccountService.php | 2 +- lib/Service/InvoiceService.php | 4 +- lib/Service/OrderService.php | 2 +- lib/Service/PaymentLinkService.php | 2 +- lib/Service/QuoteService.php | 4 +- .../TestHelpers/Issuing/CardService.php | 76 + .../Issuing/IssuingServiceFactory.php | 25 + .../TestHelpers/TestHelpersServiceFactory.php | 2 + lib/Treasury/ReceivedCredit.php | 2 + lib/Treasury/ReceivedDebit.php | 2 + lib/Util/ApiVersion.php | 10 + tests/Stripe/GeneratedExamplesTest.php | 4646 +++++++++-------- 28 files changed, 2477 insertions(+), 2334 deletions(-) create mode 100644 lib/Service/TestHelpers/Issuing/CardService.php create mode 100644 lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php create mode 100644 lib/Util/ApiVersion.php diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 2b4f3461d..515f433c0 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v157 \ No newline at end of file +v161 \ No newline at end of file diff --git a/init.php b/init.php index 07575165e..d3ca3181c 100644 --- a/init.php +++ b/init.php @@ -2,6 +2,8 @@ // File generated from our OpenAPI spec +require __DIR__ . '/lib/Util/ApiVersion.php'; + // Stripe singleton require __DIR__ . '/lib/Stripe.php'; @@ -254,6 +256,7 @@ require __DIR__ . '/lib/Service/Terminal/LocationService.php'; require __DIR__ . '/lib/Service/Terminal/ReaderService.php'; require __DIR__ . '/lib/Service/TestHelpers/CustomerService.php'; +require __DIR__ . '/lib/Service/TestHelpers/Issuing/CardService.php'; require __DIR__ . '/lib/Service/TestHelpers/RefundService.php'; require __DIR__ . '/lib/Service/TestHelpers/Terminal/ReaderService.php'; require __DIR__ . '/lib/Service/TestHelpers/TestClockService.php'; @@ -289,6 +292,7 @@ require __DIR__ . '/lib/Service/Reporting/ReportingServiceFactory.php'; require __DIR__ . '/lib/Service/Sigma/SigmaServiceFactory.php'; require __DIR__ . '/lib/Service/Terminal/TerminalServiceFactory.php'; +require __DIR__ . '/lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php'; require __DIR__ . '/lib/Service/TestHelpers/Terminal/TerminalServiceFactory.php'; require __DIR__ . '/lib/Service/TestHelpers/TestHelpersServiceFactory.php'; require __DIR__ . '/lib/Service/TestHelpers/Treasury/TreasuryServiceFactory.php'; diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php index aa8b34011..e850b6bfe 100644 --- a/lib/Checkout/Session.php +++ b/lib/Checkout/Session.php @@ -38,7 +38,7 @@ * @property null|string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property null|string|\Stripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in payment or subscription mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created. * @property null|string $customer_creation Configure whether a Checkout Session creates a Customer when the Checkout Session completes. - * @property null|\Stripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in payment or subscription mode. + * @property null|\Stripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in setup mode. * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the customer attribute. * @property int $expires_at The timestamp at which the Checkout Session will expire. * @property \Stripe\Collection<\Stripe\LineItem> $line_items The line items purchased by the customer. diff --git a/lib/CreditNote.php b/lib/CreditNote.php index 408367423..f0ba320cb 100644 --- a/lib/CreditNote.php +++ b/lib/CreditNote.php @@ -32,6 +32,7 @@ * @property null|string|\Stripe\Refund $refund Refund related to this credit note. * @property string $status Status of this credit note, one of issued or void. Learn more about voiding credit notes. * @property int $subtotal The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts. + * @property null|int $subtotal_excluding_tax The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts. * @property \Stripe\StripeObject[] $tax_amounts The aggregate amounts calculated per tax rate for all line items. * @property int $total The integer amount in %s representing the total amount of the credit note, including tax and all discount. * @property null|int $total_excluding_tax The integer amount in %s representing the total amount of the credit note, excluding tax, but including discounts. diff --git a/lib/CreditNoteLineItem.php b/lib/CreditNoteLineItem.php index 254886b75..6b2ca2e3e 100644 --- a/lib/CreditNoteLineItem.php +++ b/lib/CreditNoteLineItem.php @@ -8,6 +8,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 int $amount The integer amount in %s representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts. + * @property null|int $amount_excluding_tax The integer amount in %s representing the amount being credited for this line item, excluding all tax and discounts. * @property null|string $description Description of the item being credited. * @property int $discount_amount The integer amount in %s representing the discount being credited for this line item. * @property \Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item @@ -19,6 +20,7 @@ * @property string $type The type of the credit note line item, one of invoice_line_item or custom_line_item. When the type is invoice_line_item there is an additional invoice_line_item property on the resource the value of which is the id of the credited line item on the invoice. * @property null|int $unit_amount The cost of each unit of product being credited. * @property null|string $unit_amount_decimal Same as unit_amount, but contains a decimal value with at most 12 decimal places. + * @property null|string $unit_amount_excluding_tax The amount in %s representing the unit amount being credited for this line item, excluding all tax and discounts. */ class CreditNoteLineItem extends ApiResource { diff --git a/lib/Customer.php b/lib/Customer.php index 8c17f702e..4ea4df4c9 100644 --- a/lib/Customer.php +++ b/lib/Customer.php @@ -84,9 +84,9 @@ public function deleteDiscount($params = null, $opts = null) } /** + * @param string $id * @param null|array $params * @param null|array|string $opts - * @param mixed $id * * @throws \Stripe\Exception\ApiErrorException if the request fails * diff --git a/lib/FinancialConnections/Account.php b/lib/FinancialConnections/Account.php index c8783840f..0fc4e26d2 100644 --- a/lib/FinancialConnections/Account.php +++ b/lib/FinancialConnections/Account.php @@ -67,9 +67,9 @@ public function disconnect($params = null, $opts = null) } /** + * @param string $id * @param null|array $params * @param null|array|string $opts - * @param mixed $id * * @throws \Stripe\Exception\ApiErrorException if the request fails * diff --git a/lib/Invoice.php b/lib/Invoice.php index 707872810..5b8b87df3 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -105,11 +105,13 @@ * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice was prepared for, if any. * @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations. * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated + * @property null|int $subtotal_excluding_tax The integer amount in %s representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this invoice belongs to. * @property \Stripe\StripeObject $threshold_reason * @property int $total Total after discounts and taxes. * @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items. + * @property null|int $total_excluding_tax The integer amount in %s representing the total amount of the invoice including all discounts but excluding all tax. * @property \Stripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items. * @property null|int $webhooks_delivered_at Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have been exhausted. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created. */ diff --git a/lib/InvoiceLineItem.php b/lib/InvoiceLineItem.php index 0a5331e67..e5c123b20 100644 --- a/lib/InvoiceLineItem.php +++ b/lib/InvoiceLineItem.php @@ -8,6 +8,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 int $amount The amount, in %s. + * @property null|int $amount_excluding_tax The integer amount in %s representing the amount for this line item, excluding all tax and discounts. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|\Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item. @@ -27,6 +28,7 @@ * @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item * @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item. * @property string $type A string identifying the type of the source of this line item, either an invoiceitem or a subscription. + * @property null|string $unit_amount_excluding_tax The amount in %s representing the unit amount for this line item, excluding all tax and discounts. */ class InvoiceLineItem extends ApiResource { diff --git a/lib/Order.php b/lib/Order.php index 4e786ea58..d9af3dfc5 100644 --- a/lib/Order.php +++ b/lib/Order.php @@ -68,9 +68,9 @@ public function cancel($params = null, $opts = null) } /** + * @param string $id * @param null|array $params * @param null|array|string $opts - * @param mixed $id * * @throws \Stripe\Exception\ApiErrorException if the request fails * diff --git a/lib/PaymentLink.php b/lib/PaymentLink.php index 742e0e802..5c22b641b 100644 --- a/lib/PaymentLink.php +++ b/lib/PaymentLink.php @@ -64,9 +64,9 @@ class PaymentLink extends ApiResource const SUBMIT_TYPE_PAY = 'pay'; /** + * @param string $id * @param null|array $params * @param null|array|string $opts - * @param mixed $id * * @throws \Stripe\Exception\ApiErrorException if the request fails * diff --git a/lib/PaymentMethod.php b/lib/PaymentMethod.php index a6e91eb6c..70f8fdaea 100644 --- a/lib/PaymentMethod.php +++ b/lib/PaymentMethod.php @@ -46,6 +46,7 @@ * @property \Stripe\StripeObject $oxxo * @property \Stripe\StripeObject $p24 * @property \Stripe\StripeObject $paynow + * @property \Stripe\StripeObject $promptpay * @property \Stripe\StripeObject $radar_options Options to configure Radar. See Radar Session for more information. * @property \Stripe\StripeObject $sepa_debit * @property \Stripe\StripeObject $sofort diff --git a/lib/Quote.php b/lib/Quote.php index ba309fec9..b9e9176b2 100644 --- a/lib/Quote.php +++ b/lib/Quote.php @@ -132,9 +132,9 @@ public function finalizeQuote($params = null, $opts = null) } /** + * @param string $id * @param null|array $params * @param null|array|string $opts - * @param mixed $id * * @throws \Stripe\Exception\ApiErrorException if the request fails * @@ -151,9 +151,9 @@ public static function allComputedUpfrontLineItems($id, $params = null, $opts = } /** + * @param string $id * @param null|array $params * @param null|array|string $opts - * @param mixed $id * * @throws \Stripe\Exception\ApiErrorException if the request fails * diff --git a/lib/SKU.php b/lib/SKU.php index 09d6c85e5..3d7a30604 100644 --- a/lib/SKU.php +++ b/lib/SKU.php @@ -29,7 +29,7 @@ * @property string|\Stripe\Product $product The ID of the product this SKU is associated with. The product must be currently active. * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. */ -class SKU extends ApiResource +class Sku extends ApiResource { const OBJECT_NAME = 'sku'; diff --git a/lib/Service/CreditNoteService.php b/lib/Service/CreditNoteService.php index 5c631328a..a00f010aa 100644 --- a/lib/Service/CreditNoteService.php +++ b/lib/Service/CreditNoteService.php @@ -98,7 +98,7 @@ public function preview($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\CreditNote> + * @return \Stripe\Collection<\Stripe\CreditNoteLineItem> */ public function previewLines($params = null, $opts = null) { diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index de34fdc9c..0b717130e 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -48,7 +48,7 @@ public function allBalanceTransactions($parentId, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\Customer> + * @return \Stripe\Collection<\Stripe\PaymentMethod> */ public function allPaymentMethods($id, $params = null, $opts = null) { diff --git a/lib/Service/FinancialConnections/AccountService.php b/lib/Service/FinancialConnections/AccountService.php index 8292631df..213d17271 100644 --- a/lib/Service/FinancialConnections/AccountService.php +++ b/lib/Service/FinancialConnections/AccountService.php @@ -30,7 +30,7 @@ public function all($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\FinancialConnections\Account> + * @return \Stripe\Collection<\Stripe\FinancialConnections\AccountOwner> */ public function allOwners($id, $params = null, $opts = null) { diff --git a/lib/Service/InvoiceService.php b/lib/Service/InvoiceService.php index 5cb9091d0..24ff6b21f 100644 --- a/lib/Service/InvoiceService.php +++ b/lib/Service/InvoiceService.php @@ -35,7 +35,7 @@ public function all($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\LineItem> + * @return \Stripe\Collection<\Stripe\InvoiceLineItem> */ public function allLines($parentId, $params = null, $opts = null) { @@ -241,7 +241,7 @@ public function upcoming($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\Invoice> + * @return \Stripe\Collection<\Stripe\InvoiceLineItem> */ public function upcomingLines($params = null, $opts = null) { diff --git a/lib/Service/OrderService.php b/lib/Service/OrderService.php index 97c786261..89de15fe8 100644 --- a/lib/Service/OrderService.php +++ b/lib/Service/OrderService.php @@ -33,7 +33,7 @@ public function all($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\Order> + * @return \Stripe\Collection<\Stripe\LineItem> */ public function allLineItems($id, $params = null, $opts = null) { diff --git a/lib/Service/PaymentLinkService.php b/lib/Service/PaymentLinkService.php index 902cee09c..e5008d7a8 100644 --- a/lib/Service/PaymentLinkService.php +++ b/lib/Service/PaymentLinkService.php @@ -33,7 +33,7 @@ public function all($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\PaymentLink> + * @return \Stripe\Collection<\Stripe\LineItem> */ public function allLineItems($id, $params = null, $opts = null) { diff --git a/lib/Service/QuoteService.php b/lib/Service/QuoteService.php index d6d20c0b4..05f0dfb66 100644 --- a/lib/Service/QuoteService.php +++ b/lib/Service/QuoteService.php @@ -49,7 +49,7 @@ public function all($params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\Quote> + * @return \Stripe\Collection<\Stripe\LineItem> */ public function allComputedUpfrontLineItems($id, $params = null, $opts = null) { @@ -67,7 +67,7 @@ public function allComputedUpfrontLineItems($id, $params = null, $opts = null) * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Collection<\Stripe\Quote> + * @return \Stripe\Collection<\Stripe\LineItem> */ public function allLineItems($id, $params = null, $opts = null) { diff --git a/lib/Service/TestHelpers/Issuing/CardService.php b/lib/Service/TestHelpers/Issuing/CardService.php new file mode 100644 index 000000000..01d7080a4 --- /dev/null +++ b/lib/Service/TestHelpers/Issuing/CardService.php @@ -0,0 +1,76 @@ +Card object to + * delivered. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Card + */ + public function deliverCard($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/deliver', $id), $params, $opts); + } + + /** + * Updates the shipping status of the specified Issuing Card object to + * failure. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Card + */ + public function failCard($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/fail', $id), $params, $opts); + } + + /** + * Updates the shipping status of the specified Issuing Card object to + * returned. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Card + */ + public function returnCard($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/return', $id), $params, $opts); + } + + /** + * Updates the shipping status of the specified Issuing Card object to + * shipped. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Card + */ + public function shipCard($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/test_helpers/issuing/cards/%s/shipping/ship', $id), $params, $opts); + } +} diff --git a/lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php b/lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php new file mode 100644 index 000000000..a202ec33f --- /dev/null +++ b/lib/Service/TestHelpers/Issuing/IssuingServiceFactory.php @@ -0,0 +1,25 @@ + + */ + private static $classMap = [ + 'cards' => CardService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/lib/Service/TestHelpers/TestHelpersServiceFactory.php b/lib/Service/TestHelpers/TestHelpersServiceFactory.php index 1861bc4ec..cb0ee1a01 100644 --- a/lib/Service/TestHelpers/TestHelpersServiceFactory.php +++ b/lib/Service/TestHelpers/TestHelpersServiceFactory.php @@ -8,6 +8,7 @@ * Service factory class for API resources in the TestHelpers namespace. * * @property CustomerService $customers + * @property Issuing\IssuingServiceFactory $issuing * @property RefundService $refunds * @property Terminal\TerminalServiceFactory $terminal * @property TestClockService $testClocks @@ -20,6 +21,7 @@ class TestHelpersServiceFactory extends \Stripe\Service\AbstractServiceFactory */ private static $classMap = [ 'customers' => CustomerService::class, + 'issuing' => Issuing\IssuingServiceFactory::class, 'refunds' => RefundService::class, 'terminal' => Terminal\TerminalServiceFactory::class, 'testClocks' => TestClockService::class, diff --git a/lib/Treasury/ReceivedCredit.php b/lib/Treasury/ReceivedCredit.php index f9e17b080..9a72ff074 100644 --- a/lib/Treasury/ReceivedCredit.php +++ b/lib/Treasury/ReceivedCredit.php @@ -18,10 +18,12 @@ * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string $failure_code Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is closed or frozen. * @property null|string $financial_account The FinancialAccount that received the funds. + * @property null|string $hosted_regulatory_receipt_url A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property \Stripe\StripeObject $initiating_payment_method_details * @property \Stripe\StripeObject $linked_flows * @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 $network The rails used to send the funds. + * @property null|\Stripe\StripeObject $reversal_details Details describing when a ReceivedCredit may be reversed. * @property string $status Status of the ReceivedCredit. ReceivedCredits are created either succeeded (approved) or failed (declined). If a ReceivedCredit is declined, the failure reason can be found in the failure_code field. * @property null|string|\Stripe\Treasury\Transaction $transaction The Transaction associated with this object. */ diff --git a/lib/Treasury/ReceivedDebit.php b/lib/Treasury/ReceivedDebit.php index 9303c4b8c..c252df41e 100644 --- a/lib/Treasury/ReceivedDebit.php +++ b/lib/Treasury/ReceivedDebit.php @@ -17,10 +17,12 @@ * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. * @property null|string $failure_code Reason for the failure. A ReceivedDebit might fail because the FinancialAccount doesn't have sufficient funds, is closed, or is frozen. * @property null|string $financial_account The FinancialAccount that funds were pulled from. + * @property null|string $hosted_regulatory_receipt_url A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. * @property \Stripe\StripeObject $initiating_payment_method_details * @property \Stripe\StripeObject $linked_flows * @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 $network The network used for the ReceivedDebit. + * @property null|\Stripe\StripeObject $reversal_details Details describing when a ReceivedDebit might be reversed. * @property string $status Status of the ReceivedDebit. ReceivedDebits are created with a status of either succeeded (approved) or failed (declined). The failure reason can be found under the failure_code. * @property null|string|\Stripe\Treasury\Transaction $transaction The Transaction associated with this object. */ diff --git a/lib/Util/ApiVersion.php b/lib/Util/ApiVersion.php new file mode 100644 index 000000000..178b8d4ba --- /dev/null +++ b/lib/Util/ApiVersion.php @@ -0,0 +1,10 @@ +client = new \Stripe\StripeClient(['api_key' => 'sk_test_123', 'api_base' => MOCK_URL]); } - public function testExpireSession() + public function testListSecret() { - $this->expectsRequest('post', '/v1/checkout/sessions/sess_xyz/expire'); - $result = $this->client->checkout->sessions->expire('sess_xyz', []); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + $this->expectsRequest('get', '/v1/apps/secrets'); + $result = $this->client->apps->secrets->all( + ['scope' => ['type' => 'account'], 'limit' => 2] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result->data[0]); } - public function testCreateShippingRate() + public function testCreateSecret() { - $this->expectsRequest('post', '/v1/shipping_rates'); - $result = $this->client->shippingRates->create( + $this->expectsRequest('post', '/v1/apps/secrets'); + $result = $this->client->apps->secrets->create( [ - 'display_name' => 'Sample Shipper', - 'fixed_amount' => ['currency' => 'usd', 'amount' => 400], - 'type' => 'fixed_amount', + 'name' => 'sec_123', + 'payload' => 'very secret string', + 'scope' => ['type' => 'account'], ] ); - static::assertInstanceOf(\Stripe\ShippingRate::class, $result); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); } - public function testListShippingRate() + public function testDeleteWhereSecret() { - $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]); + $this->expectsRequest('post', '/v1/apps/secrets/delete'); + $result = $this->client->apps->secrets->deleteWhere( + ['name' => 'my-api-key', 'scope' => ['type' => 'account']] + ); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); + } + + public function testFindSecret() + { + $this->expectsRequest('get', '/v1/apps/secrets/find'); + $result = $this->client->apps->secrets->find( + ['name' => 'sec_123', 'scope' => ['type' => 'account']] + ); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); } public function testCreateSession() @@ -72,167 +87,128 @@ public function testCreateSession() static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testCreatePaymentIntent() + public function testExpireSession() { - $this->expectsRequest('post', '/v1/payment_intents'); - $result = $this->client->paymentIntents->create( - [ - 'amount' => 1099, - 'currency' => 'eur', - 'automatic_payment_methods' => ['enabled' => true], - ] - ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + $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 testCreatePaymentLink() + public function testRetrieveCashBalance() { - $this->expectsRequest('post', '/v1/payment_links'); - $result = $this->client->paymentLinks->create( - ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]] + $this->expectsRequest('get', '/v1/customers/cus_123/cash_balance'); + $result = $this->client->customers->retrieveCashBalance('cus_123', []); + static::assertInstanceOf(\Stripe\CashBalance::class, $result); + } + + public function testUpdateCashBalance() + { + $this->expectsRequest('post', '/v1/customers/cus_123/cash_balance'); + $result = $this->client->customers->updateCashBalance( + 'cus_123', + ['settings' => ['reconciliation_mode' => 'manual']] ); - static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + static::assertInstanceOf(\Stripe\CashBalance::class, $result); } - public function testListLineItemsPaymentLink() + public function testCreateFundingInstructionsCustomer() { - $this->expectsRequest('get', '/v1/payment_links/pl_xyz/line_items'); - $result = $this->client->paymentLinks->allLineItems('pl_xyz', []); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); + $this->expectsRequest('post', '/v1/customers/cus_123/funding_instructions'); + $result = $this->client->customers->createFundingInstructions( + 'cus_123', + [ + 'bank_transfer' => [ + 'requested_address_types' => ['zengin'], + 'type' => 'jp_bank_transfer', + ], + 'currency' => 'usd', + 'funding_type' => 'bank_transfer', + ] + ); + static::assertInstanceOf(\Stripe\FundingInstructions::class, $result); } - public function testRetrievePaymentLink() + public function testListAccount() { - $this->expectsRequest('get', '/v1/payment_links/pl_xyz'); - $result = $this->client->paymentLinks->retrieve('pl_xyz', []); - static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + $this->expectsRequest('get', '/v1/financial_connections/accounts'); + $result = $this->client->financialConnections->accounts->all([]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]); } - public function testVerifyMicrodepositsPaymentIntent() + public function testRetrieveAccount() { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits' - ); - $result = $this->client->paymentIntents->verifyMicrodeposits( - 'pi_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/financial_connections/accounts/fca_xyz'); + $result = $this->client->financialConnections->accounts->retrieve( + 'fca_xyz', [] ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testVerifyMicrodepositsSetupIntent() + public function testDisconnectAccount() { $this->expectsRequest( 'post', - '/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits' + '/v1/financial_connections/accounts/fca_xyz/disconnect' ); - $result = $this->client->setupIntents->verifyMicrodeposits( - 'seti_xxxxxxxxxxxxx', + $result = $this->client->financialConnections->accounts->disconnect( + 'fca_xyz', [] ); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testCreateTestClock() + public function testListOwnersAccount() { - $this->expectsRequest('post', '/v1/test_helpers/test_clocks'); - $result = $this->client->testHelpers->testClocks->create( - ['frozen_time' => 123, 'name' => 'cogsworth'] + $this->expectsRequest( + 'get', + '/v1/financial_connections/accounts/fca_xyz/owners' + ); + $result = $this->client->financialConnections->accounts->allOwners( + 'fca_xyz', + ['ownership' => 'fcaowns_xyz'] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); - } - - public function testRetrieveTestClock() - { - $this->expectsRequest('get', '/v1/test_helpers/test_clocks/clock_xyz'); - $result = $this->client->testHelpers->testClocks->retrieve('clock_xyz', []); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); - } - - public function testListTestClock() - { - $this->expectsRequest('get', '/v1/test_helpers/test_clocks'); - $result = $this->client->testHelpers->testClocks->all([]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result->data[0]); - } - - public function testDeleteTestClock() - { - $this->expectsRequest('delete', '/v1/test_helpers/test_clocks/clock_xyz'); - $result = $this->client->testHelpers->testClocks->delete('clock_xyz', []); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]); } - public function testAdvanceTestClock() + public function testRefreshAccount() { $this->expectsRequest( 'post', - '/v1/test_helpers/test_clocks/clock_xyz/advance' + '/v1/financial_connections/accounts/fca_xyz/refresh' ); - $result = $this->client->testHelpers->testClocks->advance( - 'clock_xyz', - ['frozen_time' => 142] + $result = $this->client->financialConnections->accounts->refresh( + 'fca_xyz', + ['features' => ['balance']] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testCreateFundingInstructionsCustomer() + public function testCreateSession2() { - $this->expectsRequest('post', '/v1/customers/cus_123/funding_instructions'); - $result = $this->client->customers->createFundingInstructions( - 'cus_123', + $this->expectsRequest('post', '/v1/financial_connections/sessions'); + $result = $this->client->financialConnections->sessions->create( [ - 'bank_transfer' => [ - 'requested_address_types' => ['zengin'], - 'type' => 'jp_bank_transfer', - ], - 'currency' => 'usd', - 'funding_type' => 'bank_transfer', + 'account_holder' => ['type' => 'customer', 'customer' => 'cus_123'], + 'permissions' => ['balances'], ] ); - static::assertInstanceOf(\Stripe\FundingInstructions::class, $result); - } - - public function testListConfiguration() - { - $this->expectsRequest('get', '/v1/terminal/configurations'); - $result = $this->client->terminal->configurations->all([]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result->data[0]); - } - - public function testRetrieveConfiguration() - { - $this->expectsRequest('get', '/v1/terminal/configurations/uc_123'); - $result = $this->client->terminal->configurations->retrieve('uc_123', []); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } - public function testUpdateConfiguration() + public function testRetrieveSession() { - $this->expectsRequest('post', '/v1/terminal/configurations/uc_123'); - $result = $this->client->terminal->configurations->update( - 'uc_123', - ['tipping' => ['usd' => ['fixed_amounts' => [10]]]] + $this->expectsRequest( + 'get', + '/v1/financial_connections/sessions/fcsess_xyz' ); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); - } - - public function testDeleteConfiguration() - { - $this->expectsRequest('delete', '/v1/terminal/configurations/uc_123'); - $result = $this->client->terminal->configurations->delete('uc_123', []); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); - } - - public function testExpireRefund() - { - $this->expectsRequest('post', '/v1/test_helpers/refunds/re_123/expire'); - $result = $this->client->testHelpers->refunds->expire('re_123', []); - static::assertInstanceOf(\Stripe\Refund::class, $result); + $result = $this->client->financialConnections->sessions->retrieve( + 'fcsess_xyz', + [] + ); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } public function testCreateOrder() @@ -255,12 +231,11 @@ public function testUpdateOrder() static::assertInstanceOf(\Stripe\Order::class, $result); } - public function testListLineItemsOrder() + public function testUpdateOrder2() { - $this->expectsRequest('get', '/v1/orders/order_xyz/line_items'); - $result = $this->client->orders->allLineItems('order_xyz', []); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); + $this->expectsRequest('post', '/v1/orders/order_xyz'); + $result = $this->client->orders->update('order_xyz', []); + static::assertInstanceOf(\Stripe\Order::class, $result); } public function testCancelOrder() @@ -270,6 +245,14 @@ public function testCancelOrder() static::assertInstanceOf(\Stripe\Order::class, $result); } + public function testListLineItemsOrder() + { + $this->expectsRequest('get', '/v1/orders/order_xyz/line_items'); + $result = $this->client->orders->allLineItems('order_xyz', []); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); + } + public function testReopenOrder() { $this->expectsRequest('post', '/v1/orders/order_xyz/reopen'); @@ -287,94 +270,184 @@ public function testSubmitOrder() static::assertInstanceOf(\Stripe\Order::class, $result); } - public function testUpdateOrder2() + public function testCreatePaymentIntent() { - $this->expectsRequest('post', '/v1/orders/order_xyz'); - $result = $this->client->orders->update('order_xyz', []); - static::assertInstanceOf(\Stripe\Order::class, $result); - } - - public function testRetrieveAccount() - { - $this->expectsRequest('get', '/v1/financial_connections/accounts/fca_xyz'); - $result = $this->client->financialConnections->accounts->retrieve( - 'fca_xyz', - [] + $this->expectsRequest('post', '/v1/payment_intents'); + $result = $this->client->paymentIntents->create( + [ + 'amount' => 1099, + 'currency' => 'eur', + 'automatic_payment_methods' => ['enabled' => true], + ] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testRefreshAccount() + public function testVerifyMicrodepositsPaymentIntent() { $this->expectsRequest( 'post', - '/v1/financial_connections/accounts/fca_xyz/refresh' + '/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits' ); - $result = $this->client->financialConnections->accounts->refresh( - 'fca_xyz', - ['features' => ['balance']] + $result = $this->client->paymentIntents->verifyMicrodeposits( + 'pi_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testDisconnectAccount() + public function testCreatePaymentLink() + { + $this->expectsRequest('post', '/v1/payment_links'); + $result = $this->client->paymentLinks->create( + ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]] + ); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + } + + public function testRetrievePaymentLink() + { + $this->expectsRequest('get', '/v1/payment_links/pl_xyz'); + $result = $this->client->paymentLinks->retrieve('pl_xyz', []); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + } + + public function testListLineItemsPaymentLink() + { + $this->expectsRequest('get', '/v1/payment_links/pl_xyz/line_items'); + $result = $this->client->paymentLinks->allLineItems('pl_xyz', []); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); + } + + public function testVerifyMicrodepositsSetupIntent() { $this->expectsRequest( 'post', - '/v1/financial_connections/accounts/fca_xyz/disconnect' + '/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits' ); - $result = $this->client->financialConnections->accounts->disconnect( - 'fca_xyz', + $result = $this->client->setupIntents->verifyMicrodeposits( + 'seti_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testCreateSession2() + public function testListShippingRate() { - $this->expectsRequest('post', '/v1/financial_connections/sessions'); - $result = $this->client->financialConnections->sessions->create( + $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 testCreateShippingRate() + { + $this->expectsRequest('post', '/v1/shipping_rates'); + $result = $this->client->shippingRates->create( [ - 'account_holder' => ['type' => 'customer', 'customer' => 'cus_123'], - 'permissions' => ['balances'], + 'display_name' => 'Sample Shipper', + 'fixed_amount' => ['currency' => 'usd', 'amount' => 400], + 'type' => 'fixed_amount', ] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result); } - public function testRetrieveSession() + public function testListConfiguration() + { + $this->expectsRequest('get', '/v1/terminal/configurations'); + $result = $this->client->terminal->configurations->all([]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result->data[0]); + } + + public function testDeleteConfiguration() + { + $this->expectsRequest('delete', '/v1/terminal/configurations/uc_123'); + $result = $this->client->terminal->configurations->delete('uc_123', []); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); + } + + public function testRetrieveConfiguration() + { + $this->expectsRequest('get', '/v1/terminal/configurations/uc_123'); + $result = $this->client->terminal->configurations->retrieve('uc_123', []); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); + } + + public function testUpdateConfiguration() + { + $this->expectsRequest('post', '/v1/terminal/configurations/uc_123'); + $result = $this->client->terminal->configurations->update( + 'uc_123', + ['tipping' => ['usd' => ['fixed_amounts' => [10]]]] + ); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); + } + + public function testFundCashBalanceCustomer() { $this->expectsRequest( - 'get', - '/v1/financial_connections/sessions/fcsess_xyz' + 'post', + '/v1/test_helpers/customers/cus_123/fund_cash_balance' ); - $result = $this->client->financialConnections->sessions->retrieve( - 'fcsess_xyz', - [] + $result = $this->client->testHelpers->customers->fundCashBalance( + 'cus_123', + ['amount' => 30, 'currency' => 'eur'] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } - public function testListAccount() + public function testExpireRefund() { - $this->expectsRequest('get', '/v1/financial_connections/accounts'); - $result = $this->client->financialConnections->accounts->all([]); + $this->expectsRequest('post', '/v1/test_helpers/refunds/re_123/expire'); + $result = $this->client->testHelpers->refunds->expire('re_123', []); + static::assertInstanceOf(\Stripe\Refund::class, $result); + } + + public function testListTestClock() + { + $this->expectsRequest('get', '/v1/test_helpers/test_clocks'); + $result = $this->client->testHelpers->testClocks->all([]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result->data[0]); } - public function testListOwnersAccount() + public function testCreateTestClock() + { + $this->expectsRequest('post', '/v1/test_helpers/test_clocks'); + $result = $this->client->testHelpers->testClocks->create( + ['frozen_time' => 123, 'name' => 'cogsworth'] + ); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + } + + public function testDeleteTestClock() + { + $this->expectsRequest('delete', '/v1/test_helpers/test_clocks/clock_xyz'); + $result = $this->client->testHelpers->testClocks->delete('clock_xyz', []); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + } + + public function testRetrieveTestClock() + { + $this->expectsRequest('get', '/v1/test_helpers/test_clocks/clock_xyz'); + $result = $this->client->testHelpers->testClocks->retrieve('clock_xyz', []); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + } + + public function testAdvanceTestClock() { $this->expectsRequest( - 'get', - '/v1/financial_connections/accounts/fca_xyz/owners' + 'post', + '/v1/test_helpers/test_clocks/clock_xyz/advance' ); - $result = $this->client->financialConnections->accounts->allOwners( - 'fca_xyz', - ['ownership' => 'fcaowns_xyz'] + $result = $this->client->testHelpers->testClocks->advance( + 'clock_xyz', + ['frozen_time' => 142] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } public function testFailInboundTransfer() @@ -416,26 +489,26 @@ public function testSucceedInboundTransfer() static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testPostOutboundTransfer() + public function testFailOutboundTransfer() { $this->expectsRequest( 'post', - '/v1/test_helpers/treasury/outbound_transfers/obt_123/post' + '/v1/test_helpers/treasury/outbound_transfers/obt_123/fail' ); - $result = $this->client->testHelpers->treasury->outboundTransfers->post( + $result = $this->client->testHelpers->treasury->outboundTransfers->fail( 'obt_123', [] ); static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testFailOutboundTransfer() + public function testPostOutboundTransfer() { $this->expectsRequest( 'post', - '/v1/test_helpers/treasury/outbound_transfers/obt_123/fail' + '/v1/test_helpers/treasury/outbound_transfers/obt_123/post' ); - $result = $this->client->testHelpers->treasury->outboundTransfers->fail( + $result = $this->client->testHelpers->treasury->outboundTransfers->post( 'obt_123', [] ); @@ -483,2574 +556,2605 @@ public function testCreateReceivedDebit() static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result); } - public function testCreateSecret() + public function testCreateToken() { - $this->expectsRequest('post', '/v1/apps/secrets'); - $result = $this->client->apps->secrets->create( + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create( [ - 'name' => 'sec_123', - 'payload' => 'very secret string', - 'scope' => ['type' => 'account'], + 'card' => [ + 'number' => '4242424242424242', + 'exp_month' => '5', + 'exp_year' => '2023', + 'cvc' => '314', + ], ] ); - static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testFindSecret() + public function testCreateAccountLink() { - $this->expectsRequest('get', '/v1/apps/secrets/find'); - $result = $this->client->apps->secrets->find( - ['name' => 'sec_123', 'scope' => ['type' => 'account']] + $this->expectsRequest('post', '/v1/account_links'); + $result = $this->client->accountLinks->create( + [ + 'account' => 'acct_xxxxxxxxxxxxx', + 'refresh_url' => 'https://example.com/reauth', + 'return_url' => 'https://example.com/return', + 'type' => 'account_onboarding', + ] ); - static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); + static::assertInstanceOf(\Stripe\AccountLink::class, $result); } - public function testDeleteWhereSecret() + public function testListAccount2() { - $this->expectsRequest('post', '/v1/apps/secrets/delete'); - $result = $this->client->apps->secrets->deleteWhere( - ['name' => 'sec_123', 'scope' => ['type' => 'account']] - ); - static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); + $this->expectsRequest('get', '/v1/accounts'); + $result = $this->client->accounts->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Account::class, $result->data[0]); } - public function testRetrieveCashBalance() + public function testCreateAccount() { - $this->expectsRequest('get', '/v1/customers/cus_123/cash_balance'); - $result = $this->client->customers->retrieveCashBalance('cus_123', []); - static::assertInstanceOf(\Stripe\CashBalance::class, $result); + $this->expectsRequest('post', '/v1/accounts'); + $result = $this->client->accounts->create( + [ + 'type' => 'custom', + 'country' => 'US', + 'email' => 'jenny.rosen@example.com', + 'capabilities' => [ + 'card_payments' => ['requested' => true], + 'transfers' => ['requested' => true], + ], + ] + ); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testUpdateCashBalance() + public function testDeleteAccount() { - $this->expectsRequest('post', '/v1/customers/cus_123/cash_balance'); - $result = $this->client->customers->updateCashBalance( - 'cus_123', - ['settings' => ['reconciliation_mode' => 'manual']] - ); - static::assertInstanceOf(\Stripe\CashBalance::class, $result); + $this->expectsRequest('delete', '/v1/accounts/acct_xxxxxxxxxxxxx'); + $result = $this->client->accounts->delete('acct_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testFundCashBalanceCustomer() + public function testRetrieveAccount2() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/customers/cus_123/fund_cash_balance' - ); - $result = $this->client->testHelpers->customers->fundCashBalance( - 'cus_123', - ['amount' => 30, 'currency' => 'eur'] - ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); + $this->expectsRequest('get', '/v1/accounts/acct_xxxxxxxxxxxxx'); + $result = $this->client->accounts->retrieve('acct_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testListCustomer() + public function testUpdateAccount() { - $this->expectsRequest('get', '/v1/customers'); - $result = $this->client->customers->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); + $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx'); + $result = $this->client->accounts->update( + 'acct_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testSearchCustomer() + public function testRejectAccount() { - $this->expectsRequest('get', '/v1/customers/search'); - $result = $this->client->customers->search( - ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\''] + $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/reject'); + $result = $this->client->accounts->reject( + 'acct_xxxxxxxxxxxxx', + ['reason' => 'fraud'] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]}} + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testCreateCharge() + public function testListCapability() { - $this->expectsRequest('post', '/v1/charges'); - $result = $this->client->charges->create( - [ - 'amount' => 2000, - 'currency' => 'usd', - 'source' => 'tok_xxxx', - 'description' => 'My First Test Charge (created for API docs)', - ] + $this->expectsRequest( + 'get', + '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities' ); - static::assertInstanceOf(\Stripe\Charge::class, $result); + $result = $this->client->accounts->allCapabilities( + 'acct_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Capability::class, $result->data[0]); } - public function testRetrieveCharge() + public function testRetrieveCapability() { - $this->expectsRequest('get', '/v1/charges/ch_xxxxxxxxxxxxx'); - $result = $this->client->charges->retrieve('ch_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Charge::class, $result); + $this->expectsRequest( + 'get', + '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments' + ); + $result = $this->client->accounts->retrieveCapability( + 'acct_xxxxxxxxxxxxx', + 'card_payments', + [] + ); + static::assertInstanceOf(\Stripe\Capability::class, $result); } - public function testUpdateCharge() + public function testUpdateCapability() { - $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx'); - $result = $this->client->charges->update( - 'ch_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'post', + '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments' ); - static::assertInstanceOf(\Stripe\Charge::class, $result); + $result = $this->client->accounts->updateCapability( + 'acct_xxxxxxxxxxxxx', + 'card_payments', + ['requested' => true] + ); + static::assertInstanceOf(\Stripe\Capability::class, $result); } - public function testCaptureCharge() + public function testCreateLoginLink() { - $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx/capture'); - $result = $this->client->charges->capture('ch_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Charge::class, $result); + $this->expectsRequest( + 'post', + '/v1/accounts/acct_xxxxxxxxxxxxx/login_links' + ); + $result = $this->client->accounts->createLoginLink( + 'acct_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\LoginLink::class, $result); } - public function testListCharge() + public function testListPerson() { - $this->expectsRequest('get', '/v1/charges'); - $result = $this->client->charges->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/accounts/acct_xxxxxxxxxxxxx/persons'); + $result = $this->client->accounts->allPersons( + 'acct_xxxxxxxxxxxxx', + ['limit' => 3] + ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Person::class, $result->data[0]); } - public function testSearchCharge() + public function testCreatePerson() { - $this->expectsRequest('get', '/v1/charges/search'); - $result = $this->client->charges->search( - ['query' => 'amount>999 AND metadata[\'order_id\']:\'6735\''] + $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/persons'); + $result = $this->client->accounts->createPerson( + 'acct_xxxxxxxxxxxxx', + ['first_name' => 'Jane', 'last_name' => 'Diaz'] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Charge","namespaces":[]}} + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testCreateCustomer() + public function testDeletePerson() { - $this->expectsRequest('post', '/v1/customers'); - $result = $this->client->customers->create( - ['description' => 'My First Test Customer (created for API docs)'] + $this->expectsRequest( + 'delete', + '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Customer::class, $result); + $result = $this->client->accounts->deletePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testRetrieveCustomer() + public function testRetrievePerson() { - $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx'); - $result = $this->client->customers->retrieve('cus_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Customer::class, $result); + $this->expectsRequest( + 'get', + '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' + ); + $result = $this->client->accounts->retrievePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testUpdateCustomer() + public function testUpdatePerson() { - $this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx'); - $result = $this->client->customers->update( - 'cus_xxxxxxxxxxxxx', + $this->expectsRequest( + 'post', + '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' + ); + $result = $this->client->accounts->updatePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Customer::class, $result); + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testDeleteCustomer() + public function testListApplicationFee() { - $this->expectsRequest('delete', '/v1/customers/cus_xxxxxxxxxxxxx'); - $result = $this->client->customers->delete('cus_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Customer::class, $result); + $this->expectsRequest('get', '/v1/application_fees'); + $result = $this->client->applicationFees->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\ApplicationFee::class, $result->data[0]); } - public function testListCustomer2() + public function testRetrieveApplicationFee() { - $this->expectsRequest('get', '/v1/customers'); - $result = $this->client->customers->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); + $this->expectsRequest('get', '/v1/application_fees/fee_xxxxxxxxxxxxx'); + $result = $this->client->applicationFees->retrieve('fee_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\ApplicationFee::class, $result); } - public function testSearchCustomer2() + public function testListApplicationFeeRefund() { - $this->expectsRequest('get', '/v1/customers/search'); - $result = $this->client->customers->search( - ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\''] + $this->expectsRequest( + 'get', + '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds' ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]}} + $result = $this->client->applicationFees->allRefunds( + 'fee_xxxxxxxxxxxxx', + ['limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result->data[0]); } - public function testRetrieveDispute() + public function testCreateApplicationFeeRefund() { - $this->expectsRequest('get', '/v1/disputes/dp_xxxxxxxxxxxxx'); - $result = $this->client->disputes->retrieve('dp_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Dispute::class, $result); + $this->expectsRequest( + 'post', + '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds' + ); + $result = $this->client->applicationFees->createRefund( + 'fee_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); } - public function testUpdateDispute() + public function testRetrieveApplicationFeeRefund() { - $this->expectsRequest('post', '/v1/disputes/dp_xxxxxxxxxxxxx'); - $result = $this->client->disputes->update( - 'dp_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'get', + '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Dispute::class, $result); + $result = $this->client->applicationFees->retrieveRefund( + 'fee_xxxxxxxxxxxxx', + 'fr_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); } - public function testCloseDispute() + public function testUpdateApplicationFeeRefund() { - $this->expectsRequest('post', '/v1/disputes/dp_xxxxxxxxxxxxx/close'); - $result = $this->client->disputes->close('dp_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Dispute::class, $result); + $this->expectsRequest( + 'post', + '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx' + ); + $result = $this->client->applicationFees->updateRefund( + 'fee_xxxxxxxxxxxxx', + 'fr_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); } - public function testListDispute() + public function testCreateSecret2() { - $this->expectsRequest('get', '/v1/disputes'); - $result = $this->client->disputes->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Dispute::class, $result->data[0]); - } - - public function testRetrieveEvent() - { - $this->expectsRequest('get', '/v1/events/evt_xxxxxxxxxxxxx'); - $result = $this->client->events->retrieve('evt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Event::class, $result); + $this->expectsRequest('post', '/v1/apps/secrets'); + $result = $this->client->apps->secrets->create( + [ + 'name' => 'my-api-key', + 'payload' => 'secret_key_xxxxxx', + 'scope' => ['type' => 'account'], + ] + ); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); } - public function testListEvent() + public function testListBalanceTransaction() { - $this->expectsRequest('get', '/v1/events'); - $result = $this->client->events->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/balance_transactions'); + $result = $this->client->balanceTransactions->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Event::class, $result->data[0]); + static::assertInstanceOf(\Stripe\BalanceTransaction::class, $result->data[0]); } - public function testRetrieveFile() + public function testRetrieveBalanceTransaction() { - $this->expectsRequest('get', '/v1/files/file_xxxxxxxxxxxxx'); - $result = $this->client->files->retrieve('file_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\File::class, $result); + $this->expectsRequest('get', '/v1/balance_transactions/txn_xxxxxxxxxxxxx'); + $result = $this->client->balanceTransactions->retrieve( + 'txn_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\BalanceTransaction::class, $result); } - public function testListFile() + public function testListConfiguration2() { - $this->expectsRequest('get', '/v1/files'); - $result = $this->client->files->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/billing_portal/configurations'); + $result = $this->client->billingPortal->configurations->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\File::class, $result->data[0]); + static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result->data[0]); } - public function testCreateFileLink() + public function testRetrieveConfiguration2() { - $this->expectsRequest('post', '/v1/file_links'); - $result = $this->client->fileLinks->create( - ['file' => 'file_xxxxxxxxxxxxx'] + $this->expectsRequest( + 'get', + '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\FileLink::class, $result); + $result = $this->client->billingPortal->configurations->retrieve( + 'bpc_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); } - public function testRetrieveFileLink() + public function testUpdateConfiguration2() { - $this->expectsRequest('get', '/v1/file_links/link_xxxxxxxxxxxxx'); - $result = $this->client->fileLinks->retrieve('link_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\FileLink::class, $result); + $this->expectsRequest( + 'post', + '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' + ); + $result = $this->client->billingPortal->configurations->update( + 'bpc_xxxxxxxxxxxxx', + [ + 'business_profile' => [ + 'privacy_policy_url' => 'https://example.com/privacy', + 'terms_of_service_url' => 'https://example.com/terms', + ], + ] + ); + static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); } - public function testUpdateFileLink() + public function testCreateSession3() { - $this->expectsRequest('post', '/v1/file_links/link_xxxxxxxxxxxxx'); - $result = $this->client->fileLinks->update( - 'link_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest('post', '/v1/billing_portal/sessions'); + $result = $this->client->billingPortal->sessions->create( + [ + 'customer' => 'cus_xxxxxxxxxxxxx', + 'return_url' => 'https://example.com/account', + ] ); - static::assertInstanceOf(\Stripe\FileLink::class, $result); + static::assertInstanceOf(\Stripe\BillingPortal\Session::class, $result); } - public function testListFileLink() + public function testListCharge() { - $this->expectsRequest('get', '/v1/file_links'); - $result = $this->client->fileLinks->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/charges'); + $result = $this->client->charges->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FileLink::class, $result->data[0]); - } - - public function testRetrieveMandate() - { - $this->expectsRequest('get', '/v1/mandates/mandate_xxxxxxxxxxxxx'); - $result = $this->client->mandates->retrieve('mandate_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Mandate::class, $result); + static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]); } - public function testCreatePaymentIntent2() + public function testCreateCharge() { - $this->expectsRequest('post', '/v1/payment_intents'); - $result = $this->client->paymentIntents->create( + $this->expectsRequest('post', '/v1/charges'); + $result = $this->client->charges->create( [ 'amount' => 2000, 'currency' => 'usd', - 'payment_method_types' => ['card'], + 'source' => 'tok_xxxx', + 'description' => 'My First Test Charge (created for API docs)', ] ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + static::assertInstanceOf(\Stripe\Charge::class, $result); } - public function testRetrievePaymentIntent() + public function testRetrieveCharge() { - $this->expectsRequest('get', '/v1/payment_intents/pi_xxxxxxxxxxxxx'); - $result = $this->client->paymentIntents->retrieve('pi_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + $this->expectsRequest('get', '/v1/charges/ch_xxxxxxxxxxxxx'); + $result = $this->client->charges->retrieve('ch_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Charge::class, $result); } - public function testUpdatePaymentIntent() + public function testUpdateCharge() { - $this->expectsRequest('post', '/v1/payment_intents/pi_xxxxxxxxxxxxx'); - $result = $this->client->paymentIntents->update( - 'pi_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx'); + $result = $this->client->charges->update( + 'ch_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); - } - - public function testConfirmPaymentIntent() - { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm' - ); - $result = $this->client->paymentIntents->confirm( - 'pi_xxxxxxxxxxxxx', - ['payment_method' => 'pm_card_visa'] - ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + static::assertInstanceOf(\Stripe\Charge::class, $result); } - public function testCapturePaymentIntent() + public function testCaptureCharge() { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/capture' - ); - $result = $this->client->paymentIntents->capture('pi_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx/capture'); + $result = $this->client->charges->capture('ch_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Charge::class, $result); } - public function testCancelPaymentIntent() + public function testSearchCharge() { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel' + $this->expectsRequest('get', '/v1/charges/search'); + $result = $this->client->charges->search( + ['query' => 'amount>999 AND metadata[\'order_id\']:\'6735\''] ); - $result = $this->client->paymentIntents->cancel('pi_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Charge","namespaces":[]}} } - public function testListPaymentIntent() + public function testListSession() { - $this->expectsRequest('get', '/v1/payment_intents'); - $result = $this->client->paymentIntents->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/checkout/sessions'); + $result = $this->client->checkout->sessions->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result->data[0]); } - public function testIncrementAuthorizationPaymentIntent() + public function testCreateSession4() { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization' - ); - $result = $this->client->paymentIntents->incrementAuthorization( - 'pi_xxxxxxxxxxxxx', - ['amount' => 2099] + $this->expectsRequest('post', '/v1/checkout/sessions'); + $result = $this->client->checkout->sessions->create( + [ + 'success_url' => 'https://example.com/success', + 'cancel_url' => 'https://example.com/cancel', + 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]], + 'mode' => 'payment', + ] ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testSearchPaymentIntent() + public function testRetrieveSession2() { - $this->expectsRequest('get', '/v1/payment_intents/search'); - $result = $this->client->paymentIntents->search( - ['query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\''] + $this->expectsRequest('get', '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx'); + $result = $this->client->checkout->sessions->retrieve( + 'cs_test_xxxxxxxxxxxxx', + [] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"PaymentIntent","namespaces":[]}} + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testApplyCustomerBalancePaymentIntent() + public function testExpireSession2() { $this->expectsRequest( 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance' + '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire' ); - $result = $this->client->paymentIntents->applyCustomerBalance( - 'pi_xxxxxxxxxxxxx', + $result = $this->client->checkout->sessions->expire( + 'cs_test_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testCreateSetupIntent() + public function testListCountrySpec() { - $this->expectsRequest('post', '/v1/setup_intents'); - $result = $this->client->setupIntents->create( - ['payment_method_types' => ['card']] - ); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result); + $this->expectsRequest('get', '/v1/country_specs'); + $result = $this->client->countrySpecs->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\CountrySpec::class, $result->data[0]); } - public function testRetrieveSetupIntent() + public function testRetrieveCountrySpec() { - $this->expectsRequest('get', '/v1/setup_intents/seti_xxxxxxxxxxxxx'); - $result = $this->client->setupIntents->retrieve('seti_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result); + $this->expectsRequest('get', '/v1/country_specs/US'); + $result = $this->client->countrySpecs->retrieve('US', []); + static::assertInstanceOf(\Stripe\CountrySpec::class, $result); } - public function testUpdateSetupIntent() + public function testListCoupon() { - $this->expectsRequest('post', '/v1/setup_intents/seti_xxxxxxxxxxxxx'); - $result = $this->client->setupIntents->update( - 'seti_xxxxxxxxxxxxx', - ['metadata' => ['user_id' => '3435453']] - ); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result); + $this->expectsRequest('get', '/v1/coupons'); + $result = $this->client->coupons->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Coupon::class, $result->data[0]); } - public function testConfirmSetupIntent() + public function testCreateCoupon() { - $this->expectsRequest( - 'post', - '/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm' - ); - $result = $this->client->setupIntents->confirm( - 'seti_xxxxxxxxxxxxx', - ['payment_method' => 'pm_card_visa'] + $this->expectsRequest('post', '/v1/coupons'); + $result = $this->client->coupons->create( + [ + 'percent_off' => 25.5, + 'duration' => 'repeating', + 'duration_in_months' => 3, + ] ); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result); + static::assertInstanceOf(\Stripe\Coupon::class, $result); } - public function testCancelSetupIntent() + public function testDeleteCoupon() { - $this->expectsRequest( - 'post', - '/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel' + $this->expectsRequest('delete', '/v1/coupons/Z4OV52SU'); + $result = $this->client->coupons->delete('Z4OV52SU', []); + static::assertInstanceOf(\Stripe\Coupon::class, $result); + } + + public function testRetrieveCoupon() + { + $this->expectsRequest('get', '/v1/coupons/Z4OV52SU'); + $result = $this->client->coupons->retrieve('Z4OV52SU', []); + static::assertInstanceOf(\Stripe\Coupon::class, $result); + } + + public function testUpdateCoupon() + { + $this->expectsRequest('post', '/v1/coupons/Z4OV52SU'); + $result = $this->client->coupons->update( + 'Z4OV52SU', + ['metadata' => ['order_id' => '6735']] ); - $result = $this->client->setupIntents->cancel('seti_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result); + static::assertInstanceOf(\Stripe\Coupon::class, $result); } - public function testListSetupIntent() + public function testListCreditNote() { - $this->expectsRequest('get', '/v1/setup_intents'); - $result = $this->client->setupIntents->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/credit_notes'); + $result = $this->client->creditNotes->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result->data[0]); + static::assertInstanceOf(\Stripe\CreditNote::class, $result->data[0]); } - public function testListSetupAttempt() + public function testCreateCreditNote() { - $this->expectsRequest('get', '/v1/setup_attempts'); - $result = $this->client->setupAttempts->all( - ['limit' => 3, 'setup_intent' => 'si_xyz'] + $this->expectsRequest('post', '/v1/credit_notes'); + $result = $this->client->creditNotes->create( + [ + 'invoice' => 'in_xxxxxxxxxxxxx', + 'lines' => [ + [ + 'type' => 'invoice_line_item', + 'invoice_line_item' => 'il_xxxxxxxxxxxxx', + 'quantity' => 1, + ], + ], + ] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SetupAttempt::class, $result->data[0]); + static::assertInstanceOf(\Stripe\CreditNote::class, $result); } - public function testCreatePayout() + public function testVoidCreditNoteCreditNote() { - $this->expectsRequest('post', '/v1/payouts'); - $result = $this->client->payouts->create( - ['amount' => 1100, 'currency' => 'usd'] + $this->expectsRequest('post', '/v1/credit_notes/cn_xxxxxxxxxxxxx/void'); + $result = $this->client->creditNotes->voidCreditNote( + 'cn_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Payout::class, $result); + static::assertInstanceOf(\Stripe\CreditNote::class, $result); } - public function testRetrievePayout() + public function testListCreditNoteLineItem() { - $this->expectsRequest('get', '/v1/payouts/po_xxxxxxxxxxxxx'); - $result = $this->client->payouts->retrieve('po_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Payout::class, $result); + $this->expectsRequest('get', '/v1/credit_notes/cn_xxxxxxxxxxxxx/lines'); + $result = $this->client->creditNotes->allLines( + 'cn_xxxxxxxxxxxxx', + ['limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\CreditNoteLineItem::class, $result->data[0]); } - public function testUpdatePayout() + public function testPreviewCreditNote() { - $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx'); - $result = $this->client->payouts->update( - 'po_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest('get', '/v1/credit_notes/preview'); + $result = $this->client->creditNotes->preview( + [ + 'invoice' => 'in_xxxxxxxxxxxxx', + 'lines' => [ + [ + 'type' => 'invoice_line_item', + 'invoice_line_item' => 'il_xxxxxxxxxxxxx', + 'quantity' => 1, + ], + ], + ] ); - static::assertInstanceOf(\Stripe\Payout::class, $result); + static::assertInstanceOf(\Stripe\CreditNote::class, $result); } - public function testListPayout() + public function testListCustomer() { - $this->expectsRequest('get', '/v1/payouts'); - $result = $this->client->payouts->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/customers'); + $result = $this->client->customers->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Payout::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); } - public function testCancelPayout() + public function testListCustomer2() { - $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/cancel'); - $result = $this->client->payouts->cancel('po_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Payout::class, $result); + $this->expectsRequest('get', '/v1/customers'); + $result = $this->client->customers->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); } - public function testReversePayout() + public function testCreateCustomer() { - $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/reverse'); - $result = $this->client->payouts->reverse('po_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Payout::class, $result); + $this->expectsRequest('post', '/v1/customers'); + $result = $this->client->customers->create( + ['description' => 'My First Test Customer (created for API docs)'] + ); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testCreateRefund() + public function testDeleteCustomer() { - $this->expectsRequest('post', '/v1/refunds'); - $result = $this->client->refunds->create(['charge' => 'ch_xxxxxxxxxxxxx']); - static::assertInstanceOf(\Stripe\Refund::class, $result); + $this->expectsRequest('delete', '/v1/customers/cus_xxxxxxxxxxxxx'); + $result = $this->client->customers->delete('cus_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testRetrieveRefund() + public function testRetrieveCustomer() { - $this->expectsRequest('get', '/v1/refunds/re_xxxxxxxxxxxxx'); - $result = $this->client->refunds->retrieve('re_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Refund::class, $result); + $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx'); + $result = $this->client->customers->retrieve('cus_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testUpdateRefund() + public function testUpdateCustomer() { - $this->expectsRequest('post', '/v1/refunds/re_xxxxxxxxxxxxx'); - $result = $this->client->refunds->update( - 're_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx'); + $result = $this->client->customers->update( + 'cus_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Refund::class, $result); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testCancelRefund() + public function testListCustomerBalanceTransaction() { - $this->expectsRequest('post', '/v1/refunds/re_xxxxxxxxxxxxx/cancel'); - $result = $this->client->refunds->cancel('re_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Refund::class, $result); + $this->expectsRequest( + 'get', + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' + ); + $result = $this->client->customers->allBalanceTransactions( + 'cus_xxxxxxxxxxxxx', + ['limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result->data[0]); } - public function testListRefund() + public function testCreateCustomerBalanceTransaction() { - $this->expectsRequest('get', '/v1/refunds'); - $result = $this->client->refunds->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Refund::class, $result->data[0]); + $this->expectsRequest( + 'post', + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' + ); + $result = $this->client->customers->createBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + ['amount' => -500, 'currency' => 'usd'] + ); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } - public function testCreateToken() + public function testRetrieveCustomerBalanceTransaction() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create( - [ - 'card' => [ - 'number' => '4242424242424242', - 'exp_month' => '5', - 'exp_year' => '2023', - 'cvc' => '314', - ], - ] + $this->expectsRequest( + 'get', + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Token::class, $result); + $result = $this->client->customers->retrieveBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + 'cbtxn_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } - public function testCreateToken2() + public function testUpdateCustomerBalanceTransaction() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create( - [ - 'bank_account' => [ - 'country' => 'US', - 'currency' => 'usd', - 'account_holder_name' => 'Jenny Rosen', - 'account_holder_type' => 'individual', - 'routing_number' => '110000000', - 'account_number' => '000123456789', - ], - ] + $this->expectsRequest( + 'post', + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Token::class, $result); + $result = $this->client->customers->updateBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + 'cbtxn_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } - public function testCreateToken3() + public function testListTaxId() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create( - ['pii' => ['id_number' => '000000000']] + $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids'); + $result = $this->client->customers->allTaxIds( + 'cus_xxxxxxxxxxxxx', + ['limit' => 3] ); - static::assertInstanceOf(\Stripe\Token::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\TaxId::class, $result->data[0]); } - public function testCreateToken4() + public function testCreateTaxId() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create( - [ - 'account' => [ - 'individual' => ['first_name' => 'Jane', 'last_name' => 'Doe'], - 'tos_shown_and_accepted' => true, - ], - ] + $this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids'); + $result = $this->client->customers->createTaxId( + 'cus_xxxxxxxxxxxxx', + ['type' => 'eu_vat', 'value' => 'DE123456789'] ); - static::assertInstanceOf(\Stripe\Token::class, $result); + static::assertInstanceOf(\Stripe\TaxId::class, $result); } - public function testCreateToken5() + public function testDeleteTaxId() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create( - [ - 'person' => [ - 'first_name' => 'Jane', - 'last_name' => 'Doe', - 'relationship' => ['owner' => true], - ], - ] + $this->expectsRequest( + 'delete', + '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Token::class, $result); + $result = $this->client->customers->deleteTaxId( + 'cus_xxxxxxxxxxxxx', + 'txi_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\TaxId::class, $result); } - public function testCreateToken6() + public function testRetrieveTaxId() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create(['cvc_update' => ['cvc' => '123']]); - static::assertInstanceOf(\Stripe\Token::class, $result); + $this->expectsRequest( + 'get', + '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx' + ); + $result = $this->client->customers->retrieveTaxId( + 'cus_xxxxxxxxxxxxx', + 'txi_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\TaxId::class, $result); } - public function testRetrieveToken() + public function testSearchCustomer() { - $this->expectsRequest('get', '/v1/tokens/tok_xxxx'); - $result = $this->client->tokens->retrieve('tok_xxxx', []); - static::assertInstanceOf(\Stripe\Token::class, $result); + $this->expectsRequest('get', '/v1/customers/search'); + $result = $this->client->customers->search( + ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\''] + ); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]}} } - public function testCreatePaymentMethod() + public function testSearchCustomer2() { - $this->expectsRequest('post', '/v1/payment_methods'); - $result = $this->client->paymentMethods->create( - [ - 'type' => 'card', - 'card' => [ - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => 2023, - 'cvc' => '314', - ], - ] + $this->expectsRequest('get', '/v1/customers/search'); + $result = $this->client->customers->search( + ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\''] ); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]}} } - public function testRetrievePaymentMethod() + public function testListDispute() { - $this->expectsRequest('get', '/v1/payment_methods/pm_xxxxxxxxxxxxx'); - $result = $this->client->paymentMethods->retrieve('pm_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + $this->expectsRequest('get', '/v1/disputes'); + $result = $this->client->disputes->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Dispute::class, $result->data[0]); } - public function testUpdatePaymentMethod() + public function testRetrieveDispute() { - $this->expectsRequest('post', '/v1/payment_methods/pm_xxxxxxxxxxxxx'); - $result = $this->client->paymentMethods->update( - 'pm_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + $this->expectsRequest('get', '/v1/disputes/dp_xxxxxxxxxxxxx'); + $result = $this->client->disputes->retrieve('dp_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Dispute::class, $result); } - public function testListPaymentMethod() + public function testUpdateDispute() { - $this->expectsRequest('get', '/v1/payment_methods'); - $result = $this->client->paymentMethods->all( - ['customer' => 'cus_xxxxxxxxxxxxx', 'type' => 'card'] + $this->expectsRequest('post', '/v1/disputes/dp_xxxxxxxxxxxxx'); + $result = $this->client->disputes->update( + 'dp_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Dispute::class, $result); } - public function testAttachPaymentMethod() + public function testCloseDispute() { - $this->expectsRequest( - 'post', - '/v1/payment_methods/pm_xxxxxxxxxxxxx/attach' - ); - $result = $this->client->paymentMethods->attach( - 'pm_xxxxxxxxxxxxx', - ['customer' => 'cus_xxxxxxxxxxxxx'] - ); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + $this->expectsRequest('post', '/v1/disputes/dp_xxxxxxxxxxxxx/close'); + $result = $this->client->disputes->close('dp_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Dispute::class, $result); } - public function testDetachPaymentMethod() + public function testListEvent() { - $this->expectsRequest( - 'post', - '/v1/payment_methods/pm_xxxxxxxxxxxxx/detach' - ); - $result = $this->client->paymentMethods->detach('pm_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + $this->expectsRequest('get', '/v1/events'); + $result = $this->client->events->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Event::class, $result->data[0]); } - public function testRetrieveSource() + public function testRetrieveEvent() { - $this->expectsRequest('get', '/v1/sources/src_xxxxxxxxxxxxx'); - $result = $this->client->sources->retrieve('src_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Source::class, $result); + $this->expectsRequest('get', '/v1/events/evt_xxxxxxxxxxxxx'); + $result = $this->client->events->retrieve('evt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Event::class, $result); } - public function testUpdateSource() + public function testListFileLink() { - $this->expectsRequest('post', '/v1/sources/src_xxxxxxxxxxxxx'); - $result = $this->client->sources->update( - 'src_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Source::class, $result); + $this->expectsRequest('get', '/v1/file_links'); + $result = $this->client->fileLinks->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\FileLink::class, $result->data[0]); } - public function testCreateProduct() + public function testCreateFileLink() { - $this->expectsRequest('post', '/v1/products'); - $result = $this->client->products->create(['name' => 'Gold Special']); - static::assertInstanceOf(\Stripe\Product::class, $result); + $this->expectsRequest('post', '/v1/file_links'); + $result = $this->client->fileLinks->create( + ['file' => 'file_xxxxxxxxxxxxx'] + ); + static::assertInstanceOf(\Stripe\FileLink::class, $result); } - public function testRetrieveProduct() + public function testRetrieveFileLink() { - $this->expectsRequest('get', '/v1/products/prod_xxxxxxxxxxxxx'); - $result = $this->client->products->retrieve('prod_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Product::class, $result); + $this->expectsRequest('get', '/v1/file_links/link_xxxxxxxxxxxxx'); + $result = $this->client->fileLinks->retrieve('link_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\FileLink::class, $result); } - public function testUpdateProduct() + public function testUpdateFileLink() { - $this->expectsRequest('post', '/v1/products/prod_xxxxxxxxxxxxx'); - $result = $this->client->products->update( - 'prod_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/file_links/link_xxxxxxxxxxxxx'); + $result = $this->client->fileLinks->update( + 'link_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Product::class, $result); + static::assertInstanceOf(\Stripe\FileLink::class, $result); } - public function testListProduct() + public function testListFile() { - $this->expectsRequest('get', '/v1/products'); - $result = $this->client->products->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/files'); + $result = $this->client->files->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Product::class, $result->data[0]); + static::assertInstanceOf(\Stripe\File::class, $result->data[0]); } - public function testDeleteProduct() + public function testRetrieveFile() { - $this->expectsRequest('delete', '/v1/products/prod_xxxxxxxxxxxxx'); - $result = $this->client->products->delete('prod_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Product::class, $result); + $this->expectsRequest('get', '/v1/files/file_xxxxxxxxxxxxx'); + $result = $this->client->files->retrieve('file_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\File::class, $result); } - public function testSearchProduct() + public function testListAccount3() { - $this->expectsRequest('get', '/v1/products/search'); - $result = $this->client->products->search( - ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\''] + $this->expectsRequest('get', '/v1/financial_connections/accounts'); + $result = $this->client->financialConnections->accounts->all( + ['account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx']] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Product","namespaces":[]}} + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]); } - public function testCreatePrice() + public function testRetrieveAccount3() { - $this->expectsRequest('post', '/v1/prices'); - $result = $this->client->prices->create( - [ - 'unit_amount' => 2000, - 'currency' => 'usd', - 'recurring' => ['interval' => 'month'], - 'product' => 'prod_xxxxxxxxxxxxx', - ] + $this->expectsRequest( + 'get', + '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Price::class, $result); - } - - public function testRetrievePrice() - { - $this->expectsRequest('get', '/v1/prices/price_xxxxxxxxxxxxx'); - $result = $this->client->prices->retrieve('price_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Price::class, $result); + $result = $this->client->financialConnections->accounts->retrieve( + 'fca_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testUpdatePrice() + public function testListOwnersAccount2() { - $this->expectsRequest('post', '/v1/prices/price_xxxxxxxxxxxxx'); - $result = $this->client->prices->update( - 'price_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'get', + '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/owners' ); - static::assertInstanceOf(\Stripe\Price::class, $result); + $result = $this->client->financialConnections->accounts->allOwners( + 'fca_xxxxxxxxxxxxx', + ['limit' => 3, 'ownership' => 'fcaowns_xxxxxxxxxxxxx'] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]); } - public function testListPrice() + public function testCreateSession5() { - $this->expectsRequest('get', '/v1/prices'); - $result = $this->client->prices->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Price::class, $result->data[0]); + $this->expectsRequest('post', '/v1/financial_connections/sessions'); + $result = $this->client->financialConnections->sessions->create( + [ + 'account_holder' => [ + 'type' => 'customer', + 'customer' => 'cus_xxxxxxxxxxxxx', + ], + 'permissions' => ['payment_method', 'balances'], + 'filters' => ['countries' => ['US']], + ] + ); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } - public function testSearchPrice() + public function testRetrieveSession3() { - $this->expectsRequest('get', '/v1/prices/search'); - $result = $this->client->prices->search( - ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\''] + $this->expectsRequest( + 'get', + '/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx' ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Price","namespaces":[]}} - } - - public function testCreateCoupon() - { - $this->expectsRequest('post', '/v1/coupons'); - $result = $this->client->coupons->create( - [ - 'percent_off' => 25.5, - 'duration' => 'repeating', - 'duration_in_months' => 3, - ] + $result = $this->client->financialConnections->sessions->retrieve( + 'fcsess_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } - public function testRetrieveCoupon() + public function testListVerificationReport() { - $this->expectsRequest('get', '/v1/coupons/Z4OV52SU'); - $result = $this->client->coupons->retrieve('Z4OV52SU', []); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + $this->expectsRequest('get', '/v1/identity/verification_reports'); + $result = $this->client->identity->verificationReports->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Identity\VerificationReport::class, $result->data[0]); } - public function testUpdateCoupon() + public function testRetrieveVerificationReport() { - $this->expectsRequest('post', '/v1/coupons/Z4OV52SU'); - $result = $this->client->coupons->update( - 'Z4OV52SU', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'get', + '/v1/identity/verification_reports/vr_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + $result = $this->client->identity->verificationReports->retrieve( + 'vr_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Identity\VerificationReport::class, $result); } - public function testDeleteCoupon() + public function testListVerificationSession() { - $this->expectsRequest('delete', '/v1/coupons/Z4OV52SU'); - $result = $this->client->coupons->delete('Z4OV52SU', []); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + $this->expectsRequest('get', '/v1/identity/verification_sessions'); + $result = $this->client->identity->verificationSessions->all( + ['limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result->data[0]); } - public function testListCoupon() + public function testCreateVerificationSession() { - $this->expectsRequest('get', '/v1/coupons'); - $result = $this->client->coupons->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Coupon::class, $result->data[0]); + $this->expectsRequest('post', '/v1/identity/verification_sessions'); + $result = $this->client->identity->verificationSessions->create( + ['type' => 'document'] + ); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testCreatePromotionCode() + public function testRetrieveVerificationSession() { - $this->expectsRequest('post', '/v1/promotion_codes'); - $result = $this->client->promotionCodes->create(['coupon' => 'Z4OV52SU']); - static::assertInstanceOf(\Stripe\PromotionCode::class, $result); + $this->expectsRequest( + 'get', + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' + ); + $result = $this->client->identity->verificationSessions->retrieve( + 'vs_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testUpdatePromotionCode() + public function testUpdateVerificationSession() { - $this->expectsRequest('post', '/v1/promotion_codes/promo_xxxxxxxxxxxxx'); - $result = $this->client->promotionCodes->update( - 'promo_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'post', + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\PromotionCode::class, $result); + $result = $this->client->identity->verificationSessions->update( + 'vs_xxxxxxxxxxxxx', + ['type' => 'id_number'] + ); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testRetrievePromotionCode() + public function testCancelVerificationSession() { - $this->expectsRequest('get', '/v1/promotion_codes/promo_xxxxxxxxxxxxx'); - $result = $this->client->promotionCodes->retrieve( - 'promo_xxxxxxxxxxxxx', + $this->expectsRequest( + 'post', + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel' + ); + $result = $this->client->identity->verificationSessions->cancel( + 'vs_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\PromotionCode::class, $result); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testListPromotionCode() + public function testRedactVerificationSession() { - $this->expectsRequest('get', '/v1/promotion_codes'); - $result = $this->client->promotionCodes->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\PromotionCode::class, $result->data[0]); + $this->expectsRequest( + 'post', + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact' + ); + $result = $this->client->identity->verificationSessions->redact( + 'vs_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testListTaxCode() + public function testListInvoiceItem() { - $this->expectsRequest('get', '/v1/tax_codes'); - $result = $this->client->taxCodes->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/invoiceitems'); + $result = $this->client->invoiceItems->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TaxCode::class, $result->data[0]); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result->data[0]); } - public function testRetrieveTaxCode() + public function testCreateInvoiceItem() { - $this->expectsRequest('get', '/v1/tax_codes/txcd_xxxxxxxxxxxxx'); - $result = $this->client->taxCodes->retrieve('txcd_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\TaxCode::class, $result); + $this->expectsRequest('post', '/v1/invoiceitems'); + $result = $this->client->invoiceItems->create( + ['customer' => 'cus_xxxxxxxxxxxxx', 'price' => 'price_xxxxxxxxxxxxx'] + ); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); } - public function testCreateTaxRate() + public function testDeleteInvoiceItem() { - $this->expectsRequest('post', '/v1/tax_rates'); - $result = $this->client->taxRates->create( - [ - 'display_name' => 'VAT', - 'description' => 'VAT Germany', - 'jurisdiction' => 'DE', - 'percentage' => 16, - 'inclusive' => false, - ] - ); - static::assertInstanceOf(\Stripe\TaxRate::class, $result); + $this->expectsRequest('delete', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); + $result = $this->client->invoiceItems->delete('ii_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); } - public function testRetrieveTaxRate() + public function testRetrieveInvoiceItem() { - $this->expectsRequest('get', '/v1/tax_rates/txr_xxxxxxxxxxxxx'); - $result = $this->client->taxRates->retrieve('txr_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\TaxRate::class, $result); + $this->expectsRequest('get', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); + $result = $this->client->invoiceItems->retrieve('ii_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); } - public function testUpdateTaxRate() + public function testUpdateInvoiceItem() { - $this->expectsRequest('post', '/v1/tax_rates/txr_xxxxxxxxxxxxx'); - $result = $this->client->taxRates->update( - 'txr_xxxxxxxxxxxxx', - ['active' => false] + $this->expectsRequest('post', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); + $result = $this->client->invoiceItems->update( + 'ii_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\TaxRate::class, $result); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); } - public function testListTaxRate() + public function testListInvoice() { - $this->expectsRequest('get', '/v1/tax_rates'); - $result = $this->client->taxRates->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/invoices'); + $result = $this->client->invoices->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TaxRate::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]); } - public function testCreateShippingRate2() + public function testCreateInvoice() { - $this->expectsRequest('post', '/v1/shipping_rates'); - $result = $this->client->shippingRates->create( - [ - 'display_name' => 'Ground shipping', - 'type' => 'fixed_amount', - 'fixed_amount' => ['amount' => 500, 'currency' => 'usd'], - ] + $this->expectsRequest('post', '/v1/invoices'); + $result = $this->client->invoices->create( + ['customer' => 'cus_xxxxxxxxxxxxx'] ); - static::assertInstanceOf(\Stripe\ShippingRate::class, $result); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testRetrieveShippingRate() + public function testDeleteInvoice() { - $this->expectsRequest('get', '/v1/shipping_rates/shr_xxxxxxxxxxxxx'); - $result = $this->client->shippingRates->retrieve('shr_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\ShippingRate::class, $result); + $this->expectsRequest('delete', '/v1/invoices/in_xxxxxxxxxxxxx'); + $result = $this->client->invoices->delete('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testUpdateShippingRate() + public function testRetrieveInvoice() { - $this->expectsRequest('post', '/v1/shipping_rates/shr_xxxxxxxxxxxxx'); - $result = $this->client->shippingRates->update( - 'shr_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\ShippingRate::class, $result); + $this->expectsRequest('get', '/v1/invoices/in_xxxxxxxxxxxxx'); + $result = $this->client->invoices->retrieve('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testListShippingRate2() + public function testUpdateInvoice() { - $this->expectsRequest('get', '/v1/shipping_rates'); - $result = $this->client->shippingRates->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\ShippingRate::class, $result->data[0]); + $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx'); + $result = $this->client->invoices->update( + 'in_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testCreateSession3() + public function testFinalizeInvoiceInvoice() { - $this->expectsRequest('post', '/v1/checkout/sessions'); - $result = $this->client->checkout->sessions->create( - [ - 'success_url' => 'https://example.com/success', - 'cancel_url' => 'https://example.com/cancel', - 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]], - 'mode' => 'payment', - ] - ); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/finalize'); + $result = $this->client->invoices->finalizeInvoice('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testExpireSession2() + public function testMarkUncollectibleInvoice() { $this->expectsRequest( 'post', - '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire' + '/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible' ); - $result = $this->client->checkout->sessions->expire( - 'cs_test_xxxxxxxxxxxxx', + $result = $this->client->invoices->markUncollectible( + 'in_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testRetrieveSession2() - { - $this->expectsRequest('get', '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx'); - $result = $this->client->checkout->sessions->retrieve( - 'cs_test_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); - } - - public function testListSession() + public function testPayInvoice() { - $this->expectsRequest('get', '/v1/checkout/sessions'); - $result = $this->client->checkout->sessions->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result->data[0]); + $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/pay'); + $result = $this->client->invoices->pay('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testCreatePaymentLink2() + public function testSendInvoiceInvoice() { - $this->expectsRequest('post', '/v1/payment_links'); - $result = $this->client->paymentLinks->create( - ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]] - ); - static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/send'); + $result = $this->client->invoices->sendInvoice('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testRetrievePaymentLink2() + public function testVoidInvoiceInvoice() { - $this->expectsRequest('get', '/v1/payment_links/plink_xxxxxxxxxxxxx'); - $result = $this->client->paymentLinks->retrieve('plink_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/void'); + $result = $this->client->invoices->voidInvoice('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testUpdatePaymentLink() + public function testSearchInvoice() { - $this->expectsRequest('post', '/v1/payment_links/plink_xxxxxxxxxxxxx'); - $result = $this->client->paymentLinks->update( - 'plink_xxxxxxxxxxxxx', - ['active' => false] + $this->expectsRequest('get', '/v1/invoices/search'); + $result = $this->client->invoices->search( + ['query' => 'total>999 AND metadata[\'order_id\']:\'6735\''] ); - static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Invoice","namespaces":[]}} } - public function testListPaymentLink() + public function testListAuthorization() { - $this->expectsRequest('get', '/v1/payment_links'); - $result = $this->client->paymentLinks->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/issuing/authorizations'); + $result = $this->client->issuing->authorizations->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\PaymentLink::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result->data[0]); } - public function testCreateCreditNote() + public function testRetrieveAuthorization() { - $this->expectsRequest('post', '/v1/credit_notes'); - $result = $this->client->creditNotes->create( - [ - 'invoice' => 'in_xxxxxxxxxxxxx', - 'lines' => [ - [ - 'type' => 'invoice_line_item', - 'invoice_line_item' => 'il_xxxxxxxxxxxxx', - 'quantity' => 1, - ], - ], - ] + $this->expectsRequest( + 'get', + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\CreditNote::class, $result); - } - - public function testRetrieveCreditNote() - { - $this->expectsRequest('get', '/v1/credit_notes/cn_xxxxxxxxxxxxx'); - $result = $this->client->creditNotes->retrieve('cn_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\CreditNote::class, $result); + $result = $this->client->issuing->authorizations->retrieve( + 'iauth_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testUpdateCreditNote() + public function testUpdateAuthorization() { - $this->expectsRequest('post', '/v1/credit_notes/cn_xxxxxxxxxxxxx'); - $result = $this->client->creditNotes->update( - 'cn_xxxxxxxxxxxxx', + $this->expectsRequest( + 'post', + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' + ); + $result = $this->client->issuing->authorizations->update( + 'iauth_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\CreditNote::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testListCreditNoteLineItem() + public function testApproveAuthorization() { - $this->expectsRequest('get', '/v1/credit_notes/cn_xxxxxxxxxxxxx/lines'); - $result = $this->client->creditNotes->allLines( - 'cn_xxxxxxxxxxxxx', - ['limit' => 3] + $this->expectsRequest( + 'post', + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve' ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CreditNoteLineItem::class, $result->data[0]); + $result = $this->client->issuing->authorizations->approve( + 'iauth_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testVoidCreditNoteCreditNote() + public function testDeclineAuthorization() { - $this->expectsRequest('post', '/v1/credit_notes/cn_xxxxxxxxxxxxx/void'); - $result = $this->client->creditNotes->voidCreditNote( - 'cn_xxxxxxxxxxxxx', + $this->expectsRequest( + 'post', + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline' + ); + $result = $this->client->issuing->authorizations->decline( + 'iauth_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\CreditNote::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testListCreditNote() + public function testListCardholder() { - $this->expectsRequest('get', '/v1/credit_notes'); - $result = $this->client->creditNotes->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/issuing/cardholders'); + $result = $this->client->issuing->cardholders->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CreditNote::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result->data[0]); } - public function testCreateCustomerBalanceTransaction() + public function testCreateCardholder() { - $this->expectsRequest( - 'post', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' - ); - $result = $this->client->customers->createBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - ['amount' => -500, 'currency' => 'usd'] + $this->expectsRequest('post', '/v1/issuing/cardholders'); + $result = $this->client->issuing->cardholders->create( + [ + 'type' => 'individual', + 'name' => 'Jenny Rosen', + 'email' => 'jenny.rosen@example.com', + 'phone_number' => '+18888675309', + 'billing' => [ + 'address' => [ + 'line1' => '1234 Main Street', + 'city' => 'San Francisco', + 'state' => 'CA', + 'country' => 'US', + 'postal_code' => '94111', + ], + ], + ] ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); } - public function testRetrieveCustomerBalanceTransaction() + public function testRetrieveCardholder() { - $this->expectsRequest( - 'get', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' - ); - $result = $this->client->customers->retrieveBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - 'cbtxn_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx'); + $result = $this->client->issuing->cardholders->retrieve( + 'ich_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); } - public function testUpdateCustomerBalanceTransaction() + public function testUpdateCardholder() { - $this->expectsRequest( - 'post', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' - ); - $result = $this->client->customers->updateBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - 'cbtxn_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx'); + $result = $this->client->issuing->cardholders->update( + 'ich_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); } - public function testListCustomerBalanceTransaction() + public function testListCard() { - $this->expectsRequest( - 'get', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' - ); - $result = $this->client->customers->allBalanceTransactions( - 'cus_xxxxxxxxxxxxx', - ['limit' => 3] - ); + $this->expectsRequest('get', '/v1/issuing/cards'); + $result = $this->client->issuing->cards->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result->data[0]); } - public function testCreateSession4() + public function testCreateCard() { - $this->expectsRequest('post', '/v1/billing_portal/sessions'); - $result = $this->client->billingPortal->sessions->create( + $this->expectsRequest('post', '/v1/issuing/cards'); + $result = $this->client->issuing->cards->create( [ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'return_url' => 'https://example.com/account', + 'cardholder' => 'ich_xxxxxxxxxxxxx', + 'currency' => 'usd', + 'type' => 'virtual', ] ); - static::assertInstanceOf(\Stripe\BillingPortal\Session::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); } - public function testUpdateConfiguration2() + public function testRetrieveCard() { - $this->expectsRequest( - 'post', - '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' - ); - $result = $this->client->billingPortal->configurations->update( - 'bpc_xxxxxxxxxxxxx', - [ - 'business_profile' => [ - 'privacy_policy_url' => 'https://example.com/privacy', - 'terms_of_service_url' => 'https://example.com/terms', - ], - ] - ); - static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); + $this->expectsRequest('get', '/v1/issuing/cards/ic_xxxxxxxxxxxxx'); + $result = $this->client->issuing->cards->retrieve('ic_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); } - public function testRetrieveConfiguration2() + public function testUpdateCard() { - $this->expectsRequest( - 'get', - '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' - ); - $result = $this->client->billingPortal->configurations->retrieve( - 'bpc_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/issuing/cards/ic_xxxxxxxxxxxxx'); + $result = $this->client->issuing->cards->update( + 'ic_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); } - public function testListConfiguration2() + public function testListDispute2() { - $this->expectsRequest('get', '/v1/billing_portal/configurations'); - $result = $this->client->billingPortal->configurations->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/issuing/disputes'); + $result = $this->client->issuing->disputes->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result->data[0]); } - public function testCreateTaxId() + public function testCreateDispute() { - $this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids'); - $result = $this->client->customers->createTaxId( - 'cus_xxxxxxxxxxxxx', - ['type' => 'eu_vat', 'value' => 'DE123456789'] + $this->expectsRequest('post', '/v1/issuing/disputes'); + $result = $this->client->issuing->disputes->create( + [ + 'transaction' => 'ipi_xxxxxxxxxxxxx', + 'evidence' => [ + 'reason' => 'fraudulent', + 'fraudulent' => ['explanation' => 'Purchase was unrecognized.'], + ], + ] ); - static::assertInstanceOf(\Stripe\TaxId::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); } - public function testRetrieveTaxId() + public function testRetrieveDispute2() { - $this->expectsRequest( - 'get', - '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx' - ); - $result = $this->client->customers->retrieveTaxId( - 'cus_xxxxxxxxxxxxx', - 'txi_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/issuing/disputes/idp_xxxxxxxxxxxxx'); + $result = $this->client->issuing->disputes->retrieve( + 'idp_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\TaxId::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); } - public function testDeleteTaxId() + public function testSubmitDispute() { $this->expectsRequest( - 'delete', - '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx' - ); - $result = $this->client->customers->deleteTaxId( - 'cus_xxxxxxxxxxxxx', - 'txi_xxxxxxxxxxxxx', - [] + 'post', + '/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit' ); - static::assertInstanceOf(\Stripe\TaxId::class, $result); + $result = $this->client->issuing->disputes->submit('idp_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); } - public function testListTaxId() + public function testListTransaction() { - $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids'); - $result = $this->client->customers->allTaxIds( - 'cus_xxxxxxxxxxxxx', - ['limit' => 3] - ); + $this->expectsRequest('get', '/v1/issuing/transactions'); + $result = $this->client->issuing->transactions->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TaxId::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result->data[0]); } - public function testCreateInvoice() + public function testRetrieveTransaction() { - $this->expectsRequest('post', '/v1/invoices'); - $result = $this->client->invoices->create( - ['customer' => 'cus_xxxxxxxxxxxxx'] + $this->expectsRequest('get', '/v1/issuing/transactions/ipi_xxxxxxxxxxxxx'); + $result = $this->client->issuing->transactions->retrieve( + 'ipi_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); } - public function testRetrieveInvoice() + public function testUpdateTransaction() { - $this->expectsRequest('get', '/v1/invoices/in_xxxxxxxxxxxxx'); - $result = $this->client->invoices->retrieve('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('post', '/v1/issuing/transactions/ipi_xxxxxxxxxxxxx'); + $result = $this->client->issuing->transactions->update( + 'ipi_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); } - public function testUpdateInvoice() + public function testRetrieveMandate() { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx'); - $result = $this->client->invoices->update( - 'in_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('get', '/v1/mandates/mandate_xxxxxxxxxxxxx'); + $result = $this->client->mandates->retrieve('mandate_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Mandate::class, $result); } - public function testDeleteInvoice() + public function testListOrder() { - $this->expectsRequest('delete', '/v1/invoices/in_xxxxxxxxxxxxx'); - $result = $this->client->invoices->delete('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('get', '/v1/orders'); + $result = $this->client->orders->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Order::class, $result->data[0]); } - public function testFinalizeInvoiceInvoice() + public function testListPaymentIntent() { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/finalize'); - $result = $this->client->invoices->finalizeInvoice('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('get', '/v1/payment_intents'); + $result = $this->client->paymentIntents->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]); } - public function testPayInvoice() + public function testCreatePaymentIntent2() { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/pay'); - $result = $this->client->invoices->pay('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('post', '/v1/payment_intents'); + $result = $this->client->paymentIntents->create( + [ + 'amount' => 2000, + 'currency' => 'usd', + 'payment_method_types' => ['card'], + ] + ); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testSendInvoiceInvoice() + public function testRetrievePaymentIntent() { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/send'); - $result = $this->client->invoices->sendInvoice('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('get', '/v1/payment_intents/pi_xxxxxxxxxxxxx'); + $result = $this->client->paymentIntents->retrieve('pi_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testVoidInvoiceInvoice() + public function testUpdatePaymentIntent() { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/void'); - $result = $this->client->invoices->voidInvoice('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('post', '/v1/payment_intents/pi_xxxxxxxxxxxxx'); + $result = $this->client->paymentIntents->update( + 'pi_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testMarkUncollectibleInvoice() + public function testApplyCustomerBalancePaymentIntent() { $this->expectsRequest( 'post', - '/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible' + '/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance' ); - $result = $this->client->invoices->markUncollectible( - 'in_xxxxxxxxxxxxx', + $result = $this->client->paymentIntents->applyCustomerBalance( + 'pi_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Invoice::class, $result); - } - - public function testListInvoice() - { - $this->expectsRequest('get', '/v1/invoices'); - $result = $this->client->invoices->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testSearchInvoice() + public function testCancelPaymentIntent() { - $this->expectsRequest('get', '/v1/invoices/search'); - $result = $this->client->invoices->search( - ['query' => 'total>999 AND metadata[\'order_id\']:\'6735\''] + $this->expectsRequest( + 'post', + '/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel' ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Invoice","namespaces":[]}} + $result = $this->client->paymentIntents->cancel('pi_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testCreateInvoiceItem() + public function testCapturePaymentIntent() { - $this->expectsRequest('post', '/v1/invoiceitems'); - $result = $this->client->invoiceItems->create( - ['customer' => 'cus_xxxxxxxxxxxxx', 'price' => 'price_xxxxxxxxxxxxx'] + $this->expectsRequest( + 'post', + '/v1/payment_intents/pi_xxxxxxxxxxxxx/capture' ); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); + $result = $this->client->paymentIntents->capture('pi_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testRetrieveInvoiceItem() + public function testConfirmPaymentIntent() { - $this->expectsRequest('get', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); - $result = $this->client->invoiceItems->retrieve('ii_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); + $this->expectsRequest( + 'post', + '/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm' + ); + $result = $this->client->paymentIntents->confirm( + 'pi_xxxxxxxxxxxxx', + ['payment_method' => 'pm_card_visa'] + ); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testUpdateInvoiceItem() + public function testIncrementAuthorizationPaymentIntent() { - $this->expectsRequest('post', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); - $result = $this->client->invoiceItems->update( - 'ii_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'post', + '/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization' ); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); + $result = $this->client->paymentIntents->incrementAuthorization( + 'pi_xxxxxxxxxxxxx', + ['amount' => 2099] + ); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testDeleteInvoiceItem() + public function testSearchPaymentIntent() { - $this->expectsRequest('delete', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); - $result = $this->client->invoiceItems->delete('ii_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); + $this->expectsRequest('get', '/v1/payment_intents/search'); + $result = $this->client->paymentIntents->search( + ['query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\''] + ); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"PaymentIntent","namespaces":[]}} } - public function testListInvoiceItem() + public function testListPaymentLink() { - $this->expectsRequest('get', '/v1/invoiceitems'); - $result = $this->client->invoiceItems->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/payment_links'); + $result = $this->client->paymentLinks->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result->data[0]); } - public function testCreatePlan() + public function testCreatePaymentLink2() { - $this->expectsRequest('post', '/v1/plans'); - $result = $this->client->plans->create( - [ - 'amount' => 2000, - 'currency' => 'usd', - 'interval' => 'month', - 'product' => 'prod_xxxxxxxxxxxxx', - ] + $this->expectsRequest('post', '/v1/payment_links'); + $result = $this->client->paymentLinks->create( + ['line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]]] ); - static::assertInstanceOf(\Stripe\Plan::class, $result); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result); } - public function testRetrievePlan() + public function testRetrievePaymentLink2() { - $this->expectsRequest('get', '/v1/plans/price_xxxxxxxxxxxxx'); - $result = $this->client->plans->retrieve('price_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Plan::class, $result); + $this->expectsRequest('get', '/v1/payment_links/plink_xxxxxxxxxxxxx'); + $result = $this->client->paymentLinks->retrieve('plink_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result); } - public function testUpdatePlan() + public function testUpdatePaymentLink() { - $this->expectsRequest('post', '/v1/plans/price_xxxxxxxxxxxxx'); - $result = $this->client->plans->update( - 'price_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest('post', '/v1/payment_links/plink_xxxxxxxxxxxxx'); + $result = $this->client->paymentLinks->update( + 'plink_xxxxxxxxxxxxx', + ['active' => false] ); - static::assertInstanceOf(\Stripe\Plan::class, $result); - } - - public function testDeletePlan() - { - $this->expectsRequest('delete', '/v1/plans/price_xxxxxxxxxxxxx'); - $result = $this->client->plans->delete('price_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Plan::class, $result); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result); } - public function testListPlan() + public function testListPaymentMethod() { - $this->expectsRequest('get', '/v1/plans'); - $result = $this->client->plans->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/payment_methods'); + $result = $this->client->paymentMethods->all( + ['customer' => 'cus_xxxxxxxxxxxxx', 'type' => 'card'] + ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Plan::class, $result->data[0]); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result->data[0]); } - public function testCreateQuote() + public function testCreatePaymentMethod() { - $this->expectsRequest('post', '/v1/quotes'); - $result = $this->client->quotes->create( + $this->expectsRequest('post', '/v1/payment_methods'); + $result = $this->client->paymentMethods->create( [ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]], + 'type' => 'card', + 'card' => [ + 'number' => '4242424242424242', + 'exp_month' => 5, + 'exp_year' => 2023, + 'cvc' => '314', + ], ] ); - static::assertInstanceOf(\Stripe\Quote::class, $result); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); } - public function testRetrieveQuote() + public function testRetrievePaymentMethod() { - $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx'); - $result = $this->client->quotes->retrieve('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); + $this->expectsRequest('get', '/v1/payment_methods/pm_xxxxxxxxxxxxx'); + $result = $this->client->paymentMethods->retrieve('pm_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); } - public function testUpdateQuote() + public function testUpdatePaymentMethod() { - $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx'); - $result = $this->client->quotes->update( - 'qt_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/payment_methods/pm_xxxxxxxxxxxxx'); + $result = $this->client->paymentMethods->update( + 'pm_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Quote::class, $result); - } - - public function testFinalizeQuoteQuote() - { - $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/finalize'); - $result = $this->client->quotes->finalizeQuote('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); } - public function testAcceptQuote() + public function testAttachPaymentMethod() { - $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/accept'); - $result = $this->client->quotes->accept('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); + $this->expectsRequest( + 'post', + '/v1/payment_methods/pm_xxxxxxxxxxxxx/attach' + ); + $result = $this->client->paymentMethods->attach( + 'pm_xxxxxxxxxxxxx', + ['customer' => 'cus_xxxxxxxxxxxxx'] + ); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); } - public function testCancelQuote() + public function testDetachPaymentMethod() { - $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/cancel'); - $result = $this->client->quotes->cancel('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); + $this->expectsRequest( + 'post', + '/v1/payment_methods/pm_xxxxxxxxxxxxx/detach' + ); + $result = $this->client->paymentMethods->detach('pm_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); } - public function testListQuote() + public function testListPayout() { - $this->expectsRequest('get', '/v1/quotes'); - $result = $this->client->quotes->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/payouts'); + $result = $this->client->payouts->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Quote::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Payout::class, $result->data[0]); } - public function testCreateSubscription() + public function testCreatePayout() { - $this->expectsRequest('post', '/v1/subscriptions'); - $result = $this->client->subscriptions->create( - [ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'items' => [['price' => 'price_xxxxxxxxxxxxx']], - ] + $this->expectsRequest('post', '/v1/payouts'); + $result = $this->client->payouts->create( + ['amount' => 1100, 'currency' => 'usd'] ); - static::assertInstanceOf(\Stripe\Subscription::class, $result); + static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testRetrieveSubscription() + public function testRetrievePayout() { - $this->expectsRequest('get', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); - $result = $this->client->subscriptions->retrieve('sub_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Subscription::class, $result); + $this->expectsRequest('get', '/v1/payouts/po_xxxxxxxxxxxxx'); + $result = $this->client->payouts->retrieve('po_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testUpdateSubscription() + public function testUpdatePayout() { - $this->expectsRequest('post', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); - $result = $this->client->subscriptions->update( - 'sub_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx'); + $result = $this->client->payouts->update( + 'po_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Subscription::class, $result); + static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testCancelSubscription() + public function testCancelPayout() { - $this->expectsRequest('delete', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); - $result = $this->client->subscriptions->cancel('sub_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Subscription::class, $result); + $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/cancel'); + $result = $this->client->payouts->cancel('po_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testListSubscription() + public function testReversePayout() { - $this->expectsRequest('get', '/v1/subscriptions'); - $result = $this->client->subscriptions->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Subscription::class, $result->data[0]); + $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/reverse'); + $result = $this->client->payouts->reverse('po_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testSearchSubscription() + public function testListPlan() { - $this->expectsRequest('get', '/v1/subscriptions/search'); - $result = $this->client->subscriptions->search( - ['query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\''] - ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Subscription","namespaces":[]}} + $this->expectsRequest('get', '/v1/plans'); + $result = $this->client->plans->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Plan::class, $result->data[0]); } - public function testCreateSubscriptionItem() + public function testCreatePlan() { - $this->expectsRequest('post', '/v1/subscription_items'); - $result = $this->client->subscriptionItems->create( + $this->expectsRequest('post', '/v1/plans'); + $result = $this->client->plans->create( [ - 'subscription' => 'sub_xxxxxxxxxxxxx', - 'price' => 'price_xxxxxxxxxxxxx', - 'quantity' => 2, + 'amount' => 2000, + 'currency' => 'usd', + 'interval' => 'month', + 'product' => 'prod_xxxxxxxxxxxxx', ] ); - static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); + static::assertInstanceOf(\Stripe\Plan::class, $result); } - public function testRetrieveSubscriptionItem() + public function testDeletePlan() { - $this->expectsRequest('get', '/v1/subscription_items/si_xxxxxxxxxxxxx'); - $result = $this->client->subscriptionItems->retrieve( - 'si_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); + $this->expectsRequest('delete', '/v1/plans/price_xxxxxxxxxxxxx'); + $result = $this->client->plans->delete('price_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Plan::class, $result); } - public function testUpdateSubscriptionItem() + public function testRetrievePlan() { - $this->expectsRequest('post', '/v1/subscription_items/si_xxxxxxxxxxxxx'); - $result = $this->client->subscriptionItems->update( - 'si_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); + $this->expectsRequest('get', '/v1/plans/price_xxxxxxxxxxxxx'); + $result = $this->client->plans->retrieve('price_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Plan::class, $result); } - public function testDeleteSubscriptionItem() + public function testUpdatePlan() { - $this->expectsRequest('delete', '/v1/subscription_items/si_xxxxxxxxxxxxx'); - $result = $this->client->subscriptionItems->delete('si_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); + $this->expectsRequest('post', '/v1/plans/price_xxxxxxxxxxxxx'); + $result = $this->client->plans->update( + 'price_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Plan::class, $result); } - public function testListSubscriptionItem() + public function testListPrice() { - $this->expectsRequest('get', '/v1/subscription_items'); - $result = $this->client->subscriptionItems->all( - ['subscription' => 'sub_xxxxxxxxxxxxx'] - ); + $this->expectsRequest('get', '/v1/prices'); + $result = $this->client->prices->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Price::class, $result->data[0]); } - public function testCreateSubscriptionSchedule() + public function testCreatePrice() { - $this->expectsRequest('post', '/v1/subscription_schedules'); - $result = $this->client->subscriptionSchedules->create( + $this->expectsRequest('post', '/v1/prices'); + $result = $this->client->prices->create( [ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'start_date' => 1652909005, - 'end_behavior' => 'release', - 'phases' => [ - [ - 'items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]], - 'iterations' => 12, - ], - ], + 'unit_amount' => 2000, + 'currency' => 'usd', + 'recurring' => ['interval' => 'month'], + 'product' => 'prod_xxxxxxxxxxxxx', ] ); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + static::assertInstanceOf(\Stripe\Price::class, $result); } - public function testRetrieveSubscriptionSchedule() + public function testRetrievePrice() { - $this->expectsRequest( - 'get', - '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx' - ); - $result = $this->client->subscriptionSchedules->retrieve( - 'sub_sched_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + $this->expectsRequest('get', '/v1/prices/price_xxxxxxxxxxxxx'); + $result = $this->client->prices->retrieve('price_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Price::class, $result); } - public function testUpdateSubscriptionSchedule() + public function testUpdatePrice() { - $this->expectsRequest( - 'post', - '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx' - ); - $result = $this->client->subscriptionSchedules->update( - 'sub_sched_xxxxxxxxxxxxx', - ['end_behavior' => 'release'] + $this->expectsRequest('post', '/v1/prices/price_xxxxxxxxxxxxx'); + $result = $this->client->prices->update( + 'price_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + static::assertInstanceOf(\Stripe\Price::class, $result); } - public function testCancelSubscriptionSchedule() + public function testSearchPrice() { - $this->expectsRequest( - 'post', - '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel' - ); - $result = $this->client->subscriptionSchedules->cancel( - 'sub_sched_xxxxxxxxxxxxx', - [] + $this->expectsRequest('get', '/v1/prices/search'); + $result = $this->client->prices->search( + ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\''] ); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Price","namespaces":[]}} } - public function testReleaseSubscriptionSchedule() + public function testListProduct() { - $this->expectsRequest( - 'post', - '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release' - ); - $result = $this->client->subscriptionSchedules->release( - 'sub_sched_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + $this->expectsRequest('get', '/v1/products'); + $result = $this->client->products->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Product::class, $result->data[0]); } - public function testListSubscriptionSchedule() + public function testCreateProduct() { - $this->expectsRequest('get', '/v1/subscription_schedules'); - $result = $this->client->subscriptionSchedules->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result->data[0]); + $this->expectsRequest('post', '/v1/products'); + $result = $this->client->products->create(['name' => 'Gold Special']); + static::assertInstanceOf(\Stripe\Product::class, $result); } - public function testCreateTestClock2() + public function testDeleteProduct() { - $this->expectsRequest('post', '/v1/test_helpers/test_clocks'); - $result = $this->client->testHelpers->testClocks->create( - ['frozen_time' => 1577836800] - ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + $this->expectsRequest('delete', '/v1/products/prod_xxxxxxxxxxxxx'); + $result = $this->client->products->delete('prod_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Product::class, $result); } - public function testRetrieveTestClock2() + public function testRetrieveProduct() { - $this->expectsRequest( - 'get', - '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' - ); - $result = $this->client->testHelpers->testClocks->retrieve( - 'clock_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + $this->expectsRequest('get', '/v1/products/prod_xxxxxxxxxxxxx'); + $result = $this->client->products->retrieve('prod_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Product::class, $result); } - public function testDeleteTestClock2() + public function testUpdateProduct() { - $this->expectsRequest( - 'delete', - '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' - ); - $result = $this->client->testHelpers->testClocks->delete( - 'clock_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/products/prod_xxxxxxxxxxxxx'); + $result = $this->client->products->update( + 'prod_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + static::assertInstanceOf(\Stripe\Product::class, $result); } - public function testAdvanceTestClock2() + public function testSearchProduct() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx/advance' - ); - $result = $this->client->testHelpers->testClocks->advance( - 'clock_xxxxxxxxxxxxx', - ['frozen_time' => 1652390605] + $this->expectsRequest('get', '/v1/products/search'); + $result = $this->client->products->search( + ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\''] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Product","namespaces":[]}} } - public function testListTestClock2() + public function testListPromotionCode() { - $this->expectsRequest('get', '/v1/test_helpers/test_clocks'); - $result = $this->client->testHelpers->testClocks->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/promotion_codes'); + $result = $this->client->promotionCodes->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result->data[0]); + static::assertInstanceOf(\Stripe\PromotionCode::class, $result->data[0]); } - public function testCreateUsageRecord() + public function testCreatePromotionCode() { - $this->expectsRequest( - 'post', - '/v1/subscription_items/si_xxxxxxxxxxxxx/usage_records' - ); - $result = $this->client->subscriptionItems->createUsageRecord( - 'si_xxxxxxxxxxxxx', - ['quantity' => 100, 'timestamp' => 1571252444] - ); - static::assertInstanceOf(\Stripe\UsageRecord::class, $result); + $this->expectsRequest('post', '/v1/promotion_codes'); + $result = $this->client->promotionCodes->create(['coupon' => 'Z4OV52SU']); + static::assertInstanceOf(\Stripe\PromotionCode::class, $result); } - public function testListUsageRecordSummary() + public function testRetrievePromotionCode() { - $this->expectsRequest( - 'get', - '/v1/subscription_items/si_xxxxxxxxxxxxx/usage_record_summaries' + $this->expectsRequest('get', '/v1/promotion_codes/promo_xxxxxxxxxxxxx'); + $result = $this->client->promotionCodes->retrieve( + 'promo_xxxxxxxxxxxxx', + [] ); - $result = $this->client->subscriptionItems->allUsageRecordSummaries( - 'si_xxxxxxxxxxxxx', - ['limit' => 3] + static::assertInstanceOf(\Stripe\PromotionCode::class, $result); + } + + public function testUpdatePromotionCode() + { + $this->expectsRequest('post', '/v1/promotion_codes/promo_xxxxxxxxxxxxx'); + $result = $this->client->promotionCodes->update( + 'promo_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); + static::assertInstanceOf(\Stripe\PromotionCode::class, $result); + } + + public function testListQuote() + { + $this->expectsRequest('get', '/v1/quotes'); + $result = $this->client->quotes->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\UsageRecordSummary::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Quote::class, $result->data[0]); } - public function testCreateAccount() + public function testCreateQuote() { - $this->expectsRequest('post', '/v1/accounts'); - $result = $this->client->accounts->create( + $this->expectsRequest('post', '/v1/quotes'); + $result = $this->client->quotes->create( [ - 'type' => 'custom', - 'country' => 'US', - 'email' => 'jenny.rosen@example.com', - 'capabilities' => [ - 'card_payments' => ['requested' => true], - 'transfers' => ['requested' => true], - ], + 'customer' => 'cus_xxxxxxxxxxxxx', + 'line_items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 2]], ] ); - static::assertInstanceOf(\Stripe\Account::class, $result); + static::assertInstanceOf(\Stripe\Quote::class, $result); } - public function testRetrieveAccount2() + public function testRetrieveQuote() { - $this->expectsRequest('get', '/v1/accounts/acct_xxxxxxxxxxxxx'); - $result = $this->client->accounts->retrieve('acct_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Account::class, $result); + $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx'); + $result = $this->client->quotes->retrieve('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::class, $result); } - public function testUpdateAccount() + public function testUpdateQuote() { - $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx'); - $result = $this->client->accounts->update( - 'acct_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx'); + $result = $this->client->quotes->update( + 'qt_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Account::class, $result); + static::assertInstanceOf(\Stripe\Quote::class, $result); } - public function testDeleteAccount() + public function testAcceptQuote() { - $this->expectsRequest('delete', '/v1/accounts/acct_xxxxxxxxxxxxx'); - $result = $this->client->accounts->delete('acct_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Account::class, $result); + $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/accept'); + $result = $this->client->quotes->accept('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::class, $result); } - public function testRejectAccount() + public function testCancelQuote() { - $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/reject'); - $result = $this->client->accounts->reject( - 'acct_xxxxxxxxxxxxx', - ['reason' => 'fraud'] + $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/cancel'); + $result = $this->client->quotes->cancel('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::class, $result); + } + + public function testFinalizeQuoteQuote() + { + $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/finalize'); + $result = $this->client->quotes->finalizeQuote('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::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 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 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 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\Account::class, $result); + static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); } - public function testListAccount2() + public function testDeleteValueListItem() { - $this->expectsRequest('get', '/v1/accounts'); - $result = $this->client->accounts->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Account::class, $result->data[0]); + $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 testCreateLoginLink() + public function testRetrieveValueListItem() { $this->expectsRequest( - 'post', - '/v1/accounts/acct_xxxxxxxxxxxxx/login_links' + 'get', + '/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx' ); - $result = $this->client->accounts->createLoginLink( - 'acct_xxxxxxxxxxxxx', + $result = $this->client->radar->valueListItems->retrieve( + 'rsli_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\LoginLink::class, $result); + static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); } - public function testCreateAccountLink() + public function testListValueList() { - $this->expectsRequest('post', '/v1/account_links'); - $result = $this->client->accountLinks->create( - [ - 'account' => 'acct_xxxxxxxxxxxxx', - 'refresh_url' => 'https://example.com/reauth', - 'return_url' => 'https://example.com/return', - 'type' => 'account_onboarding', - ] - ); - static::assertInstanceOf(\Stripe\AccountLink::class, $result); + $this->expectsRequest('get', '/v1/radar/value_lists'); + $result = $this->client->radar->valueLists->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result->data[0]); } - public function testRetrieveApplicationFee() + public function testCreateValueList() { - $this->expectsRequest('get', '/v1/application_fees/fee_xxxxxxxxxxxxx'); - $result = $this->client->applicationFees->retrieve('fee_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\ApplicationFee::class, $result); + $this->expectsRequest('post', '/v1/radar/value_lists'); + $result = $this->client->radar->valueLists->create( + [ + 'alias' => 'custom_ip_xxxxxxxxxxxxx', + 'name' => 'Custom IP Blocklist', + 'item_type' => 'ip_address', + ] + ); + static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); } - public function testListApplicationFee() + public function testDeleteValueList() { - $this->expectsRequest('get', '/v1/application_fees'); - $result = $this->client->applicationFees->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\ApplicationFee::class, $result->data[0]); + $this->expectsRequest('delete', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); + $result = $this->client->radar->valueLists->delete('rsl_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); } - public function testCreateApplicationFeeRefund() + public function testRetrieveValueList() { - $this->expectsRequest( - 'post', - '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds' - ); - $result = $this->client->applicationFees->createRefund( - 'fee_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); + $result = $this->client->radar->valueLists->retrieve( + 'rsl_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); + static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); } - public function testRetrieveApplicationFeeRefund() + public function testUpdateValueList() { - $this->expectsRequest( - 'get', - '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx' - ); - $result = $this->client->applicationFees->retrieveRefund( - 'fee_xxxxxxxxxxxxx', - 'fr_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); + $result = $this->client->radar->valueLists->update( + 'rsl_xxxxxxxxxxxxx', + ['name' => 'Updated IP Block List'] ); - static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); + static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); } - public function testUpdateApplicationFeeRefund() + public function testListRefund() { - $this->expectsRequest( - 'post', - '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx' - ); - $result = $this->client->applicationFees->updateRefund( - 'fee_xxxxxxxxxxxxx', - 'fr_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); + $this->expectsRequest('get', '/v1/refunds'); + $result = $this->client->refunds->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Refund::class, $result->data[0]); } - public function testListApplicationFeeRefund() + public function testCreateRefund() { - $this->expectsRequest( - 'get', - '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds' - ); - $result = $this->client->applicationFees->allRefunds( - 'fee_xxxxxxxxxxxxx', - ['limit' => 3] - ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result->data[0]); + $this->expectsRequest('post', '/v1/refunds'); + $result = $this->client->refunds->create(['charge' => 'ch_xxxxxxxxxxxxx']); + static::assertInstanceOf(\Stripe\Refund::class, $result); } - public function testRetrieveCapability() + public function testRetrieveRefund() { - $this->expectsRequest( - 'get', - '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments' - ); - $result = $this->client->accounts->retrieveCapability( - 'acct_xxxxxxxxxxxxx', - 'card_payments', - [] - ); - static::assertInstanceOf(\Stripe\Capability::class, $result); + $this->expectsRequest('get', '/v1/refunds/re_xxxxxxxxxxxxx'); + $result = $this->client->refunds->retrieve('re_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Refund::class, $result); } - public function testUpdateCapability() + public function testUpdateRefund() { - $this->expectsRequest( - 'post', - '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments' - ); - $result = $this->client->accounts->updateCapability( - 'acct_xxxxxxxxxxxxx', - 'card_payments', - ['requested' => true] + $this->expectsRequest('post', '/v1/refunds/re_xxxxxxxxxxxxx'); + $result = $this->client->refunds->update( + 're_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Capability::class, $result); + static::assertInstanceOf(\Stripe\Refund::class, $result); } - public function testListCapability() + public function testCancelRefund() { - $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]); + $this->expectsRequest('post', '/v1/refunds/re_xxxxxxxxxxxxx/cancel'); + $result = $this->client->refunds->cancel('re_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Refund::class, $result); } - public function testListCountrySpec() + public function testListReportRun() { - $this->expectsRequest('get', '/v1/country_specs'); - $result = $this->client->countrySpecs->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/reporting/report_runs'); + $result = $this->client->reporting->reportRuns->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CountrySpec::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result->data[0]); } - public function testRetrieveCountrySpec() + public function testCreateReportRun() { - $this->expectsRequest('get', '/v1/country_specs/US'); - $result = $this->client->countrySpecs->retrieve('US', []); - static::assertInstanceOf(\Stripe\CountrySpec::class, $result); + $this->expectsRequest('post', '/v1/reporting/report_runs'); + $result = $this->client->reporting->reportRuns->create( + [ + 'report_type' => 'balance.summary.1', + 'parameters' => [ + 'interval_start' => 1522540800, + 'interval_end' => 1525132800, + ], + ] + ); + static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result); } - public function testCreatePerson() + public function testRetrieveReportRun() { - $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/persons'); - $result = $this->client->accounts->createPerson( - 'acct_xxxxxxxxxxxxx', - ['first_name' => 'Jane', 'last_name' => 'Diaz'] + $this->expectsRequest('get', '/v1/reporting/report_runs/frr_xxxxxxxxxxxxx'); + $result = $this->client->reporting->reportRuns->retrieve( + 'frr_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Person::class, $result); + static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result); } - public function testRetrievePerson() + public function testListReportType() + { + $this->expectsRequest('get', '/v1/reporting/report_types'); + $result = $this->client->reporting->reportTypes->all([]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Reporting\ReportType::class, $result->data[0]); + } + + public function testRetrieveReportType() { $this->expectsRequest( 'get', - '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' + '/v1/reporting/report_types/balance.summary.1' ); - $result = $this->client->accounts->retrievePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx', + $result = $this->client->reporting->reportTypes->retrieve( + 'balance.summary.1', [] ); - static::assertInstanceOf(\Stripe\Person::class, $result); + static::assertInstanceOf(\Stripe\Reporting\ReportType::class, $result); } - public function testUpdatePerson() + public function testListReview() { - $this->expectsRequest( - 'post', - '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' - ); - $result = $this->client->accounts->updatePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Person::class, $result); + $this->expectsRequest('get', '/v1/reviews'); + $result = $this->client->reviews->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Review::class, $result->data[0]); + } + + public function testRetrieveReview() + { + $this->expectsRequest('get', '/v1/reviews/prv_xxxxxxxxxxxxx'); + $result = $this->client->reviews->retrieve('prv_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Review::class, $result); + } + + public function testApproveReview() + { + $this->expectsRequest('post', '/v1/reviews/prv_xxxxxxxxxxxxx/approve'); + $result = $this->client->reviews->approve('prv_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Review::class, $result); } - public function testDeletePerson() + public function testListSetupAttempt() { - $this->expectsRequest( - 'delete', - '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' - ); - $result = $this->client->accounts->deletePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Person::class, $result); + $this->expectsRequest('get', '/v1/setup_attempts'); + $result = $this->client->setupAttempts->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\SetupAttempt::class, $result->data[0]); } - public function testListPerson() + public function testListSetupIntent() { - $this->expectsRequest('get', '/v1/accounts/acct_xxxxxxxxxxxxx/persons'); - $result = $this->client->accounts->allPersons( - 'acct_xxxxxxxxxxxxx', - ['limit' => 3] - ); + $this->expectsRequest('get', '/v1/setup_intents'); + $result = $this->client->setupIntents->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Person::class, $result->data[0]); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result->data[0]); } - public function testCreateTopup() + public function testCreateSetupIntent() { - $this->expectsRequest('post', '/v1/topups'); - $result = $this->client->topups->create( - [ - 'amount' => 2000, - 'currency' => 'usd', - 'description' => 'Top-up for Jenny Rosen', - 'statement_descriptor' => 'Top-up', - ] + $this->expectsRequest('post', '/v1/setup_intents'); + $result = $this->client->setupIntents->create( + ['payment_method_types' => ['card']] ); - static::assertInstanceOf(\Stripe\Topup::class, $result); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testRetrieveTopup() + public function testRetrieveSetupIntent() { - $this->expectsRequest('get', '/v1/topups/tu_xxxxxxxxxxxxx'); - $result = $this->client->topups->retrieve('tu_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Topup::class, $result); + $this->expectsRequest('get', '/v1/setup_intents/seti_xxxxxxxxxxxxx'); + $result = $this->client->setupIntents->retrieve('seti_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testUpdateTopup() + public function testUpdateSetupIntent() { - $this->expectsRequest('post', '/v1/topups/tu_xxxxxxxxxxxxx'); - $result = $this->client->topups->update( - 'tu_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest('post', '/v1/setup_intents/seti_xxxxxxxxxxxxx'); + $result = $this->client->setupIntents->update( + 'seti_xxxxxxxxxxxxx', + ['metadata' => ['user_id' => '3435453']] ); - static::assertInstanceOf(\Stripe\Topup::class, $result); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testListTopup() + public function testCancelSetupIntent() { - $this->expectsRequest('get', '/v1/topups'); - $result = $this->client->topups->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Topup::class, $result->data[0]); + $this->expectsRequest( + 'post', + '/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel' + ); + $result = $this->client->setupIntents->cancel('seti_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testCancelTopup() + public function testConfirmSetupIntent() { - $this->expectsRequest('post', '/v1/topups/tu_xxxxxxxxxxxxx/cancel'); - $result = $this->client->topups->cancel('tu_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Topup::class, $result); + $this->expectsRequest( + 'post', + '/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm' + ); + $result = $this->client->setupIntents->confirm( + 'seti_xxxxxxxxxxxxx', + ['payment_method' => 'pm_card_visa'] + ); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testCreateTransfer() + public function testListShippingRate2() { - $this->expectsRequest('post', '/v1/transfers'); - $result = $this->client->transfers->create( + $this->expectsRequest('get', '/v1/shipping_rates'); + $result = $this->client->shippingRates->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result->data[0]); + } + + public function testCreateShippingRate2() + { + $this->expectsRequest('post', '/v1/shipping_rates'); + $result = $this->client->shippingRates->create( [ - 'amount' => 400, - 'currency' => 'usd', - 'destination' => 'acct_xxxxxxxxxxxxx', - 'transfer_group' => 'ORDER_95', + 'display_name' => 'Ground shipping', + 'type' => 'fixed_amount', + 'fixed_amount' => ['amount' => 500, 'currency' => 'usd'], ] ); - static::assertInstanceOf(\Stripe\Transfer::class, $result); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result); } - public function testRetrieveTransfer() + public function testRetrieveShippingRate() { - $this->expectsRequest('get', '/v1/transfers/tr_xxxxxxxxxxxxx'); - $result = $this->client->transfers->retrieve('tr_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Transfer::class, $result); + $this->expectsRequest('get', '/v1/shipping_rates/shr_xxxxxxxxxxxxx'); + $result = $this->client->shippingRates->retrieve('shr_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result); } - public function testUpdateTransfer() + public function testUpdateShippingRate() { - $this->expectsRequest('post', '/v1/transfers/tr_xxxxxxxxxxxxx'); - $result = $this->client->transfers->update( - 'tr_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/shipping_rates/shr_xxxxxxxxxxxxx'); + $result = $this->client->shippingRates->update( + 'shr_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Transfer::class, $result); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result); } - public function testListTransfer() + public function testListScheduledQueryRun() { - $this->expectsRequest('get', '/v1/transfers'); - $result = $this->client->transfers->all(['limit' => 3]); + $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\Transfer::class, $result->data[0]); - } - - public function testCreateTransferReversal() - { - $this->expectsRequest('post', '/v1/transfers/tr_xxxxxxxxxxxxx/reversals'); - $result = $this->client->transfers->createReversal( - 'tr_xxxxxxxxxxxxx', - ['amount' => 100] - ); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result); + static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result->data[0]); } - public function testRetrieveTransferReversal() + public function testRetrieveScheduledQueryRun() { $this->expectsRequest( 'get', - '/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx' + '/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx' ); - $result = $this->client->transfers->retrieveReversal( - 'tr_xxxxxxxxxxxxx', - 'trr_xxxxxxxxxxxxx', + $result = $this->client->sigma->scheduledQueryRuns->retrieve( + 'sqr_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result); + static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result); } - public function testUpdateTransferReversal() + public function testListSku() { - $this->expectsRequest( - 'post', - '/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx' - ); - $result = $this->client->transfers->updateReversal( - 'tr_xxxxxxxxxxxxx', - 'trr_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result); + $this->expectsRequest('get', '/v1/skus'); + $result = $this->client->skus->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\SKU::class, $result->data[0]); } - public function testListTransferReversal() + public function testCreateSku() { - $this->expectsRequest('get', '/v1/transfers/tr_xxxxxxxxxxxxx/reversals'); - $result = $this->client->transfers->allReversals( - 'tr_xxxxxxxxxxxxx', - ['limit' => 3] + $this->expectsRequest('post', '/v1/skus'); + $result = $this->client->skus->create( + [ + 'attributes' => ['size' => 'Medium', 'gender' => 'Unisex'], + 'price' => 1500, + 'currency' => 'usd', + 'inventory' => ['type' => 'finite', 'quantity' => 500], + 'product' => 'prod_xxxxxxxxxxxxx', + ] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result->data[0]); + static::assertInstanceOf(\Stripe\SKU::class, $result); } - public function testRetrieveEarlyFraudWarning() + public function testDeleteSku() { - $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); + $this->expectsRequest('delete', '/v1/skus/sku_xxxxxxxxxxxxx'); + $result = $this->client->skus->delete('sku_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\SKU::class, $result); } - public function testListEarlyFraudWarning() + public function testRetrieveSku() { - $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]); + $this->expectsRequest('get', '/v1/skus/sku_xxxxxxxxxxxxx'); + $result = $this->client->skus->retrieve('sku_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\SKU::class, $result); } - public function testApproveReview() + public function testUpdateSku() { - $this->expectsRequest('post', '/v1/reviews/prv_xxxxxxxxxxxxx/approve'); - $result = $this->client->reviews->approve('prv_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Review::class, $result); + $this->expectsRequest('post', '/v1/skus/sku_xxxxxxxxxxxxx'); + $result = $this->client->skus->update( + 'sku_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\SKU::class, $result); } - public function testRetrieveReview() + public function testRetrieveSource() { - $this->expectsRequest('get', '/v1/reviews/prv_xxxxxxxxxxxxx'); - $result = $this->client->reviews->retrieve('prv_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Review::class, $result); + $this->expectsRequest('get', '/v1/sources/src_xxxxxxxxxxxxx'); + $result = $this->client->sources->retrieve('src_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Source::class, $result); } - public function testListReview() + public function testRetrieveSource2() { - $this->expectsRequest('get', '/v1/reviews'); - $result = $this->client->reviews->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Review::class, $result->data[0]); + $this->expectsRequest('get', '/v1/sources/src_xxxxxxxxxxxxx'); + $result = $this->client->sources->retrieve('src_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Source::class, $result); } - public function testCreateValueList() + public function testUpdateSource() { - $this->expectsRequest('post', '/v1/radar/value_lists'); - $result = $this->client->radar->valueLists->create( - [ - 'alias' => 'custom_ip_xxxxxxxxxxxxx', - 'name' => 'Custom IP Blocklist', - 'item_type' => 'ip_address', - ] + $this->expectsRequest('post', '/v1/sources/src_xxxxxxxxxxxxx'); + $result = $this->client->sources->update( + 'src_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); + static::assertInstanceOf(\Stripe\Source::class, $result); } - public function testRetrieveValueList() + public function testListSubscriptionItem() { - $this->expectsRequest('get', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); - $result = $this->client->radar->valueLists->retrieve( - 'rsl_xxxxxxxxxxxxx', - [] + $this->expectsRequest('get', '/v1/subscription_items'); + $result = $this->client->subscriptionItems->all( + ['subscription' => 'sub_xxxxxxxxxxxxx'] ); - static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result->data[0]); } - public function testUpdateValueList() + public function testCreateSubscriptionItem() { - $this->expectsRequest('post', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); - $result = $this->client->radar->valueLists->update( - 'rsl_xxxxxxxxxxxxx', - ['name' => 'Updated IP Block List'] + $this->expectsRequest('post', '/v1/subscription_items'); + $result = $this->client->subscriptionItems->create( + [ + 'subscription' => 'sub_xxxxxxxxxxxxx', + 'price' => 'price_xxxxxxxxxxxxx', + 'quantity' => 2, + ] ); - static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); } - public function testDeleteValueList() + public function testDeleteSubscriptionItem() { - $this->expectsRequest('delete', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); - $result = $this->client->radar->valueLists->delete('rsl_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); + $this->expectsRequest('delete', '/v1/subscription_items/si_xxxxxxxxxxxxx'); + $result = $this->client->subscriptionItems->delete('si_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); } - public function testListValueList() + public function testRetrieveSubscriptionItem() { - $this->expectsRequest('get', '/v1/radar/value_lists'); - $result = $this->client->radar->valueLists->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result->data[0]); + $this->expectsRequest('get', '/v1/subscription_items/si_xxxxxxxxxxxxx'); + $result = $this->client->subscriptionItems->retrieve( + 'si_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); } - public function testCreateValueListItem() + public function testUpdateSubscriptionItem() { - $this->expectsRequest('post', '/v1/radar/value_list_items'); - $result = $this->client->radar->valueListItems->create( - ['value_list' => 'rsl_xxxxxxxxxxxxx', 'value' => '1.2.3.4'] + $this->expectsRequest('post', '/v1/subscription_items/si_xxxxxxxxxxxxx'); + $result = $this->client->subscriptionItems->update( + 'si_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); } - public function testRetrieveValueListItem() + public function testListUsageRecordSummary() { $this->expectsRequest( 'get', - '/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx' + '/v1/subscription_items/si_xxxxxxxxxxxxx/usage_record_summaries' ); - $result = $this->client->radar->valueListItems->retrieve( - 'rsli_xxxxxxxxxxxxx', - [] + $result = $this->client->subscriptionItems->allUsageRecordSummaries( + 'si_xxxxxxxxxxxxx', + ['limit' => 3] ); - static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\UsageRecordSummary::class, $result->data[0]); } - public function testDeleteValueListItem() + public function testCreateUsageRecord() { $this->expectsRequest( - 'delete', - '/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx' + 'post', + '/v1/subscription_items/si_xxxxxxxxxxxxx/usage_records' ); - $result = $this->client->radar->valueListItems->delete( - 'rsli_xxxxxxxxxxxxx', - [] + $result = $this->client->subscriptionItems->createUsageRecord( + 'si_xxxxxxxxxxxxx', + ['quantity' => 100, 'timestamp' => 1571252444] ); - static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + static::assertInstanceOf(\Stripe\UsageRecord::class, $result); } - public function testListValueListItem() + public function testListSubscriptionSchedule() { - $this->expectsRequest('get', '/v1/radar/value_list_items'); - $result = $this->client->radar->valueListItems->all( - ['limit' => 3, 'value_list' => 'rsl_xxxxxxxxxxxxx'] - ); + $this->expectsRequest('get', '/v1/subscription_schedules'); + $result = $this->client->subscriptionSchedules->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result->data[0]); } - public function testRetrieveAuthorization() + public function testCreateSubscriptionSchedule() + { + $this->expectsRequest('post', '/v1/subscription_schedules'); + $result = $this->client->subscriptionSchedules->create( + [ + 'customer' => 'cus_xxxxxxxxxxxxx', + 'start_date' => 1652909005, + 'end_behavior' => 'release', + 'phases' => [ + [ + 'items' => [['price' => 'price_xxxxxxxxxxxxx', 'quantity' => 1]], + 'iterations' => 12, + ], + ], + ] + ); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + } + + public function testRetrieveSubscriptionSchedule() { $this->expectsRequest( 'get', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' + '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx' ); - $result = $this->client->issuing->authorizations->retrieve( - 'iauth_xxxxxxxxxxxxx', + $result = $this->client->subscriptionSchedules->retrieve( + 'sub_sched_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); } - public function testUpdateAuthorization() + public function testUpdateSubscriptionSchedule() { $this->expectsRequest( 'post', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' + '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx' ); - $result = $this->client->issuing->authorizations->update( - 'iauth_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $result = $this->client->subscriptionSchedules->update( + 'sub_sched_xxxxxxxxxxxxx', + ['end_behavior' => 'release'] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); } - public function testApproveAuthorization() + public function testCancelSubscriptionSchedule() { $this->expectsRequest( 'post', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve' + '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel' ); - $result = $this->client->issuing->authorizations->approve( - 'iauth_xxxxxxxxxxxxx', + $result = $this->client->subscriptionSchedules->cancel( + 'sub_sched_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); } - public function testDeclineAuthorization() + public function testReleaseSubscriptionSchedule() { $this->expectsRequest( 'post', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline' + '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/release' ); - $result = $this->client->issuing->authorizations->decline( - 'iauth_xxxxxxxxxxxxx', + $result = $this->client->subscriptionSchedules->release( + 'sub_sched_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); } - public function testListAuthorization() + public function testListSubscription() { - $this->expectsRequest('get', '/v1/issuing/authorizations'); - $result = $this->client->issuing->authorizations->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/subscriptions'); + $result = $this->client->subscriptions->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Subscription::class, $result->data[0]); } - public function testCreateCardholder() + public function testCreateSubscription() { - $this->expectsRequest('post', '/v1/issuing/cardholders'); - $result = $this->client->issuing->cardholders->create( + $this->expectsRequest('post', '/v1/subscriptions'); + $result = $this->client->subscriptions->create( [ - 'type' => 'individual', - 'name' => 'Jenny Rosen', - 'email' => 'jenny.rosen@example.com', - 'phone_number' => '+18888675309', - 'billing' => [ - 'address' => [ - 'line1' => '1234 Main Street', - 'city' => 'San Francisco', - 'state' => 'CA', - 'country' => 'US', - 'postal_code' => '94111', - ], - ], + 'customer' => 'cus_xxxxxxxxxxxxx', + 'items' => [['price' => 'price_xxxxxxxxxxxxx']], ] ); - static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); + static::assertInstanceOf(\Stripe\Subscription::class, $result); } - public function testRetrieveCardholder() + public function testCancelSubscription() { - $this->expectsRequest('get', '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx'); - $result = $this->client->issuing->cardholders->retrieve( - 'ich_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); + $this->expectsRequest('delete', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); + $result = $this->client->subscriptions->cancel('sub_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Subscription::class, $result); } - public function testUpdateCardholder() + public function testRetrieveSubscription() { - $this->expectsRequest('post', '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx'); - $result = $this->client->issuing->cardholders->update( - 'ich_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); + $this->expectsRequest('get', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); + $result = $this->client->subscriptions->retrieve('sub_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Subscription::class, $result); } - public function testListCardholder() + public function testUpdateSubscription() { - $this->expectsRequest('get', '/v1/issuing/cardholders'); - $result = $this->client->issuing->cardholders->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result->data[0]); + $this->expectsRequest('post', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); + $result = $this->client->subscriptions->update( + 'sub_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Subscription::class, $result); } - public function testCreateCard() + public function testSearchSubscription() { - $this->expectsRequest('post', '/v1/issuing/cards'); - $result = $this->client->issuing->cards->create( - [ - 'cardholder' => 'ich_xxxxxxxxxxxxx', - 'currency' => 'usd', - 'type' => 'virtual', - ] + $this->expectsRequest('get', '/v1/subscriptions/search'); + $result = $this->client->subscriptions->search( + ['query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\''] ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Subscription","namespaces":[]}} } - public function testRetrieveCard() + public function testListTaxCode() { - $this->expectsRequest('get', '/v1/issuing/cards/ic_xxxxxxxxxxxxx'); - $result = $this->client->issuing->cards->retrieve('ic_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + $this->expectsRequest('get', '/v1/tax_codes'); + $result = $this->client->taxCodes->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\TaxCode::class, $result->data[0]); } - public function testUpdateCard() - { - $this->expectsRequest('post', '/v1/issuing/cards/ic_xxxxxxxxxxxxx'); - $result = $this->client->issuing->cards->update( - 'ic_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + public function testRetrieveTaxCode() + { + $this->expectsRequest('get', '/v1/tax_codes/txcd_xxxxxxxxxxxxx'); + $result = $this->client->taxCodes->retrieve('txcd_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\TaxCode::class, $result); } - public function testListCard() + public function testListTaxRate() { - $this->expectsRequest('get', '/v1/issuing/cards'); - $result = $this->client->issuing->cards->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/tax_rates'); + $result = $this->client->taxRates->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TaxRate::class, $result->data[0]); } - public function testCreateDispute() + public function testCreateTaxRate() { - $this->expectsRequest('post', '/v1/issuing/disputes'); - $result = $this->client->issuing->disputes->create( + $this->expectsRequest('post', '/v1/tax_rates'); + $result = $this->client->taxRates->create( [ - 'transaction' => 'ipi_xxxxxxxxxxxxx', - 'evidence' => [ - 'reason' => 'fraudulent', - 'fraudulent' => ['explanation' => 'Purchase was unrecognized.'], - ], + 'display_name' => 'VAT', + 'description' => 'VAT Germany', + 'jurisdiction' => 'DE', + 'percentage' => 16, + 'inclusive' => false, ] ); - static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); - } - - public function testSubmitDispute() - { - $this->expectsRequest( - 'post', - '/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit' - ); - $result = $this->client->issuing->disputes->submit('idp_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); + static::assertInstanceOf(\Stripe\TaxRate::class, $result); } - public function testRetrieveDispute2() + public function testRetrieveTaxRate() { - $this->expectsRequest('get', '/v1/issuing/disputes/idp_xxxxxxxxxxxxx'); - $result = $this->client->issuing->disputes->retrieve( - 'idp_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); + $this->expectsRequest('get', '/v1/tax_rates/txr_xxxxxxxxxxxxx'); + $result = $this->client->taxRates->retrieve('txr_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\TaxRate::class, $result); } - public function testUpdateDispute2() + public function testUpdateTaxRate() { - $this->expectsRequest('post', '/v1/issuing/disputes/idp_xxxxxxxxxxxxx'); - $result = $this->client->issuing->disputes->update( - 'idp_xxxxxxxxxxxxx', - [ - 'evidence' => [ - 'reason' => 'not_received', - 'not_received' => [ - 'expected_at' => 1590000000, - 'explanation' => '', - 'product_description' => 'Baseball cap', - 'product_type' => 'merchandise', - ], - ], - ] + $this->expectsRequest('post', '/v1/tax_rates/txr_xxxxxxxxxxxxx'); + $result = $this->client->taxRates->update( + 'txr_xxxxxxxxxxxxx', + ['active' => false] ); - static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); + static::assertInstanceOf(\Stripe\TaxRate::class, $result); } - public function testListDispute2() + public function testListConfiguration3() { - $this->expectsRequest('get', '/v1/issuing/disputes'); - $result = $this->client->issuing->disputes->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/terminal/configurations'); + $result = $this->client->terminal->configurations->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result->data[0]); } - public function testRetrieveTransaction() + public function testDeleteConfiguration2() { - $this->expectsRequest('get', '/v1/issuing/transactions/ipi_xxxxxxxxxxxxx'); - $result = $this->client->issuing->transactions->retrieve( - 'ipi_xxxxxxxxxxxxx', + $this->expectsRequest( + 'delete', + '/v1/terminal/configurations/tmc_xxxxxxxxxxxxx' + ); + $result = $this->client->terminal->configurations->delete( + 'tmc_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); } - public function testUpdateTransaction() + public function testRetrieveConfiguration3() { - $this->expectsRequest('post', '/v1/issuing/transactions/ipi_xxxxxxxxxxxxx'); - $result = $this->client->issuing->transactions->update( - 'ipi_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'get', + '/v1/terminal/configurations/tmc_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); + $result = $this->client->terminal->configurations->retrieve( + 'tmc_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); } - public function testListTransaction() + public function testUpdateConfiguration3() { - $this->expectsRequest('get', '/v1/issuing/transactions'); - $result = $this->client->issuing->transactions->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result->data[0]); + $this->expectsRequest( + 'post', + '/v1/terminal/configurations/tmc_xxxxxxxxxxxxx' + ); + $result = $this->client->terminal->configurations->update( + 'tmc_xxxxxxxxxxxxx', + ['bbpos_wisepos_e' => ['splashscreen' => 'file_xxxxxxxxxxxxx']] + ); + static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); } public function testCreateConnectionToken() @@ -3060,6 +3164,14 @@ public function testCreateConnectionToken() static::assertInstanceOf(\Stripe\Terminal\ConnectionToken::class, $result); } + public function testListLocation() + { + $this->expectsRequest('get', '/v1/terminal/locations'); + $result = $this->client->terminal->locations->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Location::class, $result->data[0]); + } + public function testCreateLocation() { $this->expectsRequest('post', '/v1/terminal/locations'); @@ -3077,6 +3189,16 @@ public function testCreateLocation() static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); } + public function testDeleteLocation() + { + $this->expectsRequest('delete', '/v1/terminal/locations/tml_xxxxxxxxxxxxx'); + $result = $this->client->terminal->locations->delete( + 'tml_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); + } + public function testRetrieveLocation() { $this->expectsRequest('get', '/v1/terminal/locations/tml_xxxxxxxxxxxxx'); @@ -3097,22 +3219,12 @@ public function testUpdateLocation() static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); } - public function testDeleteLocation() - { - $this->expectsRequest('delete', '/v1/terminal/locations/tml_xxxxxxxxxxxxx'); - $result = $this->client->terminal->locations->delete( - 'tml_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); - } - - public function testListLocation() + public function testListReader() { - $this->expectsRequest('get', '/v1/terminal/locations'); - $result = $this->client->terminal->locations->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/terminal/readers'); + $result = $this->client->terminal->readers->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Terminal\Location::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result->data[0]); } public function testCreateReader() @@ -3128,26 +3240,6 @@ public function testCreateReader() static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testRetrieveReader() - { - $this->expectsRequest('get', '/v1/terminal/readers/tmr_xxxxxxxxxxxxx'); - $result = $this->client->terminal->readers->retrieve( - 'tmr_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); - } - - public function testUpdateReader() - { - $this->expectsRequest('post', '/v1/terminal/readers/tmr_xxxxxxxxxxxxx'); - $result = $this->client->terminal->readers->update( - 'tmr_xxxxxxxxxxxxx', - ['label' => 'Blue Rabbit'] - ); - static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); - } - public function testDeleteReader() { $this->expectsRequest('delete', '/v1/terminal/readers/tmr_xxxxxxxxxxxxx'); @@ -3155,416 +3247,320 @@ public function testDeleteReader() static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testListReader() - { - $this->expectsRequest('get', '/v1/terminal/readers'); - $result = $this->client->terminal->readers->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result->data[0]); - } - - public function testProcessPaymentIntentReader() - { - $this->expectsRequest( - 'post', - '/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_payment_intent' - ); - $result = $this->client->terminal->readers->processPaymentIntent( - 'tmr_xxxxxxxxxxxxx', - ['payment_intent' => 'pi_xxxxxxxxxxxxx'] - ); - static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); - } - - public function testProcessSetupIntentReader() - { - $this->expectsRequest( - 'post', - '/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent' - ); - $result = $this->client->terminal->readers->processSetupIntent( - 'tmr_xxxxxxxxxxxxx', - [ - 'setup_intent' => 'seti_xxxxxxxxxxxxx', - 'customer_consent_collected' => true, - ] - ); - static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); - } - - public function testCancelActionReader() - { - $this->expectsRequest( - 'post', - '/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action' - ); - $result = $this->client->terminal->readers->cancelAction( - 'tmr_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); - } - - public function testRetrieveConfiguration3() - { - $this->expectsRequest( - 'get', - '/v1/terminal/configurations/tmc_xxxxxxxxxxxxx' - ); - $result = $this->client->terminal->configurations->retrieve( - 'tmc_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); - } - - public function testUpdateConfiguration3() - { - $this->expectsRequest( - 'post', - '/v1/terminal/configurations/tmc_xxxxxxxxxxxxx' - ); - $result = $this->client->terminal->configurations->update( - 'tmc_xxxxxxxxxxxxx', - ['bbpos_wisepos_e' => ['splashscreen' => 'file_xxxxxxxxxxxxx']] - ); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); - } - - public function testDeleteConfiguration2() - { - $this->expectsRequest( - 'delete', - '/v1/terminal/configurations/tmc_xxxxxxxxxxxxx' - ); - $result = $this->client->terminal->configurations->delete( - 'tmc_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); - } - - public function testListConfiguration3() + public function testRetrieveReader() { - $this->expectsRequest('get', '/v1/terminal/configurations'); - $result = $this->client->terminal->configurations->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result->data[0]); + $this->expectsRequest('get', '/v1/terminal/readers/tmr_xxxxxxxxxxxxx'); + $result = $this->client->terminal->readers->retrieve( + 'tmr_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testCreateFinancialAccount() + public function testUpdateReader() { - $this->expectsRequest('post', '/v1/treasury/financial_accounts'); - $result = $this->client->treasury->financialAccounts->create( - ['supported_currencies' => ['usd'], 'features' => []] + $this->expectsRequest('post', '/v1/terminal/readers/tmr_xxxxxxxxxxxxx'); + $result = $this->client->terminal->readers->update( + 'tmr_xxxxxxxxxxxxx', + ['label' => 'Blue Rabbit'] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testUpdateFinancialAccount() + public function testCancelActionReader() { $this->expectsRequest( 'post', - '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' + '/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action' ); - $result = $this->client->treasury->financialAccounts->update( - 'fa_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $result = $this->client->terminal->readers->cancelAction( + 'tmr_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testRetrieveFinancialAccount() + public function testProcessPaymentIntentReader() { $this->expectsRequest( - 'get', - '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' + 'post', + '/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_payment_intent' ); - $result = $this->client->treasury->financialAccounts->retrieve( - 'fa_xxxxxxxxxxxxx', - [] + $result = $this->client->terminal->readers->processPaymentIntent( + 'tmr_xxxxxxxxxxxxx', + ['payment_intent' => 'pi_xxxxxxxxxxxxx'] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testListFinancialAccount() + public function testListTestClock2() { - $this->expectsRequest('get', '/v1/treasury/financial_accounts'); - $result = $this->client->treasury->financialAccounts->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/test_helpers/test_clocks'); + $result = $this->client->testHelpers->testClocks->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result->data[0]); } - public function testUpdateFeaturesFinancialAccount() + public function testCreateTestClock2() + { + $this->expectsRequest('post', '/v1/test_helpers/test_clocks'); + $result = $this->client->testHelpers->testClocks->create( + ['frozen_time' => 1577836800] + ); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + } + + public function testDeleteTestClock2() { $this->expectsRequest( - 'post', - '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features' + 'delete', + '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->financialAccounts->updateFeatures( - 'fa_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->testClocks->delete( + 'clock_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccountFeatures::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testRetrieveFeaturesFinancialAccount() + public function testRetrieveTestClock2() { $this->expectsRequest( 'get', - '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features' + '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->financialAccounts->retrieveFeatures( - 'fa_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->testClocks->retrieve( + 'clock_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccountFeatures::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testRetrieveTransaction2() + public function testAdvanceTestClock2() { $this->expectsRequest( - 'get', - '/v1/treasury/transactions/trxn_xxxxxxxxxxxxx' + 'post', + '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx/advance' ); - $result = $this->client->treasury->transactions->retrieve( - 'trxn_xxxxxxxxxxxxx', - [] + $result = $this->client->testHelpers->testClocks->advance( + 'clock_xxxxxxxxxxxxx', + ['frozen_time' => 1652390605] ); - static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testListTransaction2() + public function testCreateToken2() { - $this->expectsRequest('get', '/v1/treasury/transactions'); - $result = $this->client->treasury->transactions->all( - ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create( + [ + 'bank_account' => [ + 'country' => 'US', + 'currency' => 'usd', + 'account_holder_name' => 'Jenny Rosen', + 'account_holder_type' => 'individual', + 'routing_number' => '110000000', + 'account_number' => '000123456789', + ], + ] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testRetrieveTransactionEntry() + public function testCreateToken3() { - $this->expectsRequest( - 'get', - '/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx' - ); - $result = $this->client->treasury->transactionEntries->retrieve( - 'trxne_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create( + ['pii' => ['id_number' => '000000000']] ); - static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testListTransactionEntry() + public function testCreateToken4() { - $this->expectsRequest('get', '/v1/treasury/transaction_entries'); - $result = $this->client->treasury->transactionEntries->all( - ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create( + [ + 'account' => [ + 'individual' => ['first_name' => 'Jane', 'last_name' => 'Doe'], + 'tos_shown_and_accepted' => true, + ], + ] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testCreateOutboundTransfer() + public function testCreateToken5() { - $this->expectsRequest('post', '/v1/treasury/outbound_transfers'); - $result = $this->client->treasury->outboundTransfers->create( + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create( [ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', - 'amount' => 500, - 'currency' => 'usd', - 'description' => 'OutboundTransfer to my external bank account', + 'person' => [ + 'first_name' => 'Jane', + 'last_name' => 'Doe', + 'relationship' => ['owner' => true], + ], ] ); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testCancelOutboundTransfer() + public function testCreateToken6() { - $this->expectsRequest( - 'post', - '/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx/cancel' - ); - $result = $this->client->treasury->outboundTransfers->cancel( - 'obt_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create(['cvc_update' => ['cvc' => '123']]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testRetrieveOutboundTransfer() + public function testRetrieveToken() { - $this->expectsRequest( - 'get', - '/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx' - ); - $result = $this->client->treasury->outboundTransfers->retrieve( - 'obt_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); + $this->expectsRequest('get', '/v1/tokens/tok_xxxx'); + $result = $this->client->tokens->retrieve('tok_xxxx', []); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testListOutboundTransfer() + public function testListTopup() { - $this->expectsRequest('get', '/v1/treasury/outbound_transfers'); - $result = $this->client->treasury->outboundTransfers->all( - ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] - ); + $this->expectsRequest('get', '/v1/topups'); + $result = $this->client->topups->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Topup::class, $result->data[0]); } - public function testCreateOutboundPayment() + public function testCreateTopup() { - $this->expectsRequest('post', '/v1/treasury/outbound_payments'); - $result = $this->client->treasury->outboundPayments->create( + $this->expectsRequest('post', '/v1/topups'); + $result = $this->client->topups->create( [ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'amount' => 10000, + 'amount' => 2000, 'currency' => 'usd', - 'customer' => 'cu_xxxxxxxxxxxxx', - 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', - 'description' => 'OutboundPayment to a 3rd party', + 'description' => 'Top-up for Jenny Rosen', + 'statement_descriptor' => 'Top-up', ] ); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + static::assertInstanceOf(\Stripe\Topup::class, $result); } - public function testCancelOutboundPayment() + public function testRetrieveTopup() { - $this->expectsRequest( - 'post', - '/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx/cancel' - ); - $result = $this->client->treasury->outboundPayments->cancel( - 'obp_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + $this->expectsRequest('get', '/v1/topups/tu_xxxxxxxxxxxxx'); + $result = $this->client->topups->retrieve('tu_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Topup::class, $result); } - public function testRetrieveOutboundPayment() + public function testUpdateTopup() { - $this->expectsRequest( - 'get', - '/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx' - ); - $result = $this->client->treasury->outboundPayments->retrieve( - 'obp_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/topups/tu_xxxxxxxxxxxxx'); + $result = $this->client->topups->update( + 'tu_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + static::assertInstanceOf(\Stripe\Topup::class, $result); + } + + public function testCancelTopup() + { + $this->expectsRequest('post', '/v1/topups/tu_xxxxxxxxxxxxx/cancel'); + $result = $this->client->topups->cancel('tu_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Topup::class, $result); } - public function testListOutboundPayment() + public function testListTransfer() { - $this->expectsRequest('get', '/v1/treasury/outbound_payments'); - $result = $this->client->treasury->outboundPayments->all( - ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] - ); + $this->expectsRequest('get', '/v1/transfers'); + $result = $this->client->transfers->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Transfer::class, $result->data[0]); } - public function testCreateInboundTransfer() + public function testCreateTransfer() { - $this->expectsRequest('post', '/v1/treasury/inbound_transfers'); - $result = $this->client->treasury->inboundTransfers->create( + $this->expectsRequest('post', '/v1/transfers'); + $result = $this->client->transfers->create( [ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'amount' => 10000, + 'amount' => 400, 'currency' => 'usd', - 'origin_payment_method' => 'pm_xxxxxxxxxxxxx', - 'description' => 'InboundTransfer from my bank account', + 'destination' => 'acct_xxxxxxxxxxxxx', + 'transfer_group' => 'ORDER_95', ] ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Transfer::class, $result); } - public function testRetrieveInboundTransfer() + public function testRetrieveTransfer() { - $this->expectsRequest( - 'get', - '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx' - ); - $result = $this->client->treasury->inboundTransfers->retrieve( - 'ibt_xxxxxxxxxxxxx', - [] + $this->expectsRequest('get', '/v1/transfers/tr_xxxxxxxxxxxxx'); + $result = $this->client->transfers->retrieve('tr_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Transfer::class, $result); + } + + public function testUpdateTransfer() + { + $this->expectsRequest('post', '/v1/transfers/tr_xxxxxxxxxxxxx'); + $result = $this->client->transfers->update( + 'tr_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Transfer::class, $result); } - public function testListInboundTransfer() + public function testListTransferReversal() { - $this->expectsRequest('get', '/v1/treasury/inbound_transfers'); - $result = $this->client->treasury->inboundTransfers->all( - ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] + $this->expectsRequest('get', '/v1/transfers/tr_xxxxxxxxxxxxx/reversals'); + $result = $this->client->transfers->allReversals( + 'tr_xxxxxxxxxxxxx', + ['limit' => 3] ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TransferReversal::class, $result->data[0]); } - public function testCancelInboundTransfer() + public function testCreateTransferReversal() { - $this->expectsRequest( - 'post', - '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel' - ); - $result = $this->client->treasury->inboundTransfers->cancel( - 'ibt_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/transfers/tr_xxxxxxxxxxxxx/reversals'); + $result = $this->client->transfers->createReversal( + 'tr_xxxxxxxxxxxxx', + ['amount' => 100] ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\TransferReversal::class, $result); } - public function testRetrieveReceivedCredit() + public function testRetrieveTransferReversal() { $this->expectsRequest( 'get', - '/v1/treasury/received_credits/rc_xxxxxxxxxxxxx' + '/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->receivedCredits->retrieve( - 'rc_xxxxxxxxxxxxx', + $result = $this->client->transfers->retrieveReversal( + 'tr_xxxxxxxxxxxxx', + 'trr_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result); - } - - public function testListReceivedCredit() - { - $this->expectsRequest('get', '/v1/treasury/received_credits'); - $result = $this->client->treasury->receivedCredits->all( - ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] - ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TransferReversal::class, $result); } - public function testRetrieveReceivedDebit() + public function testUpdateTransferReversal() { $this->expectsRequest( - 'get', - '/v1/treasury/received_debits/rd_xxxxxxxxxxxxx' + 'post', + '/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->receivedDebits->retrieve( - 'rd_xxxxxxxxxxxxx', - [] + $result = $this->client->transfers->updateReversal( + 'tr_xxxxxxxxxxxxx', + 'trr_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result); + static::assertInstanceOf(\Stripe\TransferReversal::class, $result); } - public function testListReceivedDebit() + public function testListCreditReversal() { - $this->expectsRequest('get', '/v1/treasury/received_debits'); - $result = $this->client->treasury->receivedDebits->all( + $this->expectsRequest('get', '/v1/treasury/credit_reversals'); + $result = $this->client->treasury->creditReversals->all( ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result->data[0]); } public function testCreateCreditReversal() @@ -3589,14 +3585,14 @@ public function testRetrieveCreditReversal() static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result); } - public function testListCreditReversal() + public function testListDebitReversal() { - $this->expectsRequest('get', '/v1/treasury/credit_reversals'); - $result = $this->client->treasury->creditReversals->all( + $this->expectsRequest('get', '/v1/treasury/debit_reversals'); + $result = $this->client->treasury->debitReversals->all( ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result->data[0]); } public function testCreateDebitReversal() @@ -3621,301 +3617,334 @@ public function testRetrieveDebitReversal() static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result); } - public function testListDebitReversal() + public function testListFinancialAccount() { - $this->expectsRequest('get', '/v1/treasury/debit_reversals'); - $result = $this->client->treasury->debitReversals->all( - ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] - ); + $this->expectsRequest('get', '/v1/treasury/financial_accounts'); + $result = $this->client->treasury->financialAccounts->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result->data[0]); } - public function testCreateSku() + public function testCreateFinancialAccount() { - $this->expectsRequest('post', '/v1/skus'); - $result = $this->client->skus->create( - [ - 'attributes' => ['size' => 'Medium', 'gender' => 'Unisex'], - 'price' => 1500, - 'currency' => 'usd', - 'inventory' => ['type' => 'finite', 'quantity' => 500], - 'product' => 'prod_xxxxxxxxxxxxx', - ] + $this->expectsRequest('post', '/v1/treasury/financial_accounts'); + $result = $this->client->treasury->financialAccounts->create( + ['supported_currencies' => ['usd'], 'features' => []] ); - static::assertInstanceOf(\Stripe\SKU::class, $result); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); } - public function testRetrieveSku() + public function testRetrieveFinancialAccount() { - $this->expectsRequest('get', '/v1/skus/sku_xxxxxxxxxxxxx'); - $result = $this->client->skus->retrieve('sku_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\SKU::class, $result); + $this->expectsRequest( + 'get', + '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' + ); + $result = $this->client->treasury->financialAccounts->retrieve( + 'fa_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); } - public function testUpdateSku() + public function testUpdateFinancialAccount() { - $this->expectsRequest('post', '/v1/skus/sku_xxxxxxxxxxxxx'); - $result = $this->client->skus->update( - 'sku_xxxxxxxxxxxxx', + $this->expectsRequest( + 'post', + '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' + ); + $result = $this->client->treasury->financialAccounts->update( + 'fa_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\SKU::class, $result); - } - - public function testListSku() - { - $this->expectsRequest('get', '/v1/skus'); - $result = $this->client->skus->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SKU::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); } - public function testDeleteSku() + public function testRetrieveFeaturesFinancialAccount() { - $this->expectsRequest('delete', '/v1/skus/sku_xxxxxxxxxxxxx'); - $result = $this->client->skus->delete('sku_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\SKU::class, $result); + $this->expectsRequest( + 'get', + '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features' + ); + $result = $this->client->treasury->financialAccounts->retrieveFeatures( + 'fa_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccountFeatures::class, $result); } - public function testRetrieveScheduledQueryRun() + public function testUpdateFeaturesFinancialAccount() { $this->expectsRequest( - 'get', - '/v1/sigma/scheduled_query_runs/sqr_xxxxxxxxxxxxx' + 'post', + '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features' ); - $result = $this->client->sigma->scheduledQueryRuns->retrieve( - 'sqr_xxxxxxxxxxxxx', - [] + $result = $this->client->treasury->financialAccounts->updateFeatures( + 'fa_xxxxxxxxxxxxx', + ['card_issuing' => ['requested' => false]] ); - static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccountFeatures::class, $result); } - public function testListScheduledQueryRun() + public function testListInboundTransfer() { - $this->expectsRequest('get', '/v1/sigma/scheduled_query_runs'); - $result = $this->client->sigma->scheduledQueryRuns->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/treasury/inbound_transfers'); + $result = $this->client->treasury->inboundTransfers->all( + ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] + ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result->data[0]); } - public function testCreateReportRun() + public function testCreateInboundTransfer() { - $this->expectsRequest('post', '/v1/reporting/report_runs'); - $result = $this->client->reporting->reportRuns->create( + $this->expectsRequest('post', '/v1/treasury/inbound_transfers'); + $result = $this->client->treasury->inboundTransfers->create( [ - 'report_type' => 'balance.summary.1', - 'parameters' => [ - 'interval_start' => 1522540800, - 'interval_end' => 1525132800, - ], + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'amount' => 10000, + 'currency' => 'usd', + 'origin_payment_method' => 'pm_xxxxxxxxxxxxx', + 'description' => 'InboundTransfer from my bank account', ] ); - static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testRetrieveReportRun() + public function testRetrieveInboundTransfer() { - $this->expectsRequest('get', '/v1/reporting/report_runs/frr_xxxxxxxxxxxxx'); - $result = $this->client->reporting->reportRuns->retrieve( - 'frr_xxxxxxxxxxxxx', + $this->expectsRequest( + 'get', + '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx' + ); + $result = $this->client->treasury->inboundTransfers->retrieve( + 'ibt_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result); - } - - public function testListReportRun() - { - $this->expectsRequest('get', '/v1/reporting/report_runs'); - $result = $this->client->reporting->reportRuns->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testRetrieveReportType() + public function testCancelInboundTransfer() { $this->expectsRequest( - 'get', - '/v1/reporting/report_types/balance.summary.1' + 'post', + '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel' ); - $result = $this->client->reporting->reportTypes->retrieve( - 'balance.summary.1', + $result = $this->client->treasury->inboundTransfers->cancel( + 'ibt_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Reporting\ReportType::class, $result); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testListReportType() + public function testListOutboundPayment() { - $this->expectsRequest('get', '/v1/reporting/report_types'); - $result = $this->client->reporting->reportTypes->all([]); + $this->expectsRequest('get', '/v1/treasury/outbound_payments'); + $result = $this->client->treasury->outboundPayments->all( + ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] + ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Reporting\ReportType::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result->data[0]); } - public function testRetrieveAccount3() + public function testCreateOutboundPayment() + { + $this->expectsRequest('post', '/v1/treasury/outbound_payments'); + $result = $this->client->treasury->outboundPayments->create( + [ + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'amount' => 10000, + 'currency' => 'usd', + 'customer' => 'cu_xxxxxxxxxxxxx', + 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', + 'description' => 'OutboundPayment to a 3rd party', + ] + ); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + } + + public function testRetrieveOutboundPayment() { $this->expectsRequest( 'get', - '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx' + '/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx' ); - $result = $this->client->financialConnections->accounts->retrieve( - 'fca_xxxxxxxxxxxxx', + $result = $this->client->treasury->outboundPayments->retrieve( + 'obp_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); } - public function testListAccount3() + public function testCancelOutboundPayment() { - $this->expectsRequest('get', '/v1/financial_connections/accounts'); - $result = $this->client->financialConnections->accounts->all( - ['account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx']] + $this->expectsRequest( + 'post', + '/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx/cancel' ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]); + $result = $this->client->treasury->outboundPayments->cancel( + 'obp_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); } - public function testListOwnersAccount2() + public function testListOutboundTransfer() { - $this->expectsRequest( - 'get', - '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/owners' - ); - $result = $this->client->financialConnections->accounts->allOwners( - 'fca_xxxxxxxxxxxxx', - ['limit' => 3, 'ownership' => 'fcaowns_xxxxxxxxxxxxx'] + $this->expectsRequest('get', '/v1/treasury/outbound_transfers'); + $result = $this->client->treasury->outboundTransfers->all( + ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result->data[0]); } - public function testCreateSession5() + public function testCreateOutboundTransfer() { - $this->expectsRequest('post', '/v1/financial_connections/sessions'); - $result = $this->client->financialConnections->sessions->create( + $this->expectsRequest('post', '/v1/treasury/outbound_transfers'); + $result = $this->client->treasury->outboundTransfers->create( [ - 'account_holder' => [ - 'type' => 'customer', - 'customer' => 'cus_xxxxxxxxxxxxx', - ], - 'permissions' => ['payment_method', 'balances'], - 'filters' => ['countries' => ['US']], + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', + 'amount' => 500, + 'currency' => 'usd', + 'description' => 'OutboundTransfer to my external bank account', ] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testRetrieveSession3() + public function testRetrieveOutboundTransfer() { $this->expectsRequest( 'get', - '/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx' + '/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx' ); - $result = $this->client->financialConnections->sessions->retrieve( - 'fcsess_xxxxxxxxxxxxx', + $result = $this->client->treasury->outboundTransfers->retrieve( + 'obt_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); - } - - public function testRetrieveSource2() - { - $this->expectsRequest('get', '/v1/sources/src_xxxxxxxxxxxxx'); - $result = $this->client->sources->retrieve('src_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Source::class, $result); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testCreateVerificationSession() + public function testCancelOutboundTransfer() { - $this->expectsRequest('post', '/v1/identity/verification_sessions'); - $result = $this->client->identity->verificationSessions->create( - ['type' => 'document'] + $this->expectsRequest( + 'post', + '/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx/cancel' ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + $result = $this->client->treasury->outboundTransfers->cancel( + 'obt_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testListVerificationSession() + public function testListReceivedCredit() { - $this->expectsRequest('get', '/v1/identity/verification_sessions'); - $result = $this->client->identity->verificationSessions->all( - ['limit' => 3] + $this->expectsRequest('get', '/v1/treasury/received_credits'); + $result = $this->client->treasury->receivedCredits->all( + ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] ); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result->data[0]); } - public function testRetrieveVerificationSession() + public function testRetrieveReceivedCredit() { $this->expectsRequest( 'get', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' + '/v1/treasury/received_credits/rc_xxxxxxxxxxxxx' ); - $result = $this->client->identity->verificationSessions->retrieve( - 'vs_xxxxxxxxxxxxx', + $result = $this->client->treasury->receivedCredits->retrieve( + 'rc_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result); } - public function testUpdateVerificationSession() + public function testListReceivedDebit() { - $this->expectsRequest( - 'post', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' - ); - $result = $this->client->identity->verificationSessions->update( - 'vs_xxxxxxxxxxxxx', - ['type' => 'id_number'] + $this->expectsRequest('get', '/v1/treasury/received_debits'); + $result = $this->client->treasury->receivedDebits->all( + ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result->data[0]); } - public function testCancelVerificationSession() + public function testRetrieveReceivedDebit() { $this->expectsRequest( - 'post', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel' + 'get', + '/v1/treasury/received_debits/rd_xxxxxxxxxxxxx' ); - $result = $this->client->identity->verificationSessions->cancel( - 'vs_xxxxxxxxxxxxx', + $result = $this->client->treasury->receivedDebits->retrieve( + 'rd_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result); } - public function testRedactVerificationSession() + public function testListTransactionEntry() + { + $this->expectsRequest('get', '/v1/treasury/transaction_entries'); + $result = $this->client->treasury->transactionEntries->all( + ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result->data[0]); + } + + public function testRetrieveTransactionEntry() { $this->expectsRequest( - 'post', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact' + 'get', + '/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx' ); - $result = $this->client->identity->verificationSessions->redact( - 'vs_xxxxxxxxxxxxx', + $result = $this->client->treasury->transactionEntries->retrieve( + 'trxne_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result); } - public function testRetrieveVerificationReport() + public function testListTransaction2() + { + $this->expectsRequest('get', '/v1/treasury/transactions'); + $result = $this->client->treasury->transactions->all( + ['financial_account' => 'fa_xxxxxxxxxxxxx', 'limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result->data[0]); + } + + public function testRetrieveTransaction2() { $this->expectsRequest( 'get', - '/v1/identity/verification_reports/vr_xxxxxxxxxxxxx' + '/v1/treasury/transactions/trxn_xxxxxxxxxxxxx' ); - $result = $this->client->identity->verificationReports->retrieve( - 'vr_xxxxxxxxxxxxx', + $result = $this->client->treasury->transactions->retrieve( + 'trxn_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Identity\VerificationReport::class, $result); + static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result); } - public function testListVerificationReport() + public function testListWebhookEndpoint() { - $this->expectsRequest('get', '/v1/identity/verification_reports'); - $result = $this->client->identity->verificationReports->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/webhook_endpoints'); + $result = $this->client->webhookEndpoints->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Identity\VerificationReport::class, $result->data[0]); + static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result->data[0]); + } + + public function testDeleteWebhookEndpoint() + { + $this->expectsRequest('delete', '/v1/webhook_endpoints/we_xxxxxxxxxxxxx'); + $result = $this->client->webhookEndpoints->delete('we_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } public function testRetrieveWebhookEndpoint() @@ -3934,19 +3963,4 @@ public function testUpdateWebhookEndpoint() ); static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } - - public function testListWebhookEndpoint() - { - $this->expectsRequest('get', '/v1/webhook_endpoints'); - $result = $this->client->webhookEndpoints->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result->data[0]); - } - - public function testDeleteWebhookEndpoint() - { - $this->expectsRequest('delete', '/v1/webhook_endpoints/we_xxxxxxxxxxxxx'); - $result = $this->client->webhookEndpoints->delete('we_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); - } } From e19e8a86fccfec2300edf3804f098bf4054890d8 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 29 Jun 2022 15:29:57 -0400 Subject: [PATCH 2/4] Fix SKU casing. --- lib/SKU.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SKU.php b/lib/SKU.php index 3d7a30604..09d6c85e5 100644 --- a/lib/SKU.php +++ b/lib/SKU.php @@ -29,7 +29,7 @@ * @property string|\Stripe\Product $product The ID of the product this SKU is associated with. The product must be currently active. * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. */ -class Sku extends ApiResource +class SKU extends ApiResource { const OBJECT_NAME = 'sku'; From c2ad4d2f793afca39483dce6f0ecb3b66dcc5127 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 29 Jun 2022 16:03:00 -0400 Subject: [PATCH 3/4] Fix tests --- tests/Stripe/GeneratedExamplesTest.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 6f85baf90..5163712f9 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -572,6 +572,16 @@ 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 testCreateAccountLink() { $this->expectsRequest('post', '/v1/account_links'); @@ -2651,14 +2661,6 @@ public function testApproveReview() static::assertInstanceOf(\Stripe\Review::class, $result); } - public function testListSetupAttempt() - { - $this->expectsRequest('get', '/v1/setup_attempts'); - $result = $this->client->setupAttempts->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SetupAttempt::class, $result->data[0]); - } - public function testListSetupIntent() { $this->expectsRequest('get', '/v1/setup_intents'); From f7b334f0f007214a979e89cbcfa259baf270b48b Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 29 Jun 2022 16:08:48 -0400 Subject: [PATCH 4/4] Test helper tests --- tests/Stripe/GeneratedExamplesTest.php | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 5163712f9..cd511e19b 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -582,6 +582,58 @@ public function testListSetupAttempt() 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');