diff --git a/CHANGELOG.md b/CHANGELOG.md index 786f42e25..93d0593bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 13.2.0 - 2023-11-02 +* [#1599](https://github.com/stripe/stripe-php/pull/1599) Update generated code + * Add support for new resource `Tax.Registration` + * Add support for `all`, `create`, and `update` methods on resource `Registration` + * Add support for new value `token_card_network_invalid` on enum `StripeError.code` + * Add support for new value `payment_unreconciled` on enum `BalanceTransaction.type` + * Add support for `revolut_pay` on `PaymentMethod` + * Add support for new value `revolut_pay` on enum `PaymentMethod.type` + ## 13.2.0-beta.1 - 2023-10-26 * [#1596](https://github.com/stripe/stripe-php/pull/1596) Update generated code for beta * Add support for new resource `Margin` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 477d817d4..39c58a743 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v627 \ No newline at end of file +v645 \ No newline at end of file diff --git a/init.php b/init.php index 9e2bdec1f..f74d2fb05 100644 --- a/init.php +++ b/init.php @@ -133,6 +133,7 @@ require __DIR__ . '/lib/Invoice.php'; require __DIR__ . '/lib/InvoiceItem.php'; require __DIR__ . '/lib/InvoiceLineItem.php'; +require __DIR__ . '/lib/InvoicePayment.php'; require __DIR__ . '/lib/Issuing/Authorization.php'; require __DIR__ . '/lib/Issuing/Card.php'; require __DIR__ . '/lib/Issuing/Cardholder.php'; diff --git a/lib/BalanceTransaction.php b/lib/BalanceTransaction.php index d04edaaf3..7424aa9e2 100644 --- a/lib/BalanceTransaction.php +++ b/lib/BalanceTransaction.php @@ -24,7 +24,7 @@ * @property string $reporting_category Learn more about how reporting categories can help you understand balance transactions from an accounting perspective. * @property null|string|\Stripe\ApplicationFee|\Stripe\ApplicationFeeRefund|\Stripe\Charge|\Stripe\CustomerCashBalanceTransaction|\Stripe\Dispute|\Stripe\Issuing\Authorization|\Stripe\Issuing\Dispute|\Stripe\Issuing\Transaction|\Stripe\Payout|\Stripe\Refund|\Stripe\StripeObject|\Stripe\Topup|\Stripe\Transfer|\Stripe\TransferReversal $source This transaction relates to the Stripe object. * @property string $status The transaction's net funds status in the Stripe balance, which are either available or pending. - * @property string $type Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_inbound, obligation_outbound, obligation_reversal_inbound, obligation_reversal_outbound, obligation_payout, obligation_payout_failure, payment, payment_failure_refund, payment_refund, payment_reversal, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead. + * @property string $type Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_inbound, obligation_outbound, obligation_reversal_inbound, obligation_reversal_outbound, obligation_payout, obligation_payout_failure, payment, payment_failure_refund, payment_refund, payment_reversal, payment_unreconciled, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead. */ class BalanceTransaction extends ApiResource { @@ -56,6 +56,7 @@ class BalanceTransaction extends ApiResource const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund'; const TYPE_PAYMENT_REFUND = 'payment_refund'; const TYPE_PAYMENT_REVERSAL = 'payment_reversal'; + const TYPE_PAYMENT_UNRECONCILED = 'payment_unreconciled'; const TYPE_PAYOUT = 'payout'; const TYPE_PAYOUT_CANCEL = 'payout_cancel'; const TYPE_PAYOUT_FAILURE = 'payout_failure'; diff --git a/lib/BankAccount.php b/lib/BankAccount.php index f58a52e97..31bbadea4 100644 --- a/lib/BankAccount.php +++ b/lib/BankAccount.php @@ -31,7 +31,7 @@ * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\Stripe\StripeObject $requirements Information about the requirements for the bank account, including what information needs to be collected. * @property null|string $routing_number The routing transit number for the bank account. - * @property string $status

For bank accounts, possible values are new, validated, verified, verification_failed, or errored. A bank account that hasn't had any activity or validation performed is new. If Stripe can determine that the bank account exists, its status will be validated. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be verified. If the verification failed for any reason, such as microdeposit failure, the status will be verification_failed. If a transfer sent to this bank account fails, we'll set the status to errored and will not continue to send transfers until the bank details are updated.

For external accounts, possible values are new, errored and verification_failed. If a transfer fails, the status is set to errored and transfers are stopped until account details are updated. In India, if we can't verify the owner of the bank account, we'll set the status to verification_failed. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.

+ * @property string $status

For bank accounts, possible values are new, validated, verified, verification_failed, or errored. A bank account that hasn't had any activity or validation performed is new. If Stripe can determine that the bank account exists, its status will be validated. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be verified. If the verification failed for any reason, such as microdeposit failure, the status will be verification_failed. If a payout sent to this bank account fails, we'll set the status to errored and will not continue to send scheduled payouts until the bank details are updated.

For external accounts, possible values are new, errored and verification_failed. If a payouts fails, the status is set to errored and scheduled payouts are stopped until account details are updated. In India, if we can't verify the owner of the bank account, we'll set the status to verification_failed. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.

*/ class BankAccount extends ApiResource { diff --git a/lib/Card.php b/lib/Card.php index 02d925299..3c3748be0 100644 --- a/lib/Card.php +++ b/lib/Card.php @@ -37,7 +37,7 @@ * @property string $last4 The last four digits of the card. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $name Cardholder name. - * @property null|string $status For external accounts, possible values are new and errored. If a transfer fails, the status is set to errored and transfers are stopped until account details are updated. + * @property null|string $status For external accounts that are cards, possible values are new and errored. If a payout fails, the status is set to errored and scheduled payouts are stopped until account details are updated. * @property null|string $tokenization_method If the card number is tokenized, this is the method that was used. Can be android_pay (includes Google Pay), apple_pay, masterpass, visa_checkout, or null. */ class Card extends ApiResource diff --git a/lib/CreditNote.php b/lib/CreditNote.php index 9edb4048b..9ab135a3d 100644 --- a/lib/CreditNote.php +++ b/lib/CreditNote.php @@ -28,8 +28,11 @@ * @property string $number A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice. * @property null|int $out_of_band_amount Amount that was credited outside of Stripe. * @property string $pdf The link to download the PDF of the credit note. + * @property null|int $post_payment_amount + * @property null|int $pre_payment_amount * @property null|string $reason Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory * @property null|string|\Stripe\Refund $refund Refund related to this credit note. + * @property null|\Stripe\StripeObject[] $refunds Refunds related to this credit note. * @property null|\Stripe\StripeObject $shipping_cost The details of the cost of shipping, including the ShippingRate applied to the invoice. * @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 cents (or local equivalent) representing the amount of the credit note, excluding exclusive tax and invoice level discounts. diff --git a/lib/CustomerCashBalanceTransaction.php b/lib/CustomerCashBalanceTransaction.php index e7d182348..00ec89ad4 100644 --- a/lib/CustomerCashBalanceTransaction.php +++ b/lib/CustomerCashBalanceTransaction.php @@ -39,5 +39,6 @@ class CustomerCashBalanceTransaction extends ApiResource const TYPE_REFUNDED_FROM_PAYMENT = 'refunded_from_payment'; const TYPE_RETURN_CANCELED = 'return_canceled'; const TYPE_RETURN_INITIATED = 'return_initiated'; + const TYPE_TRANSFERRED_TO_BALANCE = 'transferred_to_balance'; const TYPE_UNAPPLIED_FROM_PAYMENT = 'unapplied_from_payment'; } diff --git a/lib/ErrorObject.php b/lib/ErrorObject.php index a56861bd3..a8b005663 100644 --- a/lib/ErrorObject.php +++ b/lib/ErrorObject.php @@ -201,6 +201,7 @@ class ErrorObject extends StripeObject const CODE_TESTMODE_CHARGES_ONLY = 'testmode_charges_only'; const CODE_TLS_VERSION_UNSUPPORTED = 'tls_version_unsupported'; const CODE_TOKEN_ALREADY_USED = 'token_already_used'; + const CODE_TOKEN_CARD_NETWORK_INVALID = 'token_card_network_invalid'; const CODE_TOKEN_IN_USE = 'token_in_use'; const CODE_TRANSFER_SOURCE_BALANCE_PARAMETERS_MISMATCH = 'transfer_source_balance_parameters_mismatch'; const CODE_TRANSFERS_NOT_ALLOWED = 'transfers_not_allowed'; diff --git a/lib/Event.php b/lib/Event.php index 708962379..5f7bedd24 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -159,6 +159,7 @@ class Event extends ApiResource const INVOICE_PAID = 'invoice.paid'; const INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required'; const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed'; + const INVOICE_PAYMENT_OVERPAID = 'invoice.payment.overpaid'; const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded'; const INVOICE_SENT = 'invoice.sent'; const INVOICE_UPCOMING = 'invoice.upcoming'; @@ -414,6 +415,7 @@ class Event extends ApiResource const TYPE_INVOICE_PAID = 'invoice.paid'; const TYPE_INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required'; const TYPE_INVOICE_PAYMENT_FAILED = 'invoice.payment_failed'; + const TYPE_INVOICE_PAYMENT_OVERPAID = 'invoice.payment.overpaid'; const TYPE_INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded'; const TYPE_INVOICE_SENT = 'invoice.sent'; const TYPE_INVOICE_UPCOMING = 'invoice.upcoming'; diff --git a/lib/ExchangeRate.php b/lib/ExchangeRate.php index e0bb19579..d8c621f28 100644 --- a/lib/ExchangeRate.php +++ b/lib/ExchangeRate.php @@ -5,17 +5,32 @@ namespace Stripe; /** - * Exchange Rate objects allow you to determine the rates that Stripe is - * currently using to convert from one currency to another. Since this number is - * variable throughout the day, there are various reasons why you might want to - * know the current rate (for example, to dynamically price an item for a user - * with a default payment in a foreign currency). - * - * If you want a guarantee that the charge is made with a certain exchange rate - * you expect is current, you can pass in exchange_rate to charges endpoints. - * If the value is no longer up to date, the charge won't go through. Please - * refer to our Exchange Rates API guide for more - * details. + * ExchangeRate objects allow you to determine the rates that Stripe is currently + * using to convert from one currency to another. Since this number is variable + * throughout the day, there are various reasons why you might want to know the current + * rate (for example, to dynamically price an item for a user with a default + * payment in a foreign currency). + * + * Please refer to our Exchange Rates API guide for more details. + * + * [Note: this integration path is supported but no longer recommended] Additionally, + * you can guarantee that a charge is made with an exchange rate that you expect is + * current. To do so, you must pass in the exchange_rate to charges endpoints. If the + * value is no longer up to date, the charge won't go through. Please refer to our + * Using with charges guide for more details. + * + * ----- + * + * + * + * This Exchange Rates API is a Beta Service and is subject to Stripe's terms of service. You may use the API solely for the purpose of transacting on Stripe. For example, the API may be queried in order to: + * + * - localize prices for processing payments on Stripe + * - reconcile Stripe transactions + * - determine how much money to send to a connected account + * - determine app fees to charge a connected account + * + * Using this Exchange Rates API beta for any purpose other than to transact on Stripe is strictly prohibited and constitutes a violation of Stripe's terms of service. * * @property string $id Unique identifier for the object. Represented as the three-letter ISO currency code in lowercase. * @property string $object String representing the object's type. Objects of the same type share the same value. diff --git a/lib/Invoice.php b/lib/Invoice.php index b8b48576c..74ae66b04 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -47,6 +47,7 @@ * @property int $amount_paid The amount, in cents (or local equivalent), that was paid. * @property int $amount_remaining The difference between amount_due and amount_paid, in cents (or local equivalent). * @property int $amount_shipping This is the sum of all the shipping amounts. + * @property null|\Stripe\StripeObject[] $amounts_due List of expected payments and corresponding due dates. This value will be null for invoices where collection_method=charge_automatically. * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the invoice. * @property null|int $application_fee_amount The fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. @@ -94,6 +95,7 @@ * @property bool $paid_out_of_band Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe. * @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. * @property \Stripe\StripeObject $payment_settings + * @property null|\Stripe\Collection<\Stripe\InvoicePayment> $payments Payments for this invoice * @property int $period_end End of the usage period during which invoice items were added to this invoice. * @property int $period_start Start of the usage period during which invoice items were added to this invoice. * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice. @@ -162,6 +164,23 @@ class Invoice extends ApiResource const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically'; const BILLING_SEND_INVOICE = 'send_invoice'; + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice the attached invoice + */ + public function attachPaymentIntent($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/attach_payment_intent'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + /** * @param null|array $params * @param null|array|string $opts @@ -298,6 +317,36 @@ public static function search($params = null, $opts = null) return self::_searchResource($url, $params, $opts); } + const PATH_PAYMENTS = '/payments'; + + /** + * @param string $id the ID of the invoice on which to retrieve the invoice payments + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection<\Stripe\InvoicePayment> the list of invoice payments + */ + public static function allPayments($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_PAYMENTS, $params, $opts); + } + + /** + * @param string $id the ID of the invoice to which the invoice payment belongs + * @param string $paymentId the ID of the invoice payment to retrieve + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoicePayment + */ + public static function retrievePayment($id, $paymentId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_PAYMENTS, $paymentId, $params, $opts); + } const PATH_LINES = '/lines'; /** diff --git a/lib/InvoicePayment.php b/lib/InvoicePayment.php new file mode 100644 index 000000000..53aec689e --- /dev/null +++ b/lib/InvoicePayment.php @@ -0,0 +1,31 @@ +invoice_credit_balance. This field is null until the payment is paid. Overpayment can happen when you attach more than one PaymentIntent to the invoice, and each of them succeeds. To avoid overpayment, cancel any PaymentIntents that you do not need before attaching more. + * @property null|int $amount_paid Amount that was actually paid for this invoice, in cents (or local equivalent). This field is null until the payment is paid. This amount can be less than the amount_requested if the PaymentIntent’s amount_received is not sufficient to pay all of the invoices that it is attached to. + * @property int $amount_requested Amount intended to be paid toward this invoice, in cents (or local equivalent) + * @property null|string|\Stripe\Charge $charge ID of the successful charge for this payment. This field is null when the payment is open or canceled. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string|\Stripe\Invoice $invoice The invoice that was paid. + * @property null|bool $is_default Stripe automatically creates a default InvoicePayment when the invoice is finalized, and keeps it synchronized with the invoice’s amount_remaining. The PaymentIntent associated with the default payment can’t be edited or canceled directly. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent associated with this payment. Note: This property is only populated for invoices finalized on or after March 15th, 2019. + * @property string $status The status of the payment, one of open, paid, or canceled. + * @property \Stripe\StripeObject $status_transitions + */ +class InvoicePayment extends ApiResource +{ + const OBJECT_NAME = 'invoice_payment'; + + use ApiOperations\All; + use ApiOperations\Retrieve; +} diff --git a/lib/Issuing/PersonalizationDesign.php b/lib/Issuing/PersonalizationDesign.php index a75021949..27573f872 100644 --- a/lib/Issuing/PersonalizationDesign.php +++ b/lib/Issuing/PersonalizationDesign.php @@ -11,6 +11,7 @@ * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\Stripe\File $card_logo The file for the card logo to use with physical bundles that support card logos. Must have a purpose value of issuing_logo. * @property null|\Stripe\StripeObject $carrier_text Hash containing carrier text, for use with physical bundles that support carrier text. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $lookup_key A lookup key used to retrieve personalization designs dynamically from a static string. This may be up to 200 characters. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $name Friendly display name. diff --git a/lib/PaymentMethod.php b/lib/PaymentMethod.php index 630b1d0c7..c0558b63f 100644 --- a/lib/PaymentMethod.php +++ b/lib/PaymentMethod.php @@ -47,6 +47,7 @@ * @property null|\Stripe\StripeObject $pix * @property null|\Stripe\StripeObject $promptpay * @property null|\Stripe\StripeObject $radar_options Options to configure Radar. See Radar Session for more information. + * @property null|\Stripe\StripeObject $revolut_pay * @property null|\Stripe\StripeObject $sepa_debit * @property null|\Stripe\StripeObject $sofort * @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. @@ -91,6 +92,7 @@ class PaymentMethod extends ApiResource const TYPE_PAYPAL = 'paypal'; const TYPE_PIX = 'pix'; const TYPE_PROMPTPAY = 'promptpay'; + const TYPE_REVOLUT_PAY = 'revolut_pay'; const TYPE_SEPA_DEBIT = 'sepa_debit'; const TYPE_SOFORT = 'sofort'; const TYPE_US_BANK_ACCOUNT = 'us_bank_account'; diff --git a/lib/QuotePreviewInvoice.php b/lib/QuotePreviewInvoice.php index ae7a600b0..3f26ae103 100644 --- a/lib/QuotePreviewInvoice.php +++ b/lib/QuotePreviewInvoice.php @@ -47,6 +47,7 @@ * @property int $amount_paid The amount, in cents (or local equivalent), that was paid. * @property int $amount_remaining The difference between amount_due and amount_paid, in cents (or local equivalent). * @property int $amount_shipping This is the sum of all the shipping amounts. + * @property null|\Stripe\StripeObject[] $amounts_due List of expected payments and corresponding due dates. This value will be null for invoices where collection_method=charge_automatically. * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the invoice. * @property null|int $application_fee_amount The fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. * @property \Stripe\StripeObject $applies_to @@ -90,6 +91,7 @@ * @property bool $paid_out_of_band Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe. * @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. * @property \Stripe\StripeObject $payment_settings + * @property null|\Stripe\Collection<\Stripe\InvoicePayment> $payments Payments for this invoice * @property int $period_end End of the usage period during which invoice items were added to this invoice. * @property int $period_start Start of the usage period during which invoice items were added to this invoice. * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice. diff --git a/lib/Service/InvoiceService.php b/lib/Service/InvoiceService.php index cc61a320a..ba6e4a7c3 100644 --- a/lib/Service/InvoiceService.php +++ b/lib/Service/InvoiceService.php @@ -42,6 +42,50 @@ public function allLines($parentId, $params = null, $opts = null) return $this->requestCollection('get', $this->buildPath('/v1/invoices/%s/lines', $parentId), $params, $opts); } + /** + * When retrieving an invoice, there is an includable payments property containing + * the first handful of those items. There is also a URL where you can retrieve the + * full (paginated) list of payments. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection<\Stripe\InvoicePayment> + */ + public function allPayments($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/invoices/%s/payments', $parentId), $params, $opts); + } + + /** + * Attaches a PaymentIntent to the invoice, adding it to the list of + * payments. When the PaymentIntent’s status changes to + * succeeded, the payment is credited to the invoice, increasing its + * amount_paid. When the invoice is fully paid, the invoice’s status + * becomes paid. + * + * If the PaymentIntent’s status is already succeeded when it is + * attached, it is credited to the invoice immediately. + * + * Related guide: Create an invoice + * payment + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function attachPaymentIntent($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s/attach_payment_intent', $id), $params, $opts); + } + /** * This endpoint creates a draft invoice for a given customer. The invoice remains * a draft until you finalize the invoice, which @@ -150,6 +194,23 @@ public function retrieve($id, $params = null, $opts = null) return $this->request('get', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); } + /** + * Retrieves the invoice payment with the given ID. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoicePayment + */ + public function retrievePayment($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/invoices/%s/payments/%s', $parentId, $id), $params, $opts); + } + /** * Search for invoices you’ve previously created using Stripe’s Search Query Language. Don’t use diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index 0becdd751..70bfc95a6 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -65,6 +65,7 @@ class ObjectTypes \Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class, \Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class, \Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class, + \Stripe\InvoicePayment::OBJECT_NAME => \Stripe\InvoicePayment::class, \Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class, \Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class, \Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class, diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index bd92ae844..69ab1dd09 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -21,2086 +21,1769 @@ protected function setUpService() $this->client = new \Stripe\StripeClient(['api_key' => 'sk_test_123', 'api_base' => MOCK_URL, 'files_base' => MOCK_URL]); } - public function testListSecret() + public function testAccountLinksPost() { - $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 testCreateSecret() - { - $this->expectsRequest('post', '/v1/apps/secrets'); - $result = $this->client->apps->secrets->create([ - 'name' => 'sec_123', - 'payload' => 'very secret string', - '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 testAccountsCapabilitiesGet() { - $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); + $this->expectsRequest( + 'get', + '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities' + ); + $result = $this->client->accounts->allCapabilities( + 'acct_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Capability::class, $result->data[0]); } - public function testFindSecret() + public function testAccountsCapabilitiesGet2() { - $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); + $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 testCreateSession() + public function testAccountsCapabilitiesPost() { - $this->expectsRequest('post', '/v1/checkout/sessions'); - $result = $this->client->checkout->sessions->create([ - 'success_url' => 'https://example.com/success', - 'cancel_url' => 'https://example.com/cancel', - 'mode' => 'payment', - 'shipping_options' => [ - ['shipping_rate' => 'shr_standard'], - [ - 'shipping_rate_data' => [ - 'display_name' => 'Standard', - 'delivery_estimate' => [ - 'minimum' => [ - 'unit' => 'day', - 'value' => 5, - ], - 'maximum' => [ - 'unit' => 'day', - 'value' => 7, - ], - ], - ], - ], - ], - ]); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + $this->expectsRequest( + 'post', + '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments' + ); + $result = $this->client->accounts->updateCapability( + 'acct_xxxxxxxxxxxxx', + 'card_payments', + ['requested' => true] + ); + static::assertInstanceOf(\Stripe\Capability::class, $result); } - public function testExpireSession() + public function testAccountsDelete() { - $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('delete', '/v1/accounts/acct_xxxxxxxxxxxxx'); + $result = $this->client->accounts->delete('acct_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testListLineItemsSession() + public function testAccountsGet() { - $this->expectsRequest( - 'get', - '/v1/checkout/sessions/sess_xyz/line_items' - ); - $result = $this->client->checkout->sessions->allLineItems( - 'sess_xyz', - [] - ); + $this->expectsRequest('get', '/v1/accounts'); + $result = $this->client->accounts->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Account::class, $result->data[0]); } - public function testRetrieveCashBalance() + public function testAccountsGet2() { - $this->expectsRequest('get', '/v1/customers/cus_123/cash_balance'); - $result = $this->client->customers->retrieveCashBalance('cus_123', []); - static::assertInstanceOf(\Stripe\CashBalance::class, $result); + $this->expectsRequest('get', '/v1/accounts/acct_xxxxxxxxxxxxx'); + $result = $this->client->accounts->retrieve('acct_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testUpdateCashBalance() + public function testAccountsLoginLinksPost() { - $this->expectsRequest('post', '/v1/customers/cus_123/cash_balance'); - $result = $this->client->customers->updateCashBalance( - 'cus_123', - ['settings' => ['reconciliation_mode' => 'manual']] + $this->expectsRequest( + 'post', + '/v1/accounts/acct_xxxxxxxxxxxxx/login_links' ); - static::assertInstanceOf(\Stripe\CashBalance::class, $result); + $result = $this->client->accounts->createLoginLink( + 'acct_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\LoginLink::class, $result); } - public function testCreateFundingInstructionsCustomer() + public function testAccountsPersonsDelete() { $this->expectsRequest( - 'post', - '/v1/customers/cus_123/funding_instructions' + 'delete', + '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' ); - $result = $this->client->customers->createFundingInstructions( - 'cus_123', - [ - 'bank_transfer' => [ - 'requested_address_types' => ['zengin'], - 'type' => 'jp_bank_transfer', - ], - 'currency' => 'usd', - 'funding_type' => 'bank_transfer', - ] + $result = $this->client->accounts->deletePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\FundingInstructions::class, $result); + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testListAccount() + public function testAccountsPersonsGet() { - $this->expectsRequest('get', '/v1/financial_connections/accounts'); - $result = $this->client->financialConnections->accounts->all([]); + $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\FinancialConnections\Account::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Person::class, $result->data[0]); } - public function testRetrieveAccount() + public function testAccountsPersonsGet2() { $this->expectsRequest( 'get', - '/v1/financial_connections/accounts/fca_xyz' + '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' ); - $result = $this->client->financialConnections->accounts->retrieve( - 'fca_xyz', + $result = $this->client->accounts->retrievePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testDisconnectAccount() + public function testAccountsPersonsPost() { $this->expectsRequest( 'post', - '/v1/financial_connections/accounts/fca_xyz/disconnect' - ); - $result = $this->client->financialConnections->accounts->disconnect( - 'fca_xyz', - [] - ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); - } - - public function testListOwnersAccount() - { - $this->expectsRequest( - 'get', - '/v1/financial_connections/accounts/fca_xyz/owners' + '/v1/accounts/acct_xxxxxxxxxxxxx/persons' ); - $result = $this->client->financialConnections->accounts->allOwners( - 'fca_xyz', - ['ownership' => 'fcaowns_xyz'] + $result = $this->client->accounts->createPerson( + 'acct_xxxxxxxxxxxxx', + [ + 'first_name' => 'Jane', + 'last_name' => 'Diaz', + ] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testRefreshAccount() + public function testAccountsPersonsPost2() { $this->expectsRequest( 'post', - '/v1/financial_connections/accounts/fca_xyz/refresh' + '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' ); - $result = $this->client->financialConnections->accounts->refresh( - 'fca_xyz', - ['features' => ['balance']] + $result = $this->client->accounts->updatePerson( + 'acct_xxxxxxxxxxxxx', + 'person_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); + static::assertInstanceOf(\Stripe\Person::class, $result); } - public function testCreateSession2() + public function testAccountsPost() { - $this->expectsRequest('post', '/v1/financial_connections/sessions'); - $result = $this->client->financialConnections->sessions->create([ - 'account_holder' => [ - 'type' => 'customer', - 'customer' => 'cus_123', + $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], ], - 'permissions' => ['balances'], ]); - static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testRetrieveSession() + public function testAccountsPost2() { - $this->expectsRequest( - 'get', - '/v1/financial_connections/sessions/fcsess_xyz' - ); - $result = $this->client->financialConnections->sessions->retrieve( - 'fcsess_xyz', - [] + $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx'); + $result = $this->client->accounts->update( + 'acct_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testUpcomingInvoice() + public function testAccountsRejectPost() { - $this->expectsRequest('get', '/v1/invoices/upcoming'); - $result = $this->client->invoices->upcoming([ - 'customer' => 'cus_9utnxg47pWjV1e', - ]); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/reject'); + $result = $this->client->accounts->reject( + 'acct_xxxxxxxxxxxxx', + ['reason' => 'fraud'] + ); + static::assertInstanceOf(\Stripe\Account::class, $result); } - public function testCreatePaymentIntent() + public function testApplicationFeesGet() { - $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('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 testVerifyMicrodepositsPaymentIntent() + public function testApplicationFeesGet2() { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits' - ); - $result = $this->client->paymentIntents->verifyMicrodeposits( - 'pi_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/application_fees/fee_xxxxxxxxxxxxx'); + $result = $this->client->applicationFees->retrieve( + 'fee_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); - } - - 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); + static::assertInstanceOf(\Stripe\ApplicationFee::class, $result); } - public function testListLineItemsPaymentLink() + public function testApplicationFeesRefundsGet() { - $this->expectsRequest('get', '/v1/payment_links/pl_xyz/line_items'); - $result = $this->client->paymentLinks->allLineItems('pl_xyz', []); + $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\LineItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result->data[0]); } - public function testCreatePrice() + public function testApplicationFeesRefundsGet2() { - $this->expectsRequest('post', '/v1/prices'); - $result = $this->client->prices->create([ - 'unit_amount' => 2000, - 'currency' => 'usd', - 'currency_options' => [ - 'uah' => ['unit_amount' => 5000], - 'eur' => ['unit_amount' => 1800], - ], - 'recurring' => ['interval' => 'month'], - 'product' => 'prod_xxxxxxxxxxxxx', - ]); - static::assertInstanceOf(\Stripe\Price::class, $result); + $this->expectsRequest( + 'get', + '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx' + ); + $result = $this->client->applicationFees->retrieveRefund( + 'fee_xxxxxxxxxxxxx', + 'fr_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); } - public function testListSetupAttempt() + public function testApplicationFeesRefundsPost() { - $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]); + $this->expectsRequest( + 'post', + '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds' + ); + $result = $this->client->applicationFees->createRefund( + 'fee_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); } - public function testVerifyMicrodepositsSetupIntent() + public function testApplicationFeesRefundsPost2() { $this->expectsRequest( 'post', - '/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits' + '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx' ); - $result = $this->client->setupIntents->verifyMicrodeposits( - 'seti_xxxxxxxxxxxxx', - [] + $result = $this->client->applicationFees->updateRefund( + 'fee_xxxxxxxxxxxxx', + 'fr_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\SetupIntent::class, $result); + static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $result); } - public function testListShippingRate() + public function testAppsSecretsDeletePost() { - $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 testCreateShippingRate() + public function testAppsSecretsFindGet() { - $this->expectsRequest('post', '/v1/shipping_rates'); - $result = $this->client->shippingRates->create([ - 'display_name' => 'Sample Shipper', - 'fixed_amount' => [ - 'currency' => 'usd', - 'amount' => 400, - ], - 'type' => 'fixed_amount', + $this->expectsRequest('get', '/v1/apps/secrets/find'); + $result = $this->client->apps->secrets->find([ + 'name' => 'sec_123', + 'scope' => ['type' => 'account'], ]); - static::assertInstanceOf(\Stripe\ShippingRate::class, $result); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); } - public function testListConfiguration() + public function testAppsSecretsGet() { - $this->expectsRequest('get', '/v1/terminal/configurations'); - $result = $this->client->terminal->configurations->all([]); + $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\Terminal\Configuration::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result->data[0]); } - public function testDeleteConfiguration() + public function testAppsSecretsGet2() { - $this->expectsRequest('delete', '/v1/terminal/configurations/uc_123'); - $result = $this->client->terminal->configurations->delete('uc_123', []); - static::assertInstanceOf(\Stripe\Terminal\Configuration::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 testRetrieveConfiguration() + public function testAppsSecretsPost() { - $this->expectsRequest('get', '/v1/terminal/configurations/uc_123'); - $result = $this->client->terminal->configurations->retrieve( - 'uc_123', - [] - ); - static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); + $this->expectsRequest('post', '/v1/apps/secrets'); + $result = $this->client->apps->secrets->create([ + 'name' => 'sec_123', + 'payload' => 'very secret string', + 'scope' => ['type' => 'account'], + ]); + static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); } - public function testUpdateConfiguration() + public function testAppsSecretsPost2() { - $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); + $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 testFundCashBalanceCustomer() + public function testBalanceTransactionsGet() { - $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\CustomerCashBalanceTransaction::class, $result); + $this->expectsRequest('get', '/v1/balance_transactions'); + $result = $this->client->balanceTransactions->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\BalanceTransaction::class, $result->data[0]); } - public function testDeliverCardCard() + public function testBalanceTransactionsGet2() { $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/cards/card_123/shipping/deliver' + 'get', + '/v1/balance_transactions/txn_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->issuing->cards->deliverCard( - 'card_123', + $result = $this->client->balanceTransactions->retrieve( + 'txn_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + static::assertInstanceOf(\Stripe\BalanceTransaction::class, $result); } - public function testFailCardCard() + public function testBillingPortalConfigurationsGet() { - $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); + $this->expectsRequest('get', '/v1/billing_portal/configurations'); + $result = $this->client->billingPortal->configurations->all([ + 'limit' => 3, + ]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result->data[0]); } - public function testReturnCardCard() + public function testBillingPortalConfigurationsGet2() { $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/cards/card_123/shipping/return' + 'get', + '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->issuing->cards->returnCard( - 'card_123', + $result = $this->client->billingPortal->configurations->retrieve( + 'bpc_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); + static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); } - public function testShipCardCard() + public function testBillingPortalConfigurationsPost2() { $this->expectsRequest( 'post', - '/v1/test_helpers/issuing/cards/card_123/shipping/ship' + '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->issuing->cards->shipCard( - 'card_123', - [] + $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\Issuing\Card::class, $result); + static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); } - public function testExpireRefund() + public function testBillingPortalSessionsPost() { - $this->expectsRequest('post', '/v1/test_helpers/refunds/re_123/expire'); - $result = $this->client->testHelpers->refunds->expire('re_123', []); - static::assertInstanceOf(\Stripe\Refund::class, $result); + $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\BillingPortal\Session::class, $result); } - public function testListTestClock() + public function testChargesCapturePost() { - $this->expectsRequest('get', '/v1/test_helpers/test_clocks'); - $result = $this->client->testHelpers->testClocks->all([]); + $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx/capture'); + $result = $this->client->charges->capture('ch_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Charge::class, $result); + } + + public function testChargesGet() + { + $this->expectsRequest('get', '/v1/charges'); + $result = $this->client->charges->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]); } - public function testCreateTestClock() + public function testChargesGet2() { - $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); + $this->expectsRequest('get', '/v1/charges/ch_xxxxxxxxxxxxx'); + $result = $this->client->charges->retrieve('ch_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Charge::class, $result); } - public function testDeleteTestClock() + public function testChargesPost() { - $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); + $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 at https://www.stripe.com/docs/api)', + ]); + static::assertInstanceOf(\Stripe\Charge::class, $result); } - public function testRetrieveTestClock() + public function testChargesPost2() { - $this->expectsRequest('get', '/v1/test_helpers/test_clocks/clock_xyz'); - $result = $this->client->testHelpers->testClocks->retrieve( - 'clock_xyz', - [] + $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx'); + $result = $this->client->charges->update( + 'ch_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + static::assertInstanceOf(\Stripe\Charge::class, $result); } - public function testAdvanceTestClock() + public function testChargesSearchGet() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/test_clocks/clock_xyz/advance' - ); - $result = $this->client->testHelpers->testClocks->advance( - 'clock_xyz', - ['frozen_time' => 142] - ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + $this->expectsRequest('get', '/v1/charges/search'); + $result = $this->client->charges->search([ + 'query' => 'amount>999 AND metadata[\'order_id\']:\'6735\'', + ]); + static::assertInstanceOf(\Stripe\SearchResult::class, $result); + static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]); } - public function testFailInboundTransfer() + public function testCheckoutSessionsExpirePost() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/treasury/inbound_transfers/ibt_123/fail' - ); - $result = $this->client->testHelpers->treasury->inboundTransfers->fail( - 'ibt_123', - ['failure_details' => ['code' => 'account_closed']] - ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::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 testReturnInboundTransferInboundTransfer() + public function testCheckoutSessionsExpirePost2() { $this->expectsRequest( 'post', - '/v1/test_helpers/treasury/inbound_transfers/ibt_123/return' + '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire' ); - $result = $this->client->testHelpers->treasury->inboundTransfers->returnInboundTransfer( - 'ibt_123', + $result = $this->client->checkout->sessions->expire( + 'cs_test_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testSucceedInboundTransfer() + public function testCheckoutSessionsGet() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/treasury/inbound_transfers/ibt_123/succeed' - ); - $result = $this->client->testHelpers->treasury->inboundTransfers->succeed( - 'ibt_123', - [] - ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + $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]); } - public function testFailOutboundTransfer() + public function testCheckoutSessionsGet2() { $this->expectsRequest( - 'post', - '/v1/test_helpers/treasury/outbound_transfers/obt_123/fail' + 'get', + '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->treasury->outboundTransfers->fail( - 'obt_123', + $result = $this->client->checkout->sessions->retrieve( + 'cs_test_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testPostOutboundTransfer() + public function testCheckoutSessionsLineItemsGet() { $this->expectsRequest( - 'post', - '/v1/test_helpers/treasury/outbound_transfers/obt_123/post' + 'get', + '/v1/checkout/sessions/sess_xyz/line_items' ); - $result = $this->client->testHelpers->treasury->outboundTransfers->post( - 'obt_123', + $result = $this->client->checkout->sessions->allLineItems( + 'sess_xyz', [] ); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); - } - - public function testReturnOutboundTransferOutboundTransfer() - { - $this->expectsRequest( - 'post', - '/v1/test_helpers/treasury/outbound_transfers/obt_123/return' - ); - $result = $this->client->testHelpers->treasury->outboundTransfers->returnOutboundTransfer( - 'obt_123', - ['returned_details' => ['code' => 'account_closed']] - ); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); } - public function testCreateReceivedCredit() + public function testCheckoutSessionsPost() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/treasury/received_credits' - ); - $result = $this->client->testHelpers->treasury->receivedCredits->create([ - 'financial_account' => 'fa_123', - 'network' => 'ach', - 'amount' => 1234, - 'currency' => 'usd', + $this->expectsRequest('post', '/v1/checkout/sessions'); + $result = $this->client->checkout->sessions->create([ + 'success_url' => 'https://example.com/success', + 'cancel_url' => 'https://example.com/cancel', + 'mode' => 'payment', + 'shipping_options' => [ + ['shipping_rate' => 'shr_standard'], + [ + 'shipping_rate_data' => [ + 'display_name' => 'Standard', + 'delivery_estimate' => [ + 'minimum' => [ + 'unit' => 'day', + 'value' => 5, + ], + 'maximum' => [ + 'unit' => 'day', + 'value' => 7, + ], + ], + ], + ], + ], ]); - static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testCreateReceivedDebit() + public function testCheckoutSessionsPost2() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/treasury/received_debits' - ); - $result = $this->client->testHelpers->treasury->receivedDebits->create([ - 'financial_account' => 'fa_123', - 'network' => 'ach', - 'amount' => 1234, - 'currency' => 'usd', + $this->expectsRequest('post', '/v1/checkout/sessions'); + $result = $this->client->checkout->sessions->create([ + 'success_url' => 'https://example.com/success', + 'line_items' => [ + [ + 'price' => 'price_xxxxxxxxxxxxx', + 'quantity' => 2, + ], + ], + 'mode' => 'payment', ]); - static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result); + static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); } - public function testCreateToken() + public function testCountrySpecsGet() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create([ - 'card' => [ - 'number' => '4242424242424242', - 'exp_month' => '5', - 'exp_year' => '2023', - 'cvc' => '314', - ], - ]); - static::assertInstanceOf(\Stripe\Token::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 testCreateAccountLink() + public function testCountrySpecsGet2() { - $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/country_specs/US'); + $result = $this->client->countrySpecs->retrieve('US', []); + static::assertInstanceOf(\Stripe\CountrySpec::class, $result); } - public function testListAccount2() + public function testCouponsDelete() { - $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/coupons/Z4OV52SU'); + $result = $this->client->coupons->delete('Z4OV52SU', []); + static::assertInstanceOf(\Stripe\Coupon::class, $result); } - public function testCreateAccount() + public function testCouponsGet() { - $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); + $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 testDeleteAccount() + public function testCouponsGet2() { - $this->expectsRequest('delete', '/v1/accounts/acct_xxxxxxxxxxxxx'); - $result = $this->client->accounts->delete('acct_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Account::class, $result); + $this->expectsRequest('get', '/v1/coupons/Z4OV52SU'); + $result = $this->client->coupons->retrieve('Z4OV52SU', []); + static::assertInstanceOf(\Stripe\Coupon::class, $result); } - public function testRetrieveAccount2() + public function testCouponsPost() { - $this->expectsRequest('get', '/v1/accounts/acct_xxxxxxxxxxxxx'); - $result = $this->client->accounts->retrieve('acct_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Account::class, $result); + $this->expectsRequest('post', '/v1/coupons'); + $result = $this->client->coupons->create([ + 'percent_off' => 25.5, + 'duration' => 'repeating', + 'duration_in_months' => 3, + ]); + static::assertInstanceOf(\Stripe\Coupon::class, $result); } - public function testUpdateAccount() + public function testCouponsPost2() { - $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx'); - $result = $this->client->accounts->update( - 'acct_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/coupons/Z4OV52SU'); + $result = $this->client->coupons->update( + 'Z4OV52SU', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Account::class, $result); + static::assertInstanceOf(\Stripe\Coupon::class, $result); } - public function testRejectAccount() + public function testCreditNotesGet() { - $this->expectsRequest('post', '/v1/accounts/acct_xxxxxxxxxxxxx/reject'); - $result = $this->client->accounts->reject( - 'acct_xxxxxxxxxxxxx', - ['reason' => 'fraud'] - ); - static::assertInstanceOf(\Stripe\Account::class, $result); + $this->expectsRequest('get', '/v1/credit_notes'); + $result = $this->client->creditNotes->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\CreditNote::class, $result->data[0]); } - public function testListCapability() + public function testCreditNotesLinesGet() { - $this->expectsRequest( - 'get', - '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities' - ); - $result = $this->client->accounts->allCapabilities( - 'acct_xxxxxxxxxxxxx', - [] + $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\Capability::class, $result->data[0]); + static::assertInstanceOf(\Stripe\CreditNoteLineItem::class, $result->data[0]); } - public function testRetrieveCapability() + public function testCreditNotesPost() { - $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('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\CreditNote::class, $result); } - public function testUpdateCapability() + public function testCreditNotesPreviewGet() { - $this->expectsRequest( - 'post', - '/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments' - ); - $result = $this->client->accounts->updateCapability( - 'acct_xxxxxxxxxxxxx', - 'card_payments', - ['requested' => true] - ); - static::assertInstanceOf(\Stripe\Capability::class, $result); + $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\CreditNote::class, $result); } - public function testCreateLoginLink() + public function testCreditNotesPreviewLinesGet() { - $this->expectsRequest( - 'post', - '/v1/accounts/acct_xxxxxxxxxxxxx/login_links' - ); - $result = $this->client->accounts->createLoginLink( - 'acct_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\LoginLink::class, $result); + $this->expectsRequest('get', '/v1/credit_notes/preview/lines'); + $result = $this->client->creditNotes->previewLines([ + 'limit' => 3, + 'invoice' => 'in_xxxxxxxxxxxxx', + ]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\CreditNoteLineItem::class, $result->data[0]); } - public function testListPerson() + public function testCreditNotesVoidPost() { - $this->expectsRequest('get', '/v1/accounts/acct_xxxxxxxxxxxxx/persons'); - $result = $this->client->accounts->allPersons( - 'acct_xxxxxxxxxxxxx', - ['limit' => 3] + $this->expectsRequest('post', '/v1/credit_notes/cn_xxxxxxxxxxxxx/void'); + $result = $this->client->creditNotes->voidCreditNote( + 'cn_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Person::class, $result->data[0]); + static::assertInstanceOf(\Stripe\CreditNote::class, $result); } - public function testCreatePerson() + public function testCustomersBalanceTransactionsGet() { $this->expectsRequest( - 'post', - '/v1/accounts/acct_xxxxxxxxxxxxx/persons' + 'get', + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' ); - $result = $this->client->accounts->createPerson( - 'acct_xxxxxxxxxxxxx', - [ - 'first_name' => 'Jane', - 'last_name' => 'Diaz', - ] + $result = $this->client->customers->allBalanceTransactions( + 'cus_xxxxxxxxxxxxx', + ['limit' => 3] ); - static::assertInstanceOf(\Stripe\Person::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result->data[0]); } - public function testDeletePerson() + public function testCustomersBalanceTransactionsGet2() { $this->expectsRequest( - 'delete', - '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' + 'get', + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' ); - $result = $this->client->accounts->deletePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx', + $result = $this->client->customers->retrieveBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + 'cbtxn_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Person::class, $result); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } - public function testRetrievePerson() + public function testCustomersBalanceTransactionsPost() { $this->expectsRequest( - 'get', - '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' + 'post', + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' ); - $result = $this->client->accounts->retrievePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx', - [] + $result = $this->client->customers->createBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + [ + 'amount' => -500, + 'currency' => 'usd', + ] ); - static::assertInstanceOf(\Stripe\Person::class, $result); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } - public function testUpdatePerson() + public function testCustomersBalanceTransactionsPost2() { $this->expectsRequest( 'post', - '/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx' + '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' ); - $result = $this->client->accounts->updatePerson( - 'acct_xxxxxxxxxxxxx', - 'person_xxxxxxxxxxxxx', + $result = $this->client->customers->updateBalanceTransaction( + 'cus_xxxxxxxxxxxxx', + 'cbtxn_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Person::class, $result); + static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); } - public function testListApplicationFee() + public function testCustomersCashBalanceGet() { - $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('get', '/v1/customers/cus_123/cash_balance'); + $result = $this->client->customers->retrieveCashBalance('cus_123', []); + static::assertInstanceOf(\Stripe\CashBalance::class, $result); } - public function testRetrieveApplicationFee() + public function testCustomersCashBalancePost() { - $this->expectsRequest('get', '/v1/application_fees/fee_xxxxxxxxxxxxx'); - $result = $this->client->applicationFees->retrieve( - 'fee_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/customers/cus_123/cash_balance'); + $result = $this->client->customers->updateCashBalance( + 'cus_123', + ['settings' => ['reconciliation_mode' => 'manual']] ); - static::assertInstanceOf(\Stripe\ApplicationFee::class, $result); + static::assertInstanceOf(\Stripe\CashBalance::class, $result); } - public function testListApplicationFeeRefund() + public function testCustomersDelete() { - $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('delete', '/v1/customers/cus_xxxxxxxxxxxxx'); + $result = $this->client->customers->delete('cus_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testCreateApplicationFeeRefund() + public function testCustomersFundingInstructionsPost() { $this->expectsRequest( 'post', - '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds' + '/v1/customers/cus_123/funding_instructions' ); - $result = $this->client->applicationFees->createRefund( - 'fee_xxxxxxxxxxxxx', - [] + $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\ApplicationFeeRefund::class, $result); + static::assertInstanceOf(\Stripe\FundingInstructions::class, $result); } - public function testRetrieveApplicationFeeRefund() + public function testCustomersGet() { - $this->expectsRequest( - 'get', - '/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx' - ); - $result = $this->client->applicationFees->retrieveRefund( - 'fee_xxxxxxxxxxxxx', - 'fr_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\ApplicationFeeRefund::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 testUpdateApplicationFeeRefund() + public function testCustomersGet2() { - $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/customers'); + $result = $this->client->customers->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); } - public function testListSecret2() + public function testCustomersGet3() { - $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]); + $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx'); + $result = $this->client->customers->retrieve('cus_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testCreateSecret2() + public function testCustomersPost() { - $this->expectsRequest('post', '/v1/apps/secrets'); - $result = $this->client->apps->secrets->create([ - 'name' => 'my-api-key', - 'payload' => 'secret_key_xxxxxx', - 'scope' => ['type' => 'account'], + $this->expectsRequest('post', '/v1/customers'); + $result = $this->client->customers->create([ + 'description' => 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)', ]); - static::assertInstanceOf(\Stripe\Apps\Secret::class, $result); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testListBalanceTransaction() + public function testCustomersPost2() { - $this->expectsRequest('get', '/v1/balance_transactions'); - $result = $this->client->balanceTransactions->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\BalanceTransaction::class, $result->data[0]); + $this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx'); + $result = $this->client->customers->update( + 'cus_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Customer::class, $result); } - public function testRetrieveBalanceTransaction() + public function testCustomersSearchGet() { - $this->expectsRequest( - 'get', - '/v1/balance_transactions/txn_xxxxxxxxxxxxx' - ); - $result = $this->client->balanceTransactions->retrieve( - 'txn_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\BalanceTransaction::class, $result); + $this->expectsRequest('get', '/v1/customers/search'); + $result = $this->client->customers->search([ + 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'', + ]); + static::assertInstanceOf(\Stripe\SearchResult::class, $result); + static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); } - public function testListConfiguration2() + public function testCustomersSearchGet2() { - $this->expectsRequest('get', '/v1/billing_portal/configurations'); - $result = $this->client->billingPortal->configurations->all([ - 'limit' => 3, + $this->expectsRequest('get', '/v1/customers/search'); + $result = $this->client->customers->search([ + 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'', ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result->data[0]); + static::assertInstanceOf(\Stripe\SearchResult::class, $result); + static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); } - public function testRetrieveConfiguration2() + public function testCustomersTaxIdsDelete() { $this->expectsRequest( - 'get', - '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' - ); - $result = $this->client->billingPortal->configurations->retrieve( - 'bpc_xxxxxxxxxxxxx', + 'delete', + '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx' + ); + $result = $this->client->customers->deleteTaxId( + 'cus_xxxxxxxxxxxxx', + 'txi_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); + static::assertInstanceOf(\Stripe\TaxId::class, $result); + } + + public function testCustomersTaxIdsGet() + { + $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids'); + $result = $this->client->customers->allTaxIds( + 'cus_xxxxxxxxxxxxx', + ['limit' => 3] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\TaxId::class, $result->data[0]); + } + + public function testCustomersTaxIdsGet2() + { + $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 testUpdateConfiguration2() + public function testCustomersTaxIdsPost() { $this->expectsRequest( 'post', - '/v1/billing_portal/configurations/bpc_xxxxxxxxxxxxx' + '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids' ); - $result = $this->client->billingPortal->configurations->update( - 'bpc_xxxxxxxxxxxxx', + $result = $this->client->customers->createTaxId( + 'cus_xxxxxxxxxxxxx', [ - 'business_profile' => [ - 'privacy_policy_url' => 'https://example.com/privacy', - 'terms_of_service_url' => 'https://example.com/terms', - ], + 'type' => 'eu_vat', + 'value' => 'DE123456789', ] ); - static::assertInstanceOf(\Stripe\BillingPortal\Configuration::class, $result); + static::assertInstanceOf(\Stripe\TaxId::class, $result); } - public function testCreateSession3() + public function testDisputesClosePost() { - $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\BillingPortal\Session::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 testListCharge() + public function testDisputesGet() { - $this->expectsRequest('get', '/v1/charges'); - $result = $this->client->charges->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/disputes'); + $result = $this->client->disputes->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Dispute::class, $result->data[0]); } - public function testCreateCharge() + public function testDisputesGet2() { - $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 at https://www.stripe.com/docs/api)', - ]); - static::assertInstanceOf(\Stripe\Charge::class, $result); + $this->expectsRequest('get', '/v1/disputes/dp_xxxxxxxxxxxxx'); + $result = $this->client->disputes->retrieve('dp_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Dispute::class, $result); } - public function testRetrieveCharge() + public function testDisputesPost() { - $this->expectsRequest('get', '/v1/charges/ch_xxxxxxxxxxxxx'); - $result = $this->client->charges->retrieve('ch_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Charge::class, $result); + $this->expectsRequest('post', '/v1/disputes/dp_xxxxxxxxxxxxx'); + $result = $this->client->disputes->update( + 'dp_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Dispute::class, $result); } - public function testUpdateCharge() + public function testEventsGet() { - $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx'); - $result = $this->client->charges->update( - 'ch_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Charge::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 testCaptureCharge() + public function testEventsGet2() { - $this->expectsRequest('post', '/v1/charges/ch_xxxxxxxxxxxxx/capture'); - $result = $this->client->charges->capture('ch_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Charge::class, $result); + $this->expectsRequest('get', '/v1/events/evt_xxxxxxxxxxxxx'); + $result = $this->client->events->retrieve('evt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Event::class, $result); } - public function testSearchCharge() + public function testFileLinksGet() { - $this->expectsRequest('get', '/v1/charges/search'); - $result = $this->client->charges->search([ - 'query' => 'amount>999 AND metadata[\'order_id\']:\'6735\'', + $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 testFileLinksGet2() + { + $this->expectsRequest('get', '/v1/file_links/link_xxxxxxxxxxxxx'); + $result = $this->client->fileLinks->retrieve('link_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\FileLink::class, $result); + } + + public function testFileLinksPost() + { + $this->expectsRequest('post', '/v1/file_links'); + $result = $this->client->fileLinks->create([ + 'file' => 'file_xxxxxxxxxxxxx', ]); - static::assertInstanceOf(\Stripe\SearchResult::class, $result); - static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]); + static::assertInstanceOf(\Stripe\FileLink::class, $result); } - public function testListSession() + public function testFileLinksPost2() { - $this->expectsRequest('get', '/v1/checkout/sessions'); - $result = $this->client->checkout->sessions->all(['limit' => 3]); + $this->expectsRequest('post', '/v1/file_links/link_xxxxxxxxxxxxx'); + $result = $this->client->fileLinks->update( + 'link_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\FileLink::class, $result); + } + + public function testFilesGet() + { + $this->expectsRequest('get', '/v1/files'); + $result = $this->client->files->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result->data[0]); + static::assertInstanceOf(\Stripe\File::class, $result->data[0]); } - public function testCreateSession4() + public function testFilesGet2() { - $this->expectsRequest('post', '/v1/checkout/sessions'); - $result = $this->client->checkout->sessions->create([ - 'success_url' => 'https://example.com/success', - 'line_items' => [ - [ - 'price' => 'price_xxxxxxxxxxxxx', - 'quantity' => 2, - ], - ], - 'mode' => 'payment', - ]); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + $this->expectsRequest('get', '/v1/files/file_xxxxxxxxxxxxx'); + $result = $this->client->files->retrieve('file_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\File::class, $result); } - public function testRetrieveSession2() + public function testFinancialConnectionsAccountsDisconnectPost() { $this->expectsRequest( - 'get', - '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx' + 'post', + '/v1/financial_connections/accounts/fca_xyz/disconnect' ); - $result = $this->client->checkout->sessions->retrieve( - 'cs_test_xxxxxxxxxxxxx', + $result = $this->client->financialConnections->accounts->disconnect( + 'fca_xyz', [] ); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testExpireSession2() + public function testFinancialConnectionsAccountsDisconnectPost2() { $this->expectsRequest( 'post', - '/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire' + '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/disconnect' ); - $result = $this->client->checkout->sessions->expire( - 'cs_test_xxxxxxxxxxxxx', + $result = $this->client->financialConnections->accounts->disconnect( + 'fca_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Checkout\Session::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testListCountrySpec() + public function testFinancialConnectionsAccountsGet() { - $this->expectsRequest('get', '/v1/country_specs'); - $result = $this->client->countrySpecs->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/financial_connections/accounts'); + $result = $this->client->financialConnections->accounts->all([]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CountrySpec::class, $result->data[0]); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]); } - public function testRetrieveCountrySpec() + public function testFinancialConnectionsAccountsGet2() { - $this->expectsRequest('get', '/v1/country_specs/US'); - $result = $this->client->countrySpecs->retrieve('US', []); - static::assertInstanceOf(\Stripe\CountrySpec::class, $result); + $this->expectsRequest( + 'get', + '/v1/financial_connections/accounts/fca_xyz' + ); + $result = $this->client->financialConnections->accounts->retrieve( + 'fca_xyz', + [] + ); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testListCoupon() + public function testFinancialConnectionsAccountsGet3() { - $this->expectsRequest('get', '/v1/coupons'); - $result = $this->client->coupons->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/financial_connections/accounts'); + $result = $this->client->financialConnections->accounts->all([ + 'account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx'], + ]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Coupon::class, $result->data[0]); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]); } - public function testCreateCoupon() + public function testFinancialConnectionsAccountsGet4() { - $this->expectsRequest('post', '/v1/coupons'); - $result = $this->client->coupons->create([ - 'percent_off' => 25.5, - 'duration' => 'repeating', - 'duration_in_months' => 3, - ]); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + $this->expectsRequest( + 'get', + '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx' + ); + $result = $this->client->financialConnections->accounts->retrieve( + 'fca_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testDeleteCoupon() + public function testFinancialConnectionsAccountsOwnersGet() { - $this->expectsRequest('delete', '/v1/coupons/Z4OV52SU'); - $result = $this->client->coupons->delete('Z4OV52SU', []); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + $this->expectsRequest( + 'get', + '/v1/financial_connections/accounts/fca_xyz/owners' + ); + $result = $this->client->financialConnections->accounts->allOwners( + 'fca_xyz', + ['ownership' => 'fcaowns_xyz'] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]); } - public function testRetrieveCoupon() + public function testFinancialConnectionsAccountsOwnersGet2() { - $this->expectsRequest('get', '/v1/coupons/Z4OV52SU'); - $result = $this->client->coupons->retrieve('Z4OV52SU', []); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + $this->expectsRequest( + 'get', + '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/owners' + ); + $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 testUpdateCoupon() + public function testFinancialConnectionsAccountsRefreshPost() { - $this->expectsRequest('post', '/v1/coupons/Z4OV52SU'); - $result = $this->client->coupons->update( - 'Z4OV52SU', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'post', + '/v1/financial_connections/accounts/fca_xyz/refresh' ); - static::assertInstanceOf(\Stripe\Coupon::class, $result); + $result = $this->client->financialConnections->accounts->refresh( + 'fca_xyz', + ['features' => ['balance']] + ); + static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); } - public function testListCreditNote() + public function testFinancialConnectionsSessionsGet() { - $this->expectsRequest('get', '/v1/credit_notes'); - $result = $this->client->creditNotes->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CreditNote::class, $result->data[0]); - } - - public function testCreateCreditNote() - { - $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\CreditNote::class, $result); - } - - public function testVoidCreditNoteCreditNote() - { - $this->expectsRequest('post', '/v1/credit_notes/cn_xxxxxxxxxxxxx/void'); - $result = $this->client->creditNotes->voidCreditNote( - 'cn_xxxxxxxxxxxxx', + $this->expectsRequest( + 'get', + '/v1/financial_connections/sessions/fcsess_xyz' + ); + $result = $this->client->financialConnections->sessions->retrieve( + 'fcsess_xyz', [] ); - static::assertInstanceOf(\Stripe\CreditNote::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } - public function testListCreditNoteLineItem() + public function testFinancialConnectionsSessionsGet2() { - $this->expectsRequest('get', '/v1/credit_notes/cn_xxxxxxxxxxxxx/lines'); - $result = $this->client->creditNotes->allLines( - 'cn_xxxxxxxxxxxxx', - ['limit' => 3] + $this->expectsRequest( + 'get', + '/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CreditNoteLineItem::class, $result->data[0]); + $result = $this->client->financialConnections->sessions->retrieve( + 'fcsess_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } - public function testPreviewCreditNote() + public function testFinancialConnectionsSessionsPost() { - $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, - ], + $this->expectsRequest('post', '/v1/financial_connections/sessions'); + $result = $this->client->financialConnections->sessions->create([ + 'account_holder' => [ + 'type' => 'customer', + 'customer' => 'cus_123', ], + 'permissions' => ['balances'], ]); - static::assertInstanceOf(\Stripe\CreditNote::class, $result); - } - - public function testListCustomer() - { - $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 testListCustomer2() - { - $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]); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } - public function testCreateCustomer() + public function testFinancialConnectionsSessionsPost2() { - $this->expectsRequest('post', '/v1/customers'); - $result = $this->client->customers->create([ - 'description' => 'My First Test Customer (created for API docs at https://www.stripe.com/docs/api)', + $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\Customer::class, $result); - } - - public function testDeleteCustomer() - { - $this->expectsRequest('delete', '/v1/customers/cus_xxxxxxxxxxxxx'); - $result = $this->client->customers->delete('cus_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Customer::class, $result); - } - - public function testRetrieveCustomer() - { - $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx'); - $result = $this->client->customers->retrieve('cus_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Customer::class, $result); + static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); } - public function testUpdateCustomer() + public function testIdentityVerificationReportsGet() { - $this->expectsRequest('post', '/v1/customers/cus_xxxxxxxxxxxxx'); - $result = $this->client->customers->update( - 'cus_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Customer::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 testListCustomerBalanceTransaction() + public function testIdentityVerificationReportsGet2() { $this->expectsRequest( 'get', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' + '/v1/identity/verification_reports/vr_xxxxxxxxxxxxx' ); - $result = $this->client->customers->allBalanceTransactions( - 'cus_xxxxxxxxxxxxx', - ['limit' => 3] + $result = $this->client->identity->verificationReports->retrieve( + 'vr_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Identity\VerificationReport::class, $result); } - public function testCreateCustomerBalanceTransaction() + public function testIdentityVerificationSessionsCancelPost() { $this->expectsRequest( 'post', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions' + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel' ); - $result = $this->client->customers->createBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - [ - 'amount' => -500, - 'currency' => 'usd', - ] + $result = $this->client->identity->verificationSessions->cancel( + 'vs_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testRetrieveCustomerBalanceTransaction() + public function testIdentityVerificationSessionsGet() { - $this->expectsRequest( - 'get', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' - ); - $result = $this->client->customers->retrieveBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - 'cbtxn_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::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 testUpdateCustomerBalanceTransaction() + public function testIdentityVerificationSessionsGet2() { $this->expectsRequest( - 'post', - '/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx' + 'get', + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' ); - $result = $this->client->customers->updateBalanceTransaction( - 'cus_xxxxxxxxxxxxx', - 'cbtxn_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $result = $this->client->identity->verificationSessions->retrieve( + 'vs_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testListTaxId() + public function testIdentityVerificationSessionsPost() { - $this->expectsRequest('get', '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids'); - $result = $this->client->customers->allTaxIds( - 'cus_xxxxxxxxxxxxx', - ['limit' => 3] - ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TaxId::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 testCreateTaxId() + public function testIdentityVerificationSessionsPost2() { $this->expectsRequest( 'post', - '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids' - ); - $result = $this->client->customers->createTaxId( - 'cus_xxxxxxxxxxxxx', - [ - 'type' => 'eu_vat', - 'value' => 'DE123456789', - ] - ); - static::assertInstanceOf(\Stripe\TaxId::class, $result); - } - - public function testDeleteTaxId() - { - $this->expectsRequest( - 'delete', - '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx' + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' ); - $result = $this->client->customers->deleteTaxId( - 'cus_xxxxxxxxxxxxx', - 'txi_xxxxxxxxxxxxx', - [] + $result = $this->client->identity->verificationSessions->update( + 'vs_xxxxxxxxxxxxx', + ['type' => 'id_number'] ); - static::assertInstanceOf(\Stripe\TaxId::class, $result); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testRetrieveTaxId() + public function testIdentityVerificationSessionsRedactPost() { $this->expectsRequest( - 'get', - '/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx' + 'post', + '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact' ); - $result = $this->client->customers->retrieveTaxId( - 'cus_xxxxxxxxxxxxx', - 'txi_xxxxxxxxxxxxx', + $result = $this->client->identity->verificationSessions->redact( + 'vs_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\TaxId::class, $result); + static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); } - public function testSearchCustomer() + public function testInvoiceitemsDelete() { - $this->expectsRequest('get', '/v1/customers/search'); - $result = $this->client->customers->search([ - 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'', - ]); - static::assertInstanceOf(\Stripe\SearchResult::class, $result); - static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); + $this->expectsRequest('delete', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); + $result = $this->client->invoiceItems->delete('ii_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); } - public function testSearchCustomer2() + public function testInvoiceitemsGet() { - $this->expectsRequest('get', '/v1/customers/search'); - $result = $this->client->customers->search([ - 'query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'', - ]); - static::assertInstanceOf(\Stripe\SearchResult::class, $result); - static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]); + $this->expectsRequest('get', '/v1/invoiceitems'); + $result = $this->client->invoiceItems->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result->data[0]); } - public function testListDispute() + public function testInvoiceitemsGet2() { - $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]); + $this->expectsRequest('get', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); + $result = $this->client->invoiceItems->retrieve('ii_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); } - public function testRetrieveDispute() + public function testInvoiceitemsPost() { - $this->expectsRequest('get', '/v1/disputes/dp_xxxxxxxxxxxxx'); - $result = $this->client->disputes->retrieve('dp_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Dispute::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 testUpdateDispute() + public function testInvoiceitemsPost2() { - $this->expectsRequest('post', '/v1/disputes/dp_xxxxxxxxxxxxx'); - $result = $this->client->disputes->update( - 'dp_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); + $result = $this->client->invoiceItems->update( + 'ii_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Dispute::class, $result); + static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); } - public function testCloseDispute() + public function testInvoicesDelete() { - $this->expectsRequest('post', '/v1/disputes/dp_xxxxxxxxxxxxx/close'); - $result = $this->client->disputes->close('dp_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Dispute::class, $result); + $this->expectsRequest('delete', '/v1/invoices/in_xxxxxxxxxxxxx'); + $result = $this->client->invoices->delete('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testListEvent() + public function testInvoicesFinalizePost() { - $this->expectsRequest('get', '/v1/events'); - $result = $this->client->events->all(['limit' => 3]); + $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/finalize'); + $result = $this->client->invoices->finalizeInvoice( + 'in_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Invoice::class, $result); + } + + public function testInvoicesGet() + { + $this->expectsRequest('get', '/v1/invoices'); + $result = $this->client->invoices->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Event::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]); } - public function testRetrieveEvent() + public function testInvoicesGet2() { - $this->expectsRequest('get', '/v1/events/evt_xxxxxxxxxxxxx'); - $result = $this->client->events->retrieve('evt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Event::class, $result); + $this->expectsRequest('get', '/v1/invoices/in_xxxxxxxxxxxxx'); + $result = $this->client->invoices->retrieve('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testListFileLink() + public function testInvoicesGet3() { - $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]); + $this->expectsRequest('get', '/v1/invoices/in_xxxxxxxxxxxxx'); + $result = $this->client->invoices->retrieve( + 'in_xxxxxxxxxxxxx', + ['expand' => ['customer']] + ); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testCreateFileLink() + public function testInvoicesMarkUncollectiblePost() { - $this->expectsRequest('post', '/v1/file_links'); - $result = $this->client->fileLinks->create([ - 'file' => 'file_xxxxxxxxxxxxx', - ]); - static::assertInstanceOf(\Stripe\FileLink::class, $result); + $this->expectsRequest( + 'post', + '/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible' + ); + $result = $this->client->invoices->markUncollectible( + 'in_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testRetrieveFileLink() + public function testInvoicesPayPost() { - $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/invoices/in_xxxxxxxxxxxxx/pay'); + $result = $this->client->invoices->pay('in_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testUpdateFileLink() + public function testInvoicesPost() { - $this->expectsRequest('post', '/v1/file_links/link_xxxxxxxxxxxxx'); - $result = $this->client->fileLinks->update( - 'link_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/invoices'); + $result = $this->client->invoices->create([ + 'customer' => 'cus_xxxxxxxxxxxxx', + ]); + static::assertInstanceOf(\Stripe\Invoice::class, $result); + } + + public function testInvoicesPost2() + { + $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx'); + $result = $this->client->invoices->update( + 'in_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\FileLink::class, $result); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testListFile() + public function testInvoicesSearchGet() { - $this->expectsRequest('get', '/v1/files'); - $result = $this->client->files->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\File::class, $result->data[0]); + $this->expectsRequest('get', '/v1/invoices/search'); + $result = $this->client->invoices->search([ + 'query' => 'total>999 AND metadata[\'order_id\']:\'6735\'', + ]); + static::assertInstanceOf(\Stripe\SearchResult::class, $result); + static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]); } - public function testRetrieveFile() + public function testInvoicesSendPost() { - $this->expectsRequest('get', '/v1/files/file_xxxxxxxxxxxxx'); - $result = $this->client->files->retrieve('file_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\File::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 testListAccount3() + public function testInvoicesUpcomingGet() { - $this->expectsRequest('get', '/v1/financial_connections/accounts'); - $result = $this->client->financialConnections->accounts->all([ - 'account_holder' => ['customer' => 'cus_xxxxxxxxxxxxx'], + $this->expectsRequest('get', '/v1/invoices/upcoming'); + $result = $this->client->invoices->upcoming([ + 'customer' => 'cus_9utnxg47pWjV1e', ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Invoice::class, $result); } - public function testRetrieveAccount3() + public function testInvoicesVoidPost() { - $this->expectsRequest( - 'get', - '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx' - ); - $result = $this->client->financialConnections->accounts->retrieve( - 'fca_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::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 testDisconnectAccount2() + public function testIssuingAuthorizationsApprovePost() { $this->expectsRequest( 'post', - '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/disconnect' + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve' ); - $result = $this->client->financialConnections->accounts->disconnect( - 'fca_xxxxxxxxxxxxx', + $result = $this->client->issuing->authorizations->approve( + 'iauth_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Account::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testListOwnersAccount2() + public function testIssuingAuthorizationsDeclinePost() { $this->expectsRequest( - 'get', - '/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/owners' + 'post', + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline' ); - $result = $this->client->financialConnections->accounts->allOwners( - 'fca_xxxxxxxxxxxxx', - [ - 'limit' => 3, - 'ownership' => 'fcaowns_xxxxxxxxxxxxx', - ] + $result = $this->client->issuing->authorizations->decline( + 'iauth_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\FinancialConnections\AccountOwner::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testCreateSession5() + public function testIssuingAuthorizationsGet() { - $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); + $this->expectsRequest('get', '/v1/issuing/authorizations'); + $result = $this->client->issuing->authorizations->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result->data[0]); } - public function testRetrieveSession3() + public function testIssuingAuthorizationsGet2() { $this->expectsRequest( 'get', - '/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx' + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' ); - $result = $this->client->financialConnections->sessions->retrieve( - 'fcsess_xxxxxxxxxxxxx', + $result = $this->client->issuing->authorizations->retrieve( + 'iauth_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\FinancialConnections\Session::class, $result); - } - - public function testListVerificationReport() - { - $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]); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testRetrieveVerificationReport() + public function testIssuingAuthorizationsPost() { $this->expectsRequest( - 'get', - '/v1/identity/verification_reports/vr_xxxxxxxxxxxxx' + 'post', + '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' ); - $result = $this->client->identity->verificationReports->retrieve( - 'vr_xxxxxxxxxxxxx', - [] + $result = $this->client->issuing->authorizations->update( + 'iauth_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Identity\VerificationReport::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testListVerificationSession() + public function testIssuingCardholdersGet() { - $this->expectsRequest('get', '/v1/identity/verification_sessions'); - $result = $this->client->identity->verificationSessions->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\Identity\VerificationSession::class, $result->data[0]); - } - - public function testCreateVerificationSession() - { - $this->expectsRequest('post', '/v1/identity/verification_sessions'); - $result = $this->client->identity->verificationSessions->create([ - 'type' => 'document', - ]); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result->data[0]); } - public function testRetrieveVerificationSession() + public function testIssuingCardholdersGet2() { $this->expectsRequest( 'get', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' + '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx' ); - $result = $this->client->identity->verificationSessions->retrieve( - 'vs_xxxxxxxxxxxxx', + $result = $this->client->issuing->cardholders->retrieve( + 'ich_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); } - public function testUpdateVerificationSession() + public function testIssuingCardholdersPost() { - $this->expectsRequest( - 'post', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx' - ); - $result = $this->client->identity->verificationSessions->update( - 'vs_xxxxxxxxxxxxx', - ['type' => 'id_number'] - ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + $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\Issuing\Cardholder::class, $result); } - public function testCancelVerificationSession() + public function testIssuingCardholdersPost2() { $this->expectsRequest( 'post', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel' + '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx' ); - $result = $this->client->identity->verificationSessions->cancel( - 'vs_xxxxxxxxxxxxx', - [] + $result = $this->client->issuing->cardholders->update( + 'ich_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); } - public function testRedactVerificationSession() + public function testIssuingCardsGet() { - $this->expectsRequest( - 'post', - '/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact' - ); - $result = $this->client->identity->verificationSessions->redact( - 'vs_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/issuing/cards'); + $result = $this->client->issuing->cards->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result->data[0]); + } + + public function testIssuingCardsGet2() + { + $this->expectsRequest('get', '/v1/issuing/cards/ic_xxxxxxxxxxxxx'); + $result = $this->client->issuing->cards->retrieve( + 'ic_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Identity\VerificationSession::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); } - public function testListInvoiceItem() + public function testIssuingCardsPost() { - $this->expectsRequest('get', '/v1/invoiceitems'); - $result = $this->client->invoiceItems->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result->data[0]); - } - - public function testCreateInvoiceItem() - { - $this->expectsRequest('post', '/v1/invoiceitems'); - $result = $this->client->invoiceItems->create([ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'price' => 'price_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/issuing/cards'); + $result = $this->client->issuing->cards->create([ + 'cardholder' => 'ich_xxxxxxxxxxxxx', + 'currency' => 'usd', + 'type' => 'virtual', ]); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); - } - - public function testDeleteInvoiceItem() - { - $this->expectsRequest('delete', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); - $result = $this->client->invoiceItems->delete('ii_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); - } - - public function testRetrieveInvoiceItem() - { - $this->expectsRequest('get', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); - $result = $this->client->invoiceItems->retrieve('ii_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); } - public function testUpdateInvoiceItem() + public function testIssuingCardsPost2() { - $this->expectsRequest('post', '/v1/invoiceitems/ii_xxxxxxxxxxxxx'); - $result = $this->client->invoiceItems->update( - 'ii_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/issuing/cards/ic_xxxxxxxxxxxxx'); + $result = $this->client->issuing->cards->update( + 'ic_xxxxxxxxxxxxx', ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\InvoiceItem::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); } - public function testListInvoice() + public function testIssuingDisputesGet() { - $this->expectsRequest('get', '/v1/invoices'); - $result = $this->client->invoices->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\Invoice::class, $result->data[0]); - } - - public function testCreateInvoice() - { - $this->expectsRequest('post', '/v1/invoices'); - $result = $this->client->invoices->create([ - 'customer' => 'cus_xxxxxxxxxxxxx', - ]); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result->data[0]); } - public function testDeleteInvoice() + public function testIssuingDisputesGet2() { - $this->expectsRequest('delete', '/v1/invoices/in_xxxxxxxxxxxxx'); - $result = $this->client->invoices->delete('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $this->expectsRequest('get', '/v1/issuing/disputes/idp_xxxxxxxxxxxxx'); + $result = $this->client->issuing->disputes->retrieve( + 'idp_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); } - public function testRetrieveInvoice() + public function testIssuingDisputesPost() { - $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/disputes'); + $result = $this->client->issuing->disputes->create([ + 'transaction' => 'ipi_xxxxxxxxxxxxx', + 'evidence' => [ + 'reason' => 'fraudulent', + 'fraudulent' => ['explanation' => 'Purchase was unrecognized.'], + ], + ]); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); } - public function testRetrieveInvoice2() + public function testIssuingDisputesSubmitPost() { - $this->expectsRequest('get', '/v1/invoices/in_xxxxxxxxxxxxx'); - $result = $this->client->invoices->retrieve( - 'in_xxxxxxxxxxxxx', - ['expand' => ['customer']] + $this->expectsRequest( + 'post', + '/v1/issuing/disputes/idp_xxxxxxxxxxxxx/submit' ); - static::assertInstanceOf(\Stripe\Invoice::class, $result); + $result = $this->client->issuing->disputes->submit( + 'idp_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result); } - public function testUpdateInvoice() + public function testIssuingTransactionsGet() { - $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/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]); } - public function testFinalizeInvoiceInvoice() + public function testIssuingTransactionsGet2() { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/finalize'); - $result = $this->client->invoices->finalizeInvoice( - 'in_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 testMarkUncollectibleInvoice() + public function testIssuingTransactionsPost() { $this->expectsRequest( 'post', - '/v1/invoices/in_xxxxxxxxxxxxx/mark_uncollectible' + '/v1/issuing/transactions/ipi_xxxxxxxxxxxxx' ); - $result = $this->client->invoices->markUncollectible( - 'in_xxxxxxxxxxxxx', - [] + $result = $this->client->issuing->transactions->update( + 'ipi_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Invoice::class, $result); - } - - public function testPayInvoice() - { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/pay'); - $result = $this->client->invoices->pay('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); - } - - public function testSendInvoiceInvoice() - { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/send'); - $result = $this->client->invoices->sendInvoice('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); - } - - public function testVoidInvoiceInvoice() - { - $this->expectsRequest('post', '/v1/invoices/in_xxxxxxxxxxxxx/void'); - $result = $this->client->invoices->voidInvoice('in_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Invoice::class, $result); - } - - public function testSearchInvoice() - { - $this->expectsRequest('get', '/v1/invoices/search'); - $result = $this->client->invoices->search([ - 'query' => 'total>999 AND metadata[\'order_id\']:\'6735\'', - ]); - static::assertInstanceOf(\Stripe\SearchResult::class, $result); - static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); } - public function testListAuthorization() + public function testMandatesGet() { - $this->expectsRequest('get', '/v1/issuing/authorizations'); - $result = $this->client->issuing->authorizations->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result->data[0]); + $this->expectsRequest('get', '/v1/mandates/mandate_xxxxxxxxxxxxx'); + $result = $this->client->mandates->retrieve( + 'mandate_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Mandate::class, $result); } - public function testRetrieveAuthorization() + public function testPaymentIntentsApplyCustomerBalancePost() { $this->expectsRequest( - 'get', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' + 'post', + '/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance' ); - $result = $this->client->issuing->authorizations->retrieve( - 'iauth_xxxxxxxxxxxxx', + $result = $this->client->paymentIntents->applyCustomerBalance( + 'pi_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testUpdateAuthorization() + public function testPaymentIntentsCancelPost() { $this->expectsRequest( 'post', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx' - ); - $result = $this->client->issuing->authorizations->update( - 'iauth_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + '/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel' ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + $result = $this->client->paymentIntents->cancel('pi_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testApproveAuthorization() + public function testPaymentIntentsCapturePost() { $this->expectsRequest( 'post', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/approve' + '/v1/payment_intents/pi_xxxxxxxxxxxxx/capture' ); - $result = $this->client->issuing->authorizations->approve( - 'iauth_xxxxxxxxxxxxx', + $result = $this->client->paymentIntents->capture( + 'pi_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testDeclineAuthorization() + public function testPaymentIntentsConfirmPost() { $this->expectsRequest( 'post', - '/v1/issuing/authorizations/iauth_xxxxxxxxxxxxx/decline' + '/v1/payment_intents/pi_xxxxxxxxxxxxx/confirm' ); - $result = $this->client->issuing->authorizations->decline( - 'iauth_xxxxxxxxxxxxx', - [] + $result = $this->client->paymentIntents->confirm( + 'pi_xxxxxxxxxxxxx', + ['payment_method' => 'pm_card_visa'] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testListCardholder() + public function testPaymentIntentsGet() { - $this->expectsRequest('get', '/v1/issuing/cardholders'); - $result = $this->client->issuing->cardholders->all(['limit' => 3]); + $this->expectsRequest('get', '/v1/payment_intents'); + $result = $this->client->paymentIntents->all(['limit' => 3]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result->data[0]); - } - - public function testCreateCardholder() - { - $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\Issuing\Cardholder::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]); } - public function testRetrieveCardholder() + public function testPaymentIntentsGet2() { - $this->expectsRequest( - 'get', - '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx' - ); - $result = $this->client->issuing->cardholders->retrieve( - 'ich_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/payment_intents/pi_xxxxxxxxxxxxx'); + $result = $this->client->paymentIntents->retrieve( + 'pi_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testUpdateCardholder() + public function testPaymentIntentsIncrementAuthorizationPost() { $this->expectsRequest( 'post', - '/v1/issuing/cardholders/ich_xxxxxxxxxxxxx' + '/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization' ); - $result = $this->client->issuing->cardholders->update( - 'ich_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $result = $this->client->paymentIntents->incrementAuthorization( + 'pi_xxxxxxxxxxxxx', + ['amount' => 2099] ); - static::assertInstanceOf(\Stripe\Issuing\Cardholder::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testListCard() + public function testPaymentIntentsPost() { - $this->expectsRequest('get', '/v1/issuing/cards'); - $result = $this->client->issuing->cards->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result->data[0]); + $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); } - public function testCreateCard() + public function testPaymentIntentsPost2() { - $this->expectsRequest('post', '/v1/issuing/cards'); - $result = $this->client->issuing->cards->create([ - 'cardholder' => 'ich_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/payment_intents'); + $result = $this->client->paymentIntents->create([ + 'amount' => 2000, 'currency' => 'usd', - 'type' => 'virtual', + 'automatic_payment_methods' => ['enabled' => true], ]); - static::assertInstanceOf(\Stripe\Issuing\Card::class, $result); - } - - public function testRetrieveCard() - { - $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 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 testListDispute2() - { - $this->expectsRequest('get', '/v1/issuing/disputes'); - $result = $this->client->issuing->disputes->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Issuing\Dispute::class, $result->data[0]); - } - - public function testCreateDispute() - { - $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\Issuing\Dispute::class, $result); - } - - public function testRetrieveDispute2() - { - $this->expectsRequest('get', '/v1/issuing/disputes/idp_xxxxxxxxxxxxx'); - $result = $this->client->issuing->disputes->retrieve( - 'idp_xxxxxxxxxxxxx', - [] - ); - 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); - } - - public function testListTransaction() - { - $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]); - } - - public function testRetrieveTransaction() - { - $this->expectsRequest( - 'get', - '/v1/issuing/transactions/ipi_xxxxxxxxxxxxx' - ); - $result = $this->client->issuing->transactions->retrieve( - 'ipi_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); - } - - public function testUpdateTransaction() - { - $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 testRetrieveMandate() - { - $this->expectsRequest('get', '/v1/mandates/mandate_xxxxxxxxxxxxx'); - $result = $this->client->mandates->retrieve( - 'mandate_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Mandate::class, $result); - } - - public function testListPaymentIntent() - { - $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 testCreatePaymentIntent2() - { - $this->expectsRequest('post', '/v1/payment_intents'); - $result = $this->client->paymentIntents->create([ - 'amount' => 2000, - 'currency' => 'usd', - 'automatic_payment_methods' => ['enabled' => true], - ]); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); - } - - public function testRetrievePaymentIntent() - { - $this->expectsRequest('get', '/v1/payment_intents/pi_xxxxxxxxxxxxx'); - $result = $this->client->paymentIntents->retrieve( - 'pi_xxxxxxxxxxxxx', - [] - ); static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testUpdatePaymentIntent() + public function testPaymentIntentsPost3() { $this->expectsRequest('post', '/v1/payment_intents/pi_xxxxxxxxxxxxx'); $result = $this->client->paymentIntents->update( @@ -2110,69 +1793,44 @@ public function testUpdatePaymentIntent() static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testApplyCustomerBalancePaymentIntent() + public function testPaymentIntentsPost4() { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance' - ); - $result = $this->client->paymentIntents->applyCustomerBalance( - 'pi_xxxxxxxxxxxxx', - [] - ); + $this->expectsRequest('post', '/v1/payment_intents'); + $result = $this->client->paymentIntents->create([ + 'amount' => 200, + 'currency' => 'usd', + 'payment_method_data' => [ + 'type' => 'p24', + 'p24' => ['bank' => 'blik'], + ], + ]); static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testCancelPaymentIntent() + public function testPaymentIntentsSearchGet() { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/cancel' - ); - $result = $this->client->paymentIntents->cancel('pi_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + $this->expectsRequest('get', '/v1/payment_intents/search'); + $result = $this->client->paymentIntents->search([ + 'query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'', + ]); + static::assertInstanceOf(\Stripe\SearchResult::class, $result); + static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]); } - public function testCapturePaymentIntent() + public function testPaymentIntentsVerifyMicrodepositsPost() { $this->expectsRequest( 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/capture' + '/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits' ); - $result = $this->client->paymentIntents->capture( + $result = $this->client->paymentIntents->verifyMicrodeposits( 'pi_xxxxxxxxxxxxx', [] ); 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); - } - - public function testIncrementAuthorizationPaymentIntent() - { - $this->expectsRequest( - 'post', - '/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization' - ); - $result = $this->client->paymentIntents->incrementAuthorization( - 'pi_xxxxxxxxxxxxx', - ['amount' => 2099] - ); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); - } - - public function testVerifyMicrodepositsPaymentIntent2() + public function testPaymentIntentsVerifyMicrodepositsPost2() { $this->expectsRequest( 'post', @@ -2185,17 +1843,14 @@ public function testVerifyMicrodepositsPaymentIntent2() static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); } - public function testSearchPaymentIntent() + public function testPaymentLinksGet() { - $this->expectsRequest('get', '/v1/payment_intents/search'); - $result = $this->client->paymentIntents->search([ - 'query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'', - ]); - static::assertInstanceOf(\Stripe\SearchResult::class, $result); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]); + $this->expectsRequest('get', '/v1/payment_links/pl_xyz'); + $result = $this->client->paymentLinks->retrieve('pl_xyz', []); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result); } - public function testListPaymentLink() + public function testPaymentLinksGet2() { $this->expectsRequest('get', '/v1/payment_links'); $result = $this->client->paymentLinks->all(['limit' => 3]); @@ -2203,7 +1858,25 @@ public function testListPaymentLink() static::assertInstanceOf(\Stripe\PaymentLink::class, $result->data[0]); } - public function testCreatePaymentLink2() + public function testPaymentLinksGet3() + { + $this->expectsRequest('get', '/v1/payment_links/plink_xxxxxxxxxxxxx'); + $result = $this->client->paymentLinks->retrieve( + 'plink_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\PaymentLink::class, $result); + } + + public function testPaymentLinksLineItemsGet() + { + $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 testPaymentLinksPost() { $this->expectsRequest('post', '/v1/payment_links'); $result = $this->client->paymentLinks->create([ @@ -2217,17 +1890,21 @@ public function testCreatePaymentLink2() static::assertInstanceOf(\Stripe\PaymentLink::class, $result); } - public function testRetrievePaymentLink2() + public function testPaymentLinksPost2() { - $this->expectsRequest('get', '/v1/payment_links/plink_xxxxxxxxxxxxx'); - $result = $this->client->paymentLinks->retrieve( - 'plink_xxxxxxxxxxxxx', - [] - ); + $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 testUpdatePaymentLink() + public function testPaymentLinksPost3() { $this->expectsRequest('post', '/v1/payment_links/plink_xxxxxxxxxxxxx'); $result = $this->client->paymentLinks->update( @@ -2237,53 +1914,47 @@ public function testUpdatePaymentLink() static::assertInstanceOf(\Stripe\PaymentLink::class, $result); } - public function testListPaymentMethod() + public function testPaymentMethodConfigurationsGet() { - $this->expectsRequest('get', '/v1/payment_methods'); - $result = $this->client->paymentMethods->all([ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'type' => 'card', + $this->expectsRequest('get', '/v1/payment_method_configurations'); + $result = $this->client->paymentMethodConfigurations->all([ + 'application' => 'foo', ]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result->data[0]); - } - - public function testCreatePaymentMethod() - { - $this->expectsRequest('post', '/v1/payment_methods'); - $result = $this->client->paymentMethods->create([ - 'type' => 'card', - 'card' => [ - 'number' => '4242424242424242', - 'exp_month' => 8, - 'exp_year' => 2024, - 'cvc' => '314', - ], - ]); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result->data[0]); } - public function testRetrievePaymentMethod() + public function testPaymentMethodConfigurationsGet2() { - $this->expectsRequest('get', '/v1/payment_methods/pm_xxxxxxxxxxxxx'); - $result = $this->client->paymentMethods->retrieve( - 'pm_xxxxxxxxxxxxx', + $this->expectsRequest('get', '/v1/payment_method_configurations/foo'); + $result = $this->client->paymentMethodConfigurations->retrieve( + 'foo', [] ); - static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result); } - public function testUpdatePaymentMethod() + public function testPaymentMethodConfigurationsPost() { - $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('post', '/v1/payment_method_configurations'); + $result = $this->client->paymentMethodConfigurations->create([ + 'acss_debit' => ['display_preference' => ['preference' => 'none']], + 'affirm' => ['display_preference' => ['preference' => 'none']], + ]); + static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result); + } + + public function testPaymentMethodConfigurationsPost2() + { + $this->expectsRequest('post', '/v1/payment_method_configurations/foo'); + $result = $this->client->paymentMethodConfigurations->update( + 'foo', + ['acss_debit' => ['display_preference' => ['preference' => 'on']]] + ); + static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result); } - public function testAttachPaymentMethod() + public function testPaymentMethodsAttachPost() { $this->expectsRequest( 'post', @@ -2296,7 +1967,7 @@ public function testAttachPaymentMethod() static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); } - public function testDetachPaymentMethod() + public function testPaymentMethodsDetachPost() { $this->expectsRequest( 'post', @@ -2306,7 +1977,60 @@ public function testDetachPaymentMethod() static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); } - public function testListPayout() + public function testPaymentMethodsGet() + { + $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\PaymentMethod::class, $result->data[0]); + } + + public function testPaymentMethodsGet2() + { + $this->expectsRequest('get', '/v1/payment_methods/pm_xxxxxxxxxxxxx'); + $result = $this->client->paymentMethods->retrieve( + 'pm_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + } + + public function testPaymentMethodsPost() + { + $this->expectsRequest('post', '/v1/payment_methods'); + $result = $this->client->paymentMethods->create([ + 'type' => 'card', + 'card' => [ + 'number' => '4242424242424242', + 'exp_month' => 8, + 'exp_year' => 2024, + 'cvc' => '314', + ], + ]); + static::assertInstanceOf(\Stripe\PaymentMethod::class, $result); + } + + public function testPaymentMethodsPost2() + { + $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); + } + + public function testPayoutsCancelPost() + { + $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/cancel'); + $result = $this->client->payouts->cancel('po_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Payout::class, $result); + } + + public function testPayoutsGet() { $this->expectsRequest('get', '/v1/payouts'); $result = $this->client->payouts->all(['limit' => 3]); @@ -2314,7 +2038,14 @@ public function testListPayout() static::assertInstanceOf(\Stripe\Payout::class, $result->data[0]); } - public function testCreatePayout() + public function testPayoutsGet2() + { + $this->expectsRequest('get', '/v1/payouts/po_xxxxxxxxxxxxx'); + $result = $this->client->payouts->retrieve('po_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Payout::class, $result); + } + + public function testPayoutsPost() { $this->expectsRequest('post', '/v1/payouts'); $result = $this->client->payouts->create([ @@ -2324,14 +2055,7 @@ public function testCreatePayout() static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testRetrievePayout() - { - $this->expectsRequest('get', '/v1/payouts/po_xxxxxxxxxxxxx'); - $result = $this->client->payouts->retrieve('po_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Payout::class, $result); - } - - public function testUpdatePayout() + public function testPayoutsPost2() { $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx'); $result = $this->client->payouts->update( @@ -2341,21 +2065,21 @@ public function testUpdatePayout() static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testCancelPayout() + public function testPayoutsReversePost() { - $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/cancel'); - $result = $this->client->payouts->cancel('po_xxxxxxxxxxxxx', []); + $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/reverse'); + $result = $this->client->payouts->reverse('po_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\Payout::class, $result); } - public function testReversePayout() + public function testPlansDelete() { - $this->expectsRequest('post', '/v1/payouts/po_xxxxxxxxxxxxx/reverse'); - $result = $this->client->payouts->reverse('po_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Payout::class, $result); + $this->expectsRequest('delete', '/v1/plans/price_xxxxxxxxxxxxx'); + $result = $this->client->plans->delete('price_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Plan::class, $result); } - public function testListPlan() + public function testPlansGet() { $this->expectsRequest('get', '/v1/plans'); $result = $this->client->plans->all(['limit' => 3]); @@ -2363,7 +2087,14 @@ public function testListPlan() static::assertInstanceOf(\Stripe\Plan::class, $result->data[0]); } - public function testCreatePlan() + public function testPlansGet2() + { + $this->expectsRequest('get', '/v1/plans/price_xxxxxxxxxxxxx'); + $result = $this->client->plans->retrieve('price_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Plan::class, $result); + } + + public function testPlansPost() { $this->expectsRequest('post', '/v1/plans'); $result = $this->client->plans->create([ @@ -2375,7 +2106,7 @@ public function testCreatePlan() static::assertInstanceOf(\Stripe\Plan::class, $result); } - public function testCreatePlan2() + public function testPlansPost2() { $this->expectsRequest('post', '/v1/plans'); $result = $this->client->plans->create([ @@ -2387,21 +2118,7 @@ public function testCreatePlan2() 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); - } - - public function testRetrievePlan() - { - $this->expectsRequest('get', '/v1/plans/price_xxxxxxxxxxxxx'); - $result = $this->client->plans->retrieve('price_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Plan::class, $result); - } - - public function testUpdatePlan() + public function testPlansPost3() { $this->expectsRequest('post', '/v1/plans/price_xxxxxxxxxxxxx'); $result = $this->client->plans->update( @@ -2411,7 +2128,7 @@ public function testUpdatePlan() static::assertInstanceOf(\Stripe\Plan::class, $result); } - public function testListPrice() + public function testPricesGet() { $this->expectsRequest('get', '/v1/prices'); $result = $this->client->prices->all(['limit' => 3]); @@ -2419,26 +2136,42 @@ public function testListPrice() static::assertInstanceOf(\Stripe\Price::class, $result->data[0]); } - public function testCreatePrice2() + public function testPricesGet2() + { + $this->expectsRequest('get', '/v1/prices/price_xxxxxxxxxxxxx'); + $result = $this->client->prices->retrieve('price_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Price::class, $result); + } + + public function testPricesPost() { $this->expectsRequest('post', '/v1/prices'); $result = $this->client->prices->create([ 'unit_amount' => 2000, 'currency' => 'usd', + 'currency_options' => [ + 'uah' => ['unit_amount' => 5000], + 'eur' => ['unit_amount' => 1800], + ], 'recurring' => ['interval' => 'month'], 'product' => 'prod_xxxxxxxxxxxxx', ]); static::assertInstanceOf(\Stripe\Price::class, $result); } - public function testRetrievePrice() + public function testPricesPost2() { - $this->expectsRequest('get', '/v1/prices/price_xxxxxxxxxxxxx'); - $result = $this->client->prices->retrieve('price_xxxxxxxxxxxxx', []); + $this->expectsRequest('post', '/v1/prices'); + $result = $this->client->prices->create([ + 'unit_amount' => 2000, + 'currency' => 'usd', + 'recurring' => ['interval' => 'month'], + 'product' => 'prod_xxxxxxxxxxxxx', + ]); static::assertInstanceOf(\Stripe\Price::class, $result); } - public function testUpdatePrice() + public function testPricesPost3() { $this->expectsRequest('post', '/v1/prices/price_xxxxxxxxxxxxx'); $result = $this->client->prices->update( @@ -2448,7 +2181,7 @@ public function testUpdatePrice() static::assertInstanceOf(\Stripe\Price::class, $result); } - public function testSearchPrice() + public function testPricesSearchGet() { $this->expectsRequest('get', '/v1/prices/search'); $result = $this->client->prices->search([ @@ -2458,7 +2191,14 @@ public function testSearchPrice() static::assertInstanceOf(\Stripe\Price::class, $result->data[0]); } - public function testListProduct() + public function testProductsDelete() + { + $this->expectsRequest('delete', '/v1/products/prod_xxxxxxxxxxxxx'); + $result = $this->client->products->delete('prod_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Product::class, $result); + } + + public function testProductsGet() { $this->expectsRequest('get', '/v1/products'); $result = $this->client->products->all(['limit' => 3]); @@ -2466,28 +2206,21 @@ public function testListProduct() static::assertInstanceOf(\Stripe\Product::class, $result->data[0]); } - public function testCreateProduct() - { - $this->expectsRequest('post', '/v1/products'); - $result = $this->client->products->create(['name' => 'Gold Special']); - static::assertInstanceOf(\Stripe\Product::class, $result); - } - - public function testDeleteProduct() + public function testProductsGet2() { - $this->expectsRequest('delete', '/v1/products/prod_xxxxxxxxxxxxx'); - $result = $this->client->products->delete('prod_xxxxxxxxxxxxx', []); + $this->expectsRequest('get', '/v1/products/prod_xxxxxxxxxxxxx'); + $result = $this->client->products->retrieve('prod_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\Product::class, $result); } - public function testRetrieveProduct() + public function testProductsPost() { - $this->expectsRequest('get', '/v1/products/prod_xxxxxxxxxxxxx'); - $result = $this->client->products->retrieve('prod_xxxxxxxxxxxxx', []); + $this->expectsRequest('post', '/v1/products'); + $result = $this->client->products->create(['name' => 'Gold Special']); static::assertInstanceOf(\Stripe\Product::class, $result); } - public function testUpdateProduct() + public function testProductsPost2() { $this->expectsRequest('post', '/v1/products/prod_xxxxxxxxxxxxx'); $result = $this->client->products->update( @@ -2497,7 +2230,7 @@ public function testUpdateProduct() static::assertInstanceOf(\Stripe\Product::class, $result); } - public function testSearchProduct() + public function testProductsSearchGet() { $this->expectsRequest('get', '/v1/products/search'); $result = $this->client->products->search([ @@ -2507,7 +2240,7 @@ public function testSearchProduct() static::assertInstanceOf(\Stripe\Product::class, $result->data[0]); } - public function testListPromotionCode() + public function testPromotionCodesGet() { $this->expectsRequest('get', '/v1/promotion_codes'); $result = $this->client->promotionCodes->all(['limit' => 3]); @@ -2515,16 +2248,7 @@ public function testListPromotionCode() static::assertInstanceOf(\Stripe\PromotionCode::class, $result->data[0]); } - public function testCreatePromotionCode() - { - $this->expectsRequest('post', '/v1/promotion_codes'); - $result = $this->client->promotionCodes->create([ - 'coupon' => 'Z4OV52SU', - ]); - static::assertInstanceOf(\Stripe\PromotionCode::class, $result); - } - - public function testRetrievePromotionCode() + public function testPromotionCodesGet2() { $this->expectsRequest('get', '/v1/promotion_codes/promo_xxxxxxxxxxxxx'); $result = $this->client->promotionCodes->retrieve( @@ -2534,7 +2258,16 @@ public function testRetrievePromotionCode() static::assertInstanceOf(\Stripe\PromotionCode::class, $result); } - public function testUpdatePromotionCode() + public function testPromotionCodesPost() + { + $this->expectsRequest('post', '/v1/promotion_codes'); + $result = $this->client->promotionCodes->create([ + 'coupon' => 'Z4OV52SU', + ]); + static::assertInstanceOf(\Stripe\PromotionCode::class, $result); + } + + public function testPromotionCodesPost2() { $this->expectsRequest( 'post', @@ -2547,7 +2280,28 @@ public function testUpdatePromotionCode() static::assertInstanceOf(\Stripe\PromotionCode::class, $result); } - public function testListQuote() + public function testQuotesAcceptPost() + { + $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/accept'); + $result = $this->client->quotes->accept('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::class, $result); + } + + public function testQuotesCancelPost() + { + $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/cancel'); + $result = $this->client->quotes->cancel('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::class, $result); + } + + public function testQuotesFinalizePost() + { + $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/finalize'); + $result = $this->client->quotes->finalizeQuote('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::class, $result); + } + + public function testQuotesGet() { $this->expectsRequest('get', '/v1/quotes'); $result = $this->client->quotes->all(['limit' => 3]); @@ -2555,7 +2309,33 @@ public function testListQuote() static::assertInstanceOf(\Stripe\Quote::class, $result->data[0]); } - public function testCreateQuote() + public function testQuotesGet2() + { + $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx'); + $result = $this->client->quotes->retrieve('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Quote::class, $result); + } + + public function testQuotesLineItemsGet() + { + $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx/line_items'); + $result = $this->client->quotes->allLineItems('qt_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); + } + + public function testQuotesPdfGet() + { + $this->expectsRequestStream('get', '/v1/quotes/qt_xxxxxxxxxxxxx/pdf'); + $result = $this->client->quotes->pdf( + 'qt_xxxxxxxxxxxxx', + function () {}, + [] + ); + // TODO: assert proper instance, {"shape":"file"} + } + + public function testQuotesPost() { $this->expectsRequest('post', '/v1/quotes'); $result = $this->client->quotes->create([ @@ -2570,14 +2350,7 @@ public function testCreateQuote() static::assertInstanceOf(\Stripe\Quote::class, $result); } - public function testRetrieveQuote() - { - $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx'); - $result = $this->client->quotes->retrieve('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); - } - - public function testUpdateQuote() + public function testQuotesPost2() { $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx'); $result = $this->client->quotes->update( @@ -2587,28 +2360,22 @@ public function testUpdateQuote() static::assertInstanceOf(\Stripe\Quote::class, $result); } - public function testAcceptQuote() - { - $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/accept'); - $result = $this->client->quotes->accept('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); - } - - public function testCancelQuote() - { - $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/cancel'); - $result = $this->client->quotes->cancel('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); - } - - public function testFinalizeQuoteQuote() + public function testQuotesPreviewInvoicesLinesGet() { - $this->expectsRequest('post', '/v1/quotes/qt_xxxxxxxxxxxxx/finalize'); - $result = $this->client->quotes->finalizeQuote('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Quote::class, $result); + $this->expectsRequest( + 'get', + '/v1/quotes/qt_xyz/preview_invoices/in_xyz/lines' + ); + $result = $this->client->quotes->allPreviewInvoiceLines( + 'qt_xyz', + 'in_xyz', + [] + ); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\InvoiceLineItem::class, $result->data[0]); } - public function testListEarlyFraudWarning() + public function testRadarEarlyFraudWarningsGet() { $this->expectsRequest('get', '/v1/radar/early_fraud_warnings'); $result = $this->client->radar->earlyFraudWarnings->all(['limit' => 3]); @@ -2616,7 +2383,7 @@ public function testListEarlyFraudWarning() static::assertInstanceOf(\Stripe\Radar\EarlyFraudWarning::class, $result->data[0]); } - public function testRetrieveEarlyFraudWarning() + public function testRadarEarlyFraudWarningsGet2() { $this->expectsRequest( 'get', @@ -2629,7 +2396,20 @@ public function testRetrieveEarlyFraudWarning() static::assertInstanceOf(\Stripe\Radar\EarlyFraudWarning::class, $result); } - public function testListValueListItem() + public function testRadarValueListItemsDelete() + { + $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 testRadarValueListItemsGet() { $this->expectsRequest('get', '/v1/radar/value_list_items'); $result = $this->client->radar->valueListItems->all([ @@ -2640,7 +2420,20 @@ public function testListValueListItem() static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result->data[0]); } - public function testCreateValueListItem() + public function testRadarValueListItemsGet2() + { + $this->expectsRequest( + 'get', + '/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx' + ); + $result = $this->client->radar->valueListItems->retrieve( + 'rsli_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + } + + public function testRadarValueListItemsPost() { $this->expectsRequest('post', '/v1/radar/value_list_items'); $result = $this->client->radar->valueListItems->create([ @@ -2650,33 +2443,20 @@ public function testCreateValueListItem() static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); } - public function testDeleteValueListItem() + public function testRadarValueListsDelete() { $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 testRetrieveValueListItem() - { - $this->expectsRequest( - 'get', - '/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx' + '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx' ); - $result = $this->client->radar->valueListItems->retrieve( - 'rsli_xxxxxxxxxxxxx', + $result = $this->client->radar->valueLists->delete( + 'rsl_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Radar\ValueListItem::class, $result); + static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); } - public function testListValueList() + public function testRadarValueListsGet() { $this->expectsRequest('get', '/v1/radar/value_lists'); $result = $this->client->radar->valueLists->all(['limit' => 3]); @@ -2684,41 +2464,28 @@ public function testListValueList() static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result->data[0]); } - public function testCreateValueList() - { - $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 testDeleteValueList() + public function testRadarValueListsGet2() { - $this->expectsRequest( - 'delete', - '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx' - ); - $result = $this->client->radar->valueLists->delete( + $this->expectsRequest('get', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); + $result = $this->client->radar->valueLists->retrieve( 'rsl_xxxxxxxxxxxxx', [] ); static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); } - public function testRetrieveValueList() + public function testRadarValueListsPost() { - $this->expectsRequest('get', '/v1/radar/value_lists/rsl_xxxxxxxxxxxxx'); - $result = $this->client->radar->valueLists->retrieve( - 'rsl_xxxxxxxxxxxxx', - [] - ); + $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 testUpdateValueList() + public function testRadarValueListsPost2() { $this->expectsRequest( 'post', @@ -2731,7 +2498,14 @@ public function testUpdateValueList() static::assertInstanceOf(\Stripe\Radar\ValueList::class, $result); } - public function testListRefund() + public function testRefundsCancelPost() + { + $this->expectsRequest('post', '/v1/refunds/re_xxxxxxxxxxxxx/cancel'); + $result = $this->client->refunds->cancel('re_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Refund::class, $result); + } + + public function testRefundsGet() { $this->expectsRequest('get', '/v1/refunds'); $result = $this->client->refunds->all(['limit' => 3]); @@ -2739,23 +2513,23 @@ public function testListRefund() static::assertInstanceOf(\Stripe\Refund::class, $result->data[0]); } - public function testCreateRefund() + public function testRefundsGet2() { - $this->expectsRequest('post', '/v1/refunds'); - $result = $this->client->refunds->create([ - 'charge' => 'ch_xxxxxxxxxxxxx', - ]); + $this->expectsRequest('get', '/v1/refunds/re_xxxxxxxxxxxxx'); + $result = $this->client->refunds->retrieve('re_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\Refund::class, $result); } - public function testRetrieveRefund() + public function testRefundsPost() { - $this->expectsRequest('get', '/v1/refunds/re_xxxxxxxxxxxxx'); - $result = $this->client->refunds->retrieve('re_xxxxxxxxxxxxx', []); + $this->expectsRequest('post', '/v1/refunds'); + $result = $this->client->refunds->create([ + 'charge' => 'ch_xxxxxxxxxxxxx', + ]); static::assertInstanceOf(\Stripe\Refund::class, $result); } - public function testUpdateRefund() + public function testRefundsPost2() { $this->expectsRequest('post', '/v1/refunds/re_xxxxxxxxxxxxx'); $result = $this->client->refunds->update( @@ -2765,14 +2539,7 @@ public function testUpdateRefund() static::assertInstanceOf(\Stripe\Refund::class, $result); } - public function testCancelRefund() - { - $this->expectsRequest('post', '/v1/refunds/re_xxxxxxxxxxxxx/cancel'); - $result = $this->client->refunds->cancel('re_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Refund::class, $result); - } - - public function testListReportRun() + public function testReportingReportRunsGet() { $this->expectsRequest('get', '/v1/reporting/report_runs'); $result = $this->client->reporting->reportRuns->all(['limit' => 3]); @@ -2780,20 +2547,7 @@ public function testListReportRun() static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result->data[0]); } - public function testCreateReportRun() - { - $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 testRetrieveReportRun() + public function testReportingReportRunsGet2() { $this->expectsRequest( 'get', @@ -2806,7 +2560,20 @@ public function testRetrieveReportRun() static::assertInstanceOf(\Stripe\Reporting\ReportRun::class, $result); } - public function testListReportType() + public function testReportingReportRunsPost() + { + $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 testReportingReportTypesGet() { $this->expectsRequest('get', '/v1/reporting/report_types'); $result = $this->client->reporting->reportTypes->all([]); @@ -2814,7 +2581,7 @@ public function testListReportType() static::assertInstanceOf(\Stripe\Reporting\ReportType::class, $result->data[0]); } - public function testRetrieveReportType() + public function testReportingReportTypesGet2() { $this->expectsRequest( 'get', @@ -2827,7 +2594,14 @@ public function testRetrieveReportType() static::assertInstanceOf(\Stripe\Reporting\ReportType::class, $result); } - public function testListReview() + public function testReviewsApprovePost() + { + $this->expectsRequest('post', '/v1/reviews/prv_xxxxxxxxxxxxx/approve'); + $result = $this->client->reviews->approve('prv_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Review::class, $result); + } + + public function testReviewsGet() { $this->expectsRequest('get', '/v1/reviews'); $result = $this->client->reviews->all(['limit' => 3]); @@ -2835,38 +2609,56 @@ public function testListReview() static::assertInstanceOf(\Stripe\Review::class, $result->data[0]); } - public function testRetrieveReview() + public function testReviewsGet2() { $this->expectsRequest('get', '/v1/reviews/prv_xxxxxxxxxxxxx'); $result = $this->client->reviews->retrieve('prv_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\Review::class, $result); } - public function testApproveReview() + public function testSetupAttemptsGet() { - $this->expectsRequest('post', '/v1/reviews/prv_xxxxxxxxxxxxx/approve'); - $result = $this->client->reviews->approve('prv_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Review::class, $result); + $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 testListSetupIntent() + public function testSetupIntentsCancelPost() { - $this->expectsRequest('get', '/v1/setup_intents'); - $result = $this->client->setupIntents->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SetupIntent::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 testCreateSetupIntent() + public function testSetupIntentsConfirmPost() { - $this->expectsRequest('post', '/v1/setup_intents'); - $result = $this->client->setupIntents->create([ - 'payment_method_types' => ['card'], - ]); + $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 testRetrieveSetupIntent() + public function testSetupIntentsGet() + { + $this->expectsRequest('get', '/v1/setup_intents'); + $result = $this->client->setupIntents->all(['limit' => 3]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\SetupIntent::class, $result->data[0]); + } + + public function testSetupIntentsGet2() { $this->expectsRequest('get', '/v1/setup_intents/seti_xxxxxxxxxxxxx'); $result = $this->client->setupIntents->retrieve( @@ -2876,40 +2668,39 @@ public function testRetrieveSetupIntent() static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testUpdateSetupIntent() + public function testSetupIntentsPost() { - $this->expectsRequest('post', '/v1/setup_intents/seti_xxxxxxxxxxxxx'); - $result = $this->client->setupIntents->update( - 'seti_xxxxxxxxxxxxx', - ['metadata' => ['user_id' => '3435453']] - ); + $this->expectsRequest('post', '/v1/setup_intents'); + $result = $this->client->setupIntents->create([ + 'payment_method_types' => ['card'], + ]); static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testCancelSetupIntent() + public function testSetupIntentsPost2() { - $this->expectsRequest( - 'post', - '/v1/setup_intents/seti_xxxxxxxxxxxxx/cancel' + $this->expectsRequest('post', '/v1/setup_intents/seti_xxxxxxxxxxxxx'); + $result = $this->client->setupIntents->update( + 'seti_xxxxxxxxxxxxx', + ['metadata' => ['user_id' => '3435453']] ); - $result = $this->client->setupIntents->cancel('seti_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testConfirmSetupIntent() + public function testSetupIntentsVerifyMicrodepositsPost() { $this->expectsRequest( 'post', - '/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm' + '/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits' ); - $result = $this->client->setupIntents->confirm( + $result = $this->client->setupIntents->verifyMicrodeposits( 'seti_xxxxxxxxxxxxx', - ['payment_method' => 'pm_card_visa'] + [] ); static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testVerifyMicrodepositsSetupIntent2() + public function testSetupIntentsVerifyMicrodepositsPost2() { $this->expectsRequest( 'post', @@ -2922,7 +2713,15 @@ public function testVerifyMicrodepositsSetupIntent2() static::assertInstanceOf(\Stripe\SetupIntent::class, $result); } - public function testListShippingRate2() + public function testShippingRatesGet() + { + $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 testShippingRatesGet2() { $this->expectsRequest('get', '/v1/shipping_rates'); $result = $this->client->shippingRates->all(['limit' => 3]); @@ -2930,31 +2729,45 @@ public function testListShippingRate2() static::assertInstanceOf(\Stripe\ShippingRate::class, $result->data[0]); } - public function testCreateShippingRate2() + public function testShippingRatesGet3() + { + $this->expectsRequest('get', '/v1/shipping_rates/shr_xxxxxxxxxxxxx'); + $result = $this->client->shippingRates->retrieve( + 'shr_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\ShippingRate::class, $result); + } + + public function testShippingRatesPost() { $this->expectsRequest('post', '/v1/shipping_rates'); $result = $this->client->shippingRates->create([ - 'display_name' => 'Ground shipping', - 'type' => 'fixed_amount', + 'display_name' => 'Sample Shipper', 'fixed_amount' => [ - 'amount' => 500, 'currency' => 'usd', + 'amount' => 400, ], + 'type' => 'fixed_amount', ]); static::assertInstanceOf(\Stripe\ShippingRate::class, $result); } - public function testRetrieveShippingRate() + public function testShippingRatesPost2() { - $this->expectsRequest('get', '/v1/shipping_rates/shr_xxxxxxxxxxxxx'); - $result = $this->client->shippingRates->retrieve( - 'shr_xxxxxxxxxxxxx', - [] - ); + $this->expectsRequest('post', '/v1/shipping_rates'); + $result = $this->client->shippingRates->create([ + 'display_name' => 'Ground shipping', + 'type' => 'fixed_amount', + 'fixed_amount' => [ + 'amount' => 500, + 'currency' => 'usd', + ], + ]); static::assertInstanceOf(\Stripe\ShippingRate::class, $result); } - public function testUpdateShippingRate() + public function testShippingRatesPost3() { $this->expectsRequest('post', '/v1/shipping_rates/shr_xxxxxxxxxxxxx'); $result = $this->client->shippingRates->update( @@ -2964,7 +2777,7 @@ public function testUpdateShippingRate() static::assertInstanceOf(\Stripe\ShippingRate::class, $result); } - public function testListScheduledQueryRun() + public function testSigmaScheduledQueryRunsGet() { $this->expectsRequest('get', '/v1/sigma/scheduled_query_runs'); $result = $this->client->sigma->scheduledQueryRuns->all(['limit' => 3]); @@ -2972,7 +2785,7 @@ public function testListScheduledQueryRun() static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result->data[0]); } - public function testRetrieveScheduledQueryRun() + public function testSigmaScheduledQueryRunsGet2() { $this->expectsRequest( 'get', @@ -2985,21 +2798,21 @@ public function testRetrieveScheduledQueryRun() static::assertInstanceOf(\Stripe\Sigma\ScheduledQueryRun::class, $result); } - public function testRetrieveSource() + public function testSourcesGet() { $this->expectsRequest('get', '/v1/sources/src_xxxxxxxxxxxxx'); $result = $this->client->sources->retrieve('src_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\Source::class, $result); } - public function testRetrieveSource2() + public function testSourcesGet2() { $this->expectsRequest('get', '/v1/sources/src_xxxxxxxxxxxxx'); $result = $this->client->sources->retrieve('src_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\Source::class, $result); } - public function testUpdateSource() + public function testSourcesPost() { $this->expectsRequest('post', '/v1/sources/src_xxxxxxxxxxxxx'); $result = $this->client->sources->update( @@ -3009,28 +2822,7 @@ public function testUpdateSource() static::assertInstanceOf(\Stripe\Source::class, $result); } - public function testListSubscriptionItem() - { - $this->expectsRequest('get', '/v1/subscription_items'); - $result = $this->client->subscriptionItems->all([ - 'subscription' => 'sub_xxxxxxxxxxxxx', - ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result->data[0]); - } - - public function testCreateSubscriptionItem() - { - $this->expectsRequest('post', '/v1/subscription_items'); - $result = $this->client->subscriptionItems->create([ - 'subscription' => 'sub_xxxxxxxxxxxxx', - 'price' => 'price_xxxxxxxxxxxxx', - 'quantity' => 2, - ]); - static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); - } - - public function testDeleteSubscriptionItem() + public function testSubscriptionItemsDelete() { $this->expectsRequest( 'delete', @@ -3043,7 +2835,17 @@ public function testDeleteSubscriptionItem() static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); } - public function testRetrieveSubscriptionItem() + public function testSubscriptionItemsGet() + { + $this->expectsRequest('get', '/v1/subscription_items'); + $result = $this->client->subscriptionItems->all([ + 'subscription' => 'sub_xxxxxxxxxxxxx', + ]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result->data[0]); + } + + public function testSubscriptionItemsGet2() { $this->expectsRequest('get', '/v1/subscription_items/si_xxxxxxxxxxxxx'); $result = $this->client->subscriptionItems->retrieve( @@ -3053,7 +2855,18 @@ public function testRetrieveSubscriptionItem() static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); } - public function testUpdateSubscriptionItem() + public function testSubscriptionItemsPost() + { + $this->expectsRequest('post', '/v1/subscription_items'); + $result = $this->client->subscriptionItems->create([ + 'subscription' => 'sub_xxxxxxxxxxxxx', + 'price' => 'price_xxxxxxxxxxxxx', + 'quantity' => 2, + ]); + static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); + } + + public function testSubscriptionItemsPost2() { $this->expectsRequest( 'post', @@ -3066,7 +2879,7 @@ public function testUpdateSubscriptionItem() static::assertInstanceOf(\Stripe\SubscriptionItem::class, $result); } - public function testListUsageRecordSummary() + public function testSubscriptionItemsUsageRecordSummariesGet() { $this->expectsRequest( 'get', @@ -3080,7 +2893,7 @@ public function testListUsageRecordSummary() static::assertInstanceOf(\Stripe\UsageRecordSummary::class, $result->data[0]); } - public function testCreateUsageRecord() + public function testSubscriptionItemsUsageRecordsPost() { $this->expectsRequest( 'post', @@ -3096,7 +2909,20 @@ public function testCreateUsageRecord() static::assertInstanceOf(\Stripe\UsageRecord::class, $result); } - public function testListSubscriptionSchedule() + public function testSubscriptionSchedulesCancelPost() + { + $this->expectsRequest( + 'post', + '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel' + ); + $result = $this->client->subscriptionSchedules->cancel( + 'sub_sched_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + } + + public function testSubscriptionSchedulesGet() { $this->expectsRequest('get', '/v1/subscription_schedules'); $result = $this->client->subscriptionSchedules->all(['limit' => 3]); @@ -3104,14 +2930,27 @@ public function testListSubscriptionSchedule() static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result->data[0]); } - public function testCreateSubscriptionSchedule() + public function testSubscriptionSchedulesGet2() { - $this->expectsRequest('post', '/v1/subscription_schedules'); - $result = $this->client->subscriptionSchedules->create([ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'start_date' => 1676070661, - 'end_behavior' => 'release', - 'phases' => [ + $this->expectsRequest( + 'get', + '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx' + ); + $result = $this->client->subscriptionSchedules->retrieve( + 'sub_sched_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); + } + + public function testSubscriptionSchedulesPost() + { + $this->expectsRequest('post', '/v1/subscription_schedules'); + $result = $this->client->subscriptionSchedules->create([ + 'customer' => 'cus_xxxxxxxxxxxxx', + 'start_date' => 1676070661, + 'end_behavior' => 'release', + 'phases' => [ [ 'items' => [ [ @@ -3126,20 +2965,7 @@ public function testCreateSubscriptionSchedule() static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); } - public function testRetrieveSubscriptionSchedule() - { - $this->expectsRequest( - 'get', - '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx' - ); - $result = $this->client->subscriptionSchedules->retrieve( - 'sub_sched_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); - } - - public function testUpdateSubscriptionSchedule() + public function testSubscriptionSchedulesPost2() { $this->expectsRequest( 'post', @@ -3152,20 +2978,7 @@ public function testUpdateSubscriptionSchedule() static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); } - public function testCancelSubscriptionSchedule() - { - $this->expectsRequest( - 'post', - '/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx/cancel' - ); - $result = $this->client->subscriptionSchedules->cancel( - 'sub_sched_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); - } - - public function testReleaseSubscriptionSchedule() + public function testSubscriptionSchedulesReleasePost() { $this->expectsRequest( 'post', @@ -3178,32 +2991,29 @@ public function testReleaseSubscriptionSchedule() static::assertInstanceOf(\Stripe\SubscriptionSchedule::class, $result); } - public function testListSubscription() + public function testSubscriptionsDelete() { - $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('delete', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); + $result = $this->client->subscriptions->cancel('sub_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Subscription::class, $result); } - public function testCreateSubscription() + public function testSubscriptionsDiscountDelete() { - $this->expectsRequest('post', '/v1/subscriptions'); - $result = $this->client->subscriptions->create([ - 'customer' => 'cus_xxxxxxxxxxxxx', - 'items' => [['price' => 'price_xxxxxxxxxxxxx']], - ]); - static::assertInstanceOf(\Stripe\Subscription::class, $result); + $this->expectsRequest('delete', '/v1/subscriptions/sub_xyz/discount'); + $result = $this->client->subscriptions->deleteDiscount('sub_xyz', []); + static::assertInstanceOf(\Stripe\Discount::class, $result); } - public function testCancelSubscription() + public function testSubscriptionsGet() { - $this->expectsRequest('delete', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); - $result = $this->client->subscriptions->cancel('sub_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Subscription::class, $result); + $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]); } - public function testRetrieveSubscription() + public function testSubscriptionsGet2() { $this->expectsRequest('get', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); $result = $this->client->subscriptions->retrieve( @@ -3213,7 +3023,17 @@ public function testRetrieveSubscription() static::assertInstanceOf(\Stripe\Subscription::class, $result); } - public function testUpdateSubscription() + public function testSubscriptionsPost() + { + $this->expectsRequest('post', '/v1/subscriptions'); + $result = $this->client->subscriptions->create([ + 'customer' => 'cus_xxxxxxxxxxxxx', + 'items' => [['price' => 'price_xxxxxxxxxxxxx']], + ]); + static::assertInstanceOf(\Stripe\Subscription::class, $result); + } + + public function testSubscriptionsPost2() { $this->expectsRequest('post', '/v1/subscriptions/sub_xxxxxxxxxxxxx'); $result = $this->client->subscriptions->update( @@ -3223,7 +3043,7 @@ public function testUpdateSubscription() static::assertInstanceOf(\Stripe\Subscription::class, $result); } - public function testSearchSubscription() + public function testSubscriptionsSearchGet() { $this->expectsRequest('get', '/v1/subscriptions/search'); $result = $this->client->subscriptions->search([ @@ -3233,7 +3053,40 @@ public function testSearchSubscription() static::assertInstanceOf(\Stripe\Subscription::class, $result->data[0]); } - public function testListTaxCode() + public function testTaxCalculationsLineItemsGet() + { + $this->expectsRequest('get', '/v1/tax/calculations/xxx/line_items'); + $result = $this->client->tax->calculations->allLineItems('xxx', []); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Tax\CalculationLineItem::class, $result->data[0]); + } + + public function testTaxCalculationsPost() + { + $this->expectsRequest('post', '/v1/tax/calculations'); + $result = $this->client->tax->calculations->create([ + 'currency' => 'usd', + 'line_items' => [ + [ + 'amount' => 1000, + 'reference' => 'L1', + ], + ], + 'customer_details' => [ + 'address' => [ + 'line1' => '354 Oyster Point Blvd', + 'city' => 'South San Francisco', + 'state' => 'CA', + 'postal_code' => '94080', + 'country' => 'US', + ], + 'address_source' => 'shipping', + ], + ]); + static::assertInstanceOf(\Stripe\Tax\Calculation::class, $result); + } + + public function testTaxCodesGet() { $this->expectsRequest('get', '/v1/tax_codes'); $result = $this->client->taxCodes->all(['limit' => 3]); @@ -3241,14 +3094,28 @@ public function testListTaxCode() static::assertInstanceOf(\Stripe\TaxCode::class, $result->data[0]); } - public function testRetrieveTaxCode() + public function testTaxCodesGet2() { $this->expectsRequest('get', '/v1/tax_codes/txcd_xxxxxxxxxxxxx'); $result = $this->client->taxCodes->retrieve('txcd_xxxxxxxxxxxxx', []); static::assertInstanceOf(\Stripe\TaxCode::class, $result); } - public function testListTaxRate() + public function testTaxFormsPdfGet() + { + $this->expectsRequestStream( + 'get', + '/v1/tax/forms/form_xxxxxxxxxxxxx/pdf' + ); + $result = $this->client->tax->forms->pdf( + 'form_xxxxxxxxxxxxx', + function () {}, + [] + ); + // TODO: assert proper instance, {"shape":"file"} + } + + public function testTaxRatesGet() { $this->expectsRequest('get', '/v1/tax_rates'); $result = $this->client->taxRates->all(['limit' => 3]); @@ -3256,7 +3123,14 @@ public function testListTaxRate() static::assertInstanceOf(\Stripe\TaxRate::class, $result->data[0]); } - public function testCreateTaxRate() + public function testTaxRatesGet2() + { + $this->expectsRequest('get', '/v1/tax_rates/txr_xxxxxxxxxxxxx'); + $result = $this->client->taxRates->retrieve('txr_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\TaxRate::class, $result); + } + + public function testTaxRatesPost() { $this->expectsRequest('post', '/v1/tax_rates'); $result = $this->client->taxRates->create([ @@ -3269,14 +3143,7 @@ public function testCreateTaxRate() static::assertInstanceOf(\Stripe\TaxRate::class, $result); } - public function testRetrieveTaxRate() - { - $this->expectsRequest('get', '/v1/tax_rates/txr_xxxxxxxxxxxxx'); - $result = $this->client->taxRates->retrieve('txr_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\TaxRate::class, $result); - } - - public function testUpdateTaxRate() + public function testTaxRatesPost2() { $this->expectsRequest('post', '/v1/tax_rates/txr_xxxxxxxxxxxxx'); $result = $this->client->taxRates->update( @@ -3286,15 +3153,27 @@ public function testUpdateTaxRate() static::assertInstanceOf(\Stripe\TaxRate::class, $result); } - public function testListConfiguration3() + public function testTaxTransactionsCreateFromCalculationPost() { - $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( + 'post', + '/v1/tax/transactions/create_from_calculation' + ); + $result = $this->client->tax->transactions->createFromCalculation([ + 'calculation' => 'xxx', + 'reference' => 'yyy', + ]); + static::assertInstanceOf(\Stripe\Tax\Transaction::class, $result); + } + + public function testTerminalConfigurationsDelete() + { + $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 testDeleteConfiguration2() + public function testTerminalConfigurationsDelete2() { $this->expectsRequest( 'delete', @@ -3307,7 +3186,33 @@ public function testDeleteConfiguration2() static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); } - public function testRetrieveConfiguration3() + public function testTerminalConfigurationsGet() + { + $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 testTerminalConfigurationsGet2() + { + $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 testTerminalConfigurationsGet3() + { + $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]); + } + + public function testTerminalConfigurationsGet4() { $this->expectsRequest( 'get', @@ -3320,7 +3225,17 @@ public function testRetrieveConfiguration3() static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); } - public function testUpdateConfiguration3() + public function testTerminalConfigurationsPost2() + { + $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 testTerminalConfigurationsPost4() { $this->expectsRequest( 'post', @@ -3333,14 +3248,27 @@ public function testUpdateConfiguration3() static::assertInstanceOf(\Stripe\Terminal\Configuration::class, $result); } - public function testCreateConnectionToken() + public function testTerminalConnectionTokensPost() { $this->expectsRequest('post', '/v1/terminal/connection_tokens'); $result = $this->client->terminal->connectionTokens->create([]); static::assertInstanceOf(\Stripe\Terminal\ConnectionToken::class, $result); } - public function testListLocation() + public function testTerminalLocationsDelete() + { + $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 testTerminalLocationsGet() { $this->expectsRequest('get', '/v1/terminal/locations'); $result = $this->client->terminal->locations->all(['limit' => 3]); @@ -3348,7 +3276,20 @@ public function testListLocation() static::assertInstanceOf(\Stripe\Terminal\Location::class, $result->data[0]); } - public function testCreateLocation() + public function testTerminalLocationsGet2() + { + $this->expectsRequest( + 'get', + '/v1/terminal/locations/tml_xxxxxxxxxxxxx' + ); + $result = $this->client->terminal->locations->retrieve( + 'tml_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); + } + + public function testTerminalLocationsPost() { $this->expectsRequest('post', '/v1/terminal/locations'); $result = $this->client->terminal->locations->create([ @@ -3364,46 +3305,46 @@ public function testCreateLocation() static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); } - public function testDeleteLocation() + public function testTerminalLocationsPost2() { $this->expectsRequest( - 'delete', + 'post', '/v1/terminal/locations/tml_xxxxxxxxxxxxx' ); - $result = $this->client->terminal->locations->delete( + $result = $this->client->terminal->locations->update( 'tml_xxxxxxxxxxxxx', - [] + ['display_name' => 'My First Store'] ); static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); } - public function testRetrieveLocation() + public function testTerminalReadersCancelActionPost() { $this->expectsRequest( - 'get', - '/v1/terminal/locations/tml_xxxxxxxxxxxxx' + 'post', + '/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action' ); - $result = $this->client->terminal->locations->retrieve( - 'tml_xxxxxxxxxxxxx', + $result = $this->client->terminal->readers->cancelAction( + 'tmr_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testUpdateLocation() + public function testTerminalReadersDelete() { $this->expectsRequest( - 'post', - '/v1/terminal/locations/tml_xxxxxxxxxxxxx' + 'delete', + '/v1/terminal/readers/tmr_xxxxxxxxxxxxx' ); - $result = $this->client->terminal->locations->update( - 'tml_xxxxxxxxxxxxx', - ['display_name' => 'My First Store'] + $result = $this->client->terminal->readers->delete( + 'tmr_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Terminal\Location::class, $result); + static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testListReader() + public function testTerminalReadersGet() { $this->expectsRequest('get', '/v1/terminal/readers'); $result = $this->client->terminal->readers->all(['limit' => 3]); @@ -3411,7 +3352,17 @@ public function testListReader() static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result->data[0]); } - public function testCreateReader() + public function testTerminalReadersGet2() + { + $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 testTerminalReadersPost() { $this->expectsRequest('post', '/v1/terminal/readers'); $result = $this->client->terminal->readers->create([ @@ -3422,53 +3373,17 @@ public function testCreateReader() static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testDeleteReader() + public function testTerminalReadersPost2() { - $this->expectsRequest( - 'delete', - '/v1/terminal/readers/tmr_xxxxxxxxxxxxx' - ); - $result = $this->client->terminal->readers->delete( + $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 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 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 testProcessPaymentIntentReader() + public function testTerminalReadersProcessPaymentIntentPost() { $this->expectsRequest( 'post', @@ -3481,7 +3396,7 @@ public function testProcessPaymentIntentReader() static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testProcessSetupIntentReader() + public function testTerminalReadersProcessSetupIntentPost() { $this->expectsRequest( 'post', @@ -3497,1111 +3412,1196 @@ public function testProcessSetupIntentReader() static::assertInstanceOf(\Stripe\Terminal\Reader::class, $result); } - public function testListTestClock2() - { - $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\TestHelpers\TestClock::class, $result->data[0]); - } - - public function testCreateTestClock2() + public function testTestHelpersCustomersFundCashBalancePost() { - $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( + '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\CustomerCashBalanceTransaction::class, $result); } - public function testDeleteTestClock2() + public function testTestHelpersIssuingAuthorizationsCapturePost() { $this->expectsRequest( - 'delete', - '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' + 'post', + '/v1/test_helpers/issuing/authorizations/example_authorization/capture' ); - $result = $this->client->testHelpers->testClocks->delete( - 'clock_xxxxxxxxxxxxx', - [] + $result = $this->client->testHelpers->issuing->authorizations->capture( + 'example_authorization', + [ + 'capture_amount' => 100, + 'close_authorization' => true, + 'purchase_details' => [ + 'flight' => [ + 'departure_at' => 1633651200, + 'passenger_name' => 'John Doe', + 'refundable' => true, + 'segments' => [ + [ + 'arrival_airport_code' => 'SFO', + 'carrier' => 'Delta', + 'departure_airport_code' => 'LAX', + 'flight_number' => 'DL100', + 'service_class' => 'Economy', + 'stopover_allowed' => true, + ], + ], + 'travel_agency' => 'Orbitz', + ], + 'fuel' => [ + 'type' => 'diesel', + 'unit' => 'liter', + 'unit_cost_decimal' => '3.5', + 'volume_decimal' => '10', + ], + 'lodging' => [ + 'check_in_at' => 1633651200, + 'nights' => 2, + ], + 'receipt' => [ + [ + 'description' => 'Room charge', + 'quantity' => '1', + 'total' => 200, + 'unit_cost' => 200, + ], + ], + 'reference' => 'foo', + ], + ] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testRetrieveTestClock2() + public function testTestHelpersIssuingAuthorizationsExpirePost() { $this->expectsRequest( - 'get', - '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' + 'post', + '/v1/test_helpers/issuing/authorizations/example_authorization/expire' ); - $result = $this->client->testHelpers->testClocks->retrieve( - 'clock_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->issuing->authorizations->expire( + 'example_authorization', [] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testAdvanceTestClock2() + public function testTestHelpersIssuingAuthorizationsIncrementPost() { $this->expectsRequest( 'post', - '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx/advance' + '/v1/test_helpers/issuing/authorizations/example_authorization/increment' ); - $result = $this->client->testHelpers->testClocks->advance( - 'clock_xxxxxxxxxxxxx', - ['frozen_time' => 1675552261] + $result = $this->client->testHelpers->issuing->authorizations->increment( + 'example_authorization', + [ + 'increment_amount' => 50, + 'is_amount_controllable' => true, + ] ); - static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testCreateToken2() + public function testTestHelpersIssuingAuthorizationsPost() { - $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/test_helpers/issuing/authorizations' + ); + $result = $this->client->testHelpers->issuing->authorizations->create([ + 'amount' => 100, + 'amount_details' => [ + 'atm_fee' => 10, + 'cashback_amount' => 5, ], + 'authorization_method' => 'chip', + 'card' => 'foo', + 'currency' => 'usd', + 'is_amount_controllable' => true, + 'merchant_data' => [ + 'category' => 'ac_refrigeration_repair', + 'city' => 'foo', + 'country' => 'bar', + 'name' => 'foo', + 'network_id' => 'bar', + 'postal_code' => 'foo', + 'state' => 'bar', + 'terminal_id' => 'foo', + ], + 'network_data' => ['acquiring_institution_id' => 'foo'], + 'verification_data' => [ + 'address_line1_check' => 'mismatch', + 'address_postal_code_check' => 'match', + 'cvc_check' => 'match', + 'expiry_check' => 'mismatch', + ], + 'wallet' => 'apple_pay', ]); - static::assertInstanceOf(\Stripe\Token::class, $result); - } - - public function testCreateToken3() - { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create([ - 'pii' => ['id_number' => '000000000'], - ]); - static::assertInstanceOf(\Stripe\Token::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testCreateToken4() + public function testTestHelpersIssuingAuthorizationsReversePost() { - $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\Token::class, $result); + $this->expectsRequest( + 'post', + '/v1/test_helpers/issuing/authorizations/example_authorization/reverse' + ); + $result = $this->client->testHelpers->issuing->authorizations->reverse( + 'example_authorization', + ['reverse_amount' => 20] + ); + static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); } - public function testCreateToken5() + public function testTestHelpersIssuingCardsShippingDeliverPost() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create([ - 'person' => [ - 'first_name' => 'Jane', - 'last_name' => 'Doe', - 'relationship' => ['owner' => true], - ], - ]); - static::assertInstanceOf(\Stripe\Token::class, $result); + $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 testCreateToken6() + public function testTestHelpersIssuingCardsShippingFailPost() { - $this->expectsRequest('post', '/v1/tokens'); - $result = $this->client->tokens->create([ - 'cvc_update' => ['cvc' => '123'], - ]); - static::assertInstanceOf(\Stripe\Token::class, $result); + $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 testRetrieveToken() + public function testTestHelpersIssuingCardsShippingReturnPost() { - $this->expectsRequest('get', '/v1/tokens/tok_xxxx'); - $result = $this->client->tokens->retrieve('tok_xxxx', []); - static::assertInstanceOf(\Stripe\Token::class, $result); + $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 testListTopup() + public function testTestHelpersIssuingCardsShippingShipPost() { - $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/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 testCreateTopup() + public function testTestHelpersIssuingTransactionsCreateForceCapturePost() { - $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/test_helpers/issuing/transactions/create_force_capture' + ); + $result = $this->client->testHelpers->issuing->transactions->createForceCapture([ + 'amount' => 100, + 'card' => 'foo', + 'currency' => 'usd', + 'merchant_data' => [ + 'category' => 'ac_refrigeration_repair', + 'city' => 'foo', + 'country' => 'US', + 'name' => 'foo', + 'network_id' => 'bar', + 'postal_code' => '10001', + 'state' => 'NY', + 'terminal_id' => 'foo', + ], + 'purchase_details' => [ + 'flight' => [ + 'departure_at' => 1633651200, + 'passenger_name' => 'John Doe', + 'refundable' => true, + 'segments' => [ + [ + 'arrival_airport_code' => 'SFO', + 'carrier' => 'Delta', + 'departure_airport_code' => 'LAX', + 'flight_number' => 'DL100', + 'service_class' => 'Economy', + 'stopover_allowed' => true, + ], + ], + 'travel_agency' => 'Orbitz', + ], + 'fuel' => [ + 'type' => 'diesel', + 'unit' => 'liter', + 'unit_cost_decimal' => '3.5', + 'volume_decimal' => '10', + ], + 'lodging' => [ + 'check_in_at' => 1533651200, + 'nights' => 2, + ], + 'receipt' => [ + [ + 'description' => 'Room charge', + 'quantity' => '1', + 'total' => 200, + 'unit_cost' => 200, + ], + ], + 'reference' => 'foo', + ], ]); - static::assertInstanceOf(\Stripe\Topup::class, $result); - } - - public function testRetrieveTopup() - { - $this->expectsRequest('get', '/v1/topups/tu_xxxxxxxxxxxxx'); - $result = $this->client->topups->retrieve('tu_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Topup::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); } - public function testUpdateTopup() + public function testTestHelpersIssuingTransactionsCreateUnlinkedRefundPost() { - $this->expectsRequest('post', '/v1/topups/tu_xxxxxxxxxxxxx'); - $result = $this->client->topups->update( - 'tu_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $this->expectsRequest( + 'post', + '/v1/test_helpers/issuing/transactions/create_unlinked_refund' ); - 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 testListTransfer() - { - $this->expectsRequest('get', '/v1/transfers'); - $result = $this->client->transfers->all(['limit' => 3]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Transfer::class, $result->data[0]); - } - - public function testCreateTransfer() - { - $this->expectsRequest('post', '/v1/transfers'); - $result = $this->client->transfers->create([ - 'amount' => 400, + $result = $this->client->testHelpers->issuing->transactions->createUnlinkedRefund([ + 'amount' => 100, + 'card' => 'foo', 'currency' => 'usd', - 'destination' => 'acct_xxxxxxxxxxxxx', - 'transfer_group' => 'ORDER_95', + 'merchant_data' => [ + 'category' => 'ac_refrigeration_repair', + 'city' => 'foo', + 'country' => 'bar', + 'name' => 'foo', + 'network_id' => 'bar', + 'postal_code' => 'foo', + 'state' => 'bar', + 'terminal_id' => 'foo', + ], + 'purchase_details' => [ + 'flight' => [ + 'departure_at' => 1533651200, + 'passenger_name' => 'John Doe', + 'refundable' => true, + 'segments' => [ + [ + 'arrival_airport_code' => 'SFO', + 'carrier' => 'Delta', + 'departure_airport_code' => 'LAX', + 'flight_number' => 'DL100', + 'service_class' => 'Economy', + 'stopover_allowed' => true, + ], + ], + 'travel_agency' => 'Orbitz', + ], + 'fuel' => [ + 'type' => 'diesel', + 'unit' => 'liter', + 'unit_cost_decimal' => '3.5', + 'volume_decimal' => '10', + ], + 'lodging' => [ + 'check_in_at' => 1533651200, + 'nights' => 2, + ], + 'receipt' => [ + [ + 'description' => 'Room charge', + 'quantity' => '1', + 'total' => 200, + 'unit_cost' => 200, + ], + ], + 'reference' => 'foo', + ], ]); - static::assertInstanceOf(\Stripe\Transfer::class, $result); + static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); } - public function testRetrieveTransfer() + public function testTestHelpersIssuingTransactionsRefundPost() { - $this->expectsRequest('get', '/v1/transfers/tr_xxxxxxxxxxxxx'); - $result = $this->client->transfers->retrieve('tr_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Transfer::class, $result); + $this->expectsRequest( + 'post', + '/v1/test_helpers/issuing/transactions/example_transaction/refund' + ); + $result = $this->client->testHelpers->issuing->transactions->refund( + 'example_transaction', + ['refund_amount' => 50] + ); + static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); } - public function testUpdateTransfer() + public function testTestHelpersRefundsExpirePost() { - $this->expectsRequest('post', '/v1/transfers/tr_xxxxxxxxxxxxx'); - $result = $this->client->transfers->update( - 'tr_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] - ); - static::assertInstanceOf(\Stripe\Transfer::class, $result); + $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 testListTransferReversal() + public function testTestHelpersTestClocksAdvancePost() { $this->expectsRequest( - 'get', - '/v1/transfers/tr_xxxxxxxxxxxxx/reversals' + 'post', + '/v1/test_helpers/test_clocks/clock_xyz/advance' ); - $result = $this->client->transfers->allReversals( - 'tr_xxxxxxxxxxxxx', - ['limit' => 3] + $result = $this->client->testHelpers->testClocks->advance( + 'clock_xyz', + ['frozen_time' => 142] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testCreateTransferReversal() + public function testTestHelpersTestClocksAdvancePost2() { $this->expectsRequest( 'post', - '/v1/transfers/tr_xxxxxxxxxxxxx/reversals' + '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx/advance' ); - $result = $this->client->transfers->createReversal( - 'tr_xxxxxxxxxxxxx', - ['amount' => 100] + $result = $this->client->testHelpers->testClocks->advance( + 'clock_xxxxxxxxxxxxx', + ['frozen_time' => 1675552261] ); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testRetrieveTransferReversal() + public function testTestHelpersTestClocksDelete() { $this->expectsRequest( - 'get', - '/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx' + 'delete', + '/v1/test_helpers/test_clocks/clock_xyz' ); - $result = $this->client->transfers->retrieveReversal( - 'tr_xxxxxxxxxxxxx', - 'trr_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->testClocks->delete( + 'clock_xyz', [] ); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testUpdateTransferReversal() + public function testTestHelpersTestClocksDelete2() { $this->expectsRequest( - 'post', - '/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx' + 'delete', + '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' ); - $result = $this->client->transfers->updateReversal( - 'tr_xxxxxxxxxxxxx', - 'trr_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $result = $this->client->testHelpers->testClocks->delete( + 'clock_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\TransferReversal::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testListCreditReversal() + public function testTestHelpersTestClocksGet() { - $this->expectsRequest('get', '/v1/treasury/credit_reversals'); - $result = $this->client->treasury->creditReversals->all([ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'limit' => 3, - ]); + $this->expectsRequest('get', '/v1/test_helpers/test_clocks'); + $result = $this->client->testHelpers->testClocks->all([]); static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result->data[0]); } - public function testCreateCreditReversal() + public function testTestHelpersTestClocksGet2() { - $this->expectsRequest('post', '/v1/treasury/credit_reversals'); - $result = $this->client->treasury->creditReversals->create([ - 'received_credit' => 'rc_xxxxxxxxxxxxx', - ]); - static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result); + $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 testTestHelpersTestClocksGet3() + { + $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\TestHelpers\TestClock::class, $result->data[0]); } - public function testRetrieveCreditReversal() + public function testTestHelpersTestClocksGet4() { $this->expectsRequest( 'get', - '/v1/treasury/credit_reversals/credrev_xxxxxxxxxxxxx' + '/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->creditReversals->retrieve( - 'credrev_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->testClocks->retrieve( + 'clock_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testListDebitReversal() + public function testTestHelpersTestClocksPost() { - $this->expectsRequest('get', '/v1/treasury/debit_reversals'); - $result = $this->client->treasury->debitReversals->all([ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'limit' => 3, + $this->expectsRequest('post', '/v1/test_helpers/test_clocks'); + $result = $this->client->testHelpers->testClocks->create([ + 'frozen_time' => 123, + 'name' => 'cogsworth', ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testCreateDebitReversal() + public function testTestHelpersTestClocksPost2() { - $this->expectsRequest('post', '/v1/treasury/debit_reversals'); - $result = $this->client->treasury->debitReversals->create([ - 'received_debit' => 'rd_xxxxxxxxxxxxx', + $this->expectsRequest('post', '/v1/test_helpers/test_clocks'); + $result = $this->client->testHelpers->testClocks->create([ + 'frozen_time' => 1577836800, ]); - static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result); + static::assertInstanceOf(\Stripe\TestHelpers\TestClock::class, $result); } - public function testRetrieveDebitReversal() + public function testTestHelpersTreasuryInboundTransfersFailPost() { $this->expectsRequest( - 'get', - '/v1/treasury/debit_reversals/debrev_xxxxxxxxxxxxx' + 'post', + '/v1/test_helpers/treasury/inbound_transfers/ibt_123/fail' ); - $result = $this->client->treasury->debitReversals->retrieve( - 'debrev_xxxxxxxxxxxxx', - [] + $result = $this->client->testHelpers->treasury->inboundTransfers->fail( + 'ibt_123', + ['failure_details' => ['code' => 'account_closed']] ); - static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result); - } - - public function testListFinancialAccount() - { - $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\FinancialAccount::class, $result->data[0]); - } - - public function testCreateFinancialAccount() - { - $this->expectsRequest('post', '/v1/treasury/financial_accounts'); - $result = $this->client->treasury->financialAccounts->create([ - 'supported_currencies' => ['usd'], - 'features' => [], - ]); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testRetrieveFinancialAccount() + public function testTestHelpersTreasuryInboundTransfersReturnPost() { $this->expectsRequest( - 'get', - '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' + 'post', + '/v1/test_helpers/treasury/inbound_transfers/ibt_123/return' ); - $result = $this->client->treasury->financialAccounts->retrieve( - 'fa_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->treasury->inboundTransfers->returnInboundTransfer( + 'ibt_123', [] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testUpdateFinancialAccount() + public function testTestHelpersTreasuryInboundTransfersSucceedPost() { $this->expectsRequest( 'post', - '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' + '/v1/test_helpers/treasury/inbound_transfers/ibt_123/succeed' ); - $result = $this->client->treasury->financialAccounts->update( - 'fa_xxxxxxxxxxxxx', - ['metadata' => ['order_id' => '6735']] + $result = $this->client->testHelpers->treasury->inboundTransfers->succeed( + 'ibt_123', + [] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testRetrieveFeaturesFinancialAccount() + public function testTestHelpersTreasuryOutboundTransfersFailPost() { $this->expectsRequest( - 'get', - '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features' + 'post', + '/v1/test_helpers/treasury/outbound_transfers/obt_123/fail' ); - $result = $this->client->treasury->financialAccounts->retrieveFeatures( - 'fa_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->treasury->outboundTransfers->fail( + 'obt_123', [] ); - static::assertInstanceOf(\Stripe\Treasury\FinancialAccountFeatures::class, $result); - } - - public function testListInboundTransfer() - { - $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\Treasury\InboundTransfer::class, $result->data[0]); - } - - public function testCreateInboundTransfer() - { - $this->expectsRequest('post', '/v1/treasury/inbound_transfers'); - $result = $this->client->treasury->inboundTransfers->create([ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'amount' => 10000, - 'currency' => 'usd', - 'origin_payment_method' => 'pm_xxxxxxxxxxxxx', - 'description' => 'InboundTransfer from my bank account', - ]); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testRetrieveInboundTransfer() + public function testTestHelpersTreasuryOutboundTransfersPostPost() { $this->expectsRequest( - 'get', - '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx' + 'post', + '/v1/test_helpers/treasury/outbound_transfers/obt_123/post' ); - $result = $this->client->treasury->inboundTransfers->retrieve( - 'ibt_xxxxxxxxxxxxx', + $result = $this->client->testHelpers->treasury->outboundTransfers->post( + 'obt_123', [] ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testCancelInboundTransfer() + public function testTestHelpersTreasuryOutboundTransfersReturnPost() { $this->expectsRequest( 'post', - '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel' + '/v1/test_helpers/treasury/outbound_transfers/obt_123/return' ); - $result = $this->client->treasury->inboundTransfers->cancel( - 'ibt_xxxxxxxxxxxxx', - [] + $result = $this->client->testHelpers->treasury->outboundTransfers->returnOutboundTransfer( + 'obt_123', + ['returned_details' => ['code' => 'account_closed']] ); - static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testListOutboundPayment() + public function testTestHelpersTreasuryReceivedCreditsPost() { - $this->expectsRequest('get', '/v1/treasury/outbound_payments'); - $result = $this->client->treasury->outboundPayments->all([ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'limit' => 3, + $this->expectsRequest( + 'post', + '/v1/test_helpers/treasury/received_credits' + ); + $result = $this->client->testHelpers->treasury->receivedCredits->create([ + 'financial_account' => 'fa_123', + 'network' => 'ach', + 'amount' => 1234, + 'currency' => 'usd', ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result); } - public function testCreateOutboundPayment() + public function testTestHelpersTreasuryReceivedDebitsPost() { - $this->expectsRequest('post', '/v1/treasury/outbound_payments'); - $result = $this->client->treasury->outboundPayments->create([ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'amount' => 10000, + $this->expectsRequest( + 'post', + '/v1/test_helpers/treasury/received_debits' + ); + $result = $this->client->testHelpers->treasury->receivedDebits->create([ + 'financial_account' => 'fa_123', + 'network' => 'ach', + 'amount' => 1234, 'currency' => 'usd', - 'customer' => 'cus_xxxxxxxxxxxxx', - 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', - 'description' => 'OutboundPayment to a 3rd party', ]); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result); } - public function testRetrieveOutboundPayment() + public function testTokensGet() { - $this->expectsRequest( - 'get', - '/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx' - ); - $result = $this->client->treasury->outboundPayments->retrieve( - 'bot_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + $this->expectsRequest('get', '/v1/tokens/tok_xxxx'); + $result = $this->client->tokens->retrieve('tok_xxxx', []); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testCancelOutboundPayment() + public function testTokensPost() { - $this->expectsRequest( - 'post', - '/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx/cancel' - ); - $result = $this->client->treasury->outboundPayments->cancel( - 'bot_xxxxxxxxxxxxx', - [] - ); - static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create([ + 'card' => [ + 'number' => '4242424242424242', + 'exp_month' => '5', + 'exp_year' => '2023', + 'cvc' => '314', + ], + ]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testListOutboundTransfer() + public function testTokensPost2() { - $this->expectsRequest('get', '/v1/treasury/outbound_transfers'); - $result = $this->client->treasury->outboundTransfers->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\OutboundTransfer::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testCreateOutboundTransfer() + public function testTokensPost3() { - $this->expectsRequest('post', '/v1/treasury/outbound_transfers'); - $result = $this->client->treasury->outboundTransfers->create([ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', - 'amount' => 500, - 'currency' => 'usd', - 'description' => 'OutboundTransfer to my external bank account', + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create([ + 'pii' => ['id_number' => '000000000'], ]); - static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testRetrieveOutboundTransfer() + public function testTokensPost4() { - $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('post', '/v1/tokens'); + $result = $this->client->tokens->create([ + 'account' => [ + 'individual' => [ + 'first_name' => 'Jane', + 'last_name' => 'Doe', + ], + 'tos_shown_and_accepted' => true, + ], + ]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testCancelOutboundTransfer() + public function testTokensPost5() { - $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([ + 'person' => [ + 'first_name' => 'Jane', + 'last_name' => 'Doe', + 'relationship' => ['owner' => true], + ], + ]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testListReceivedCredit() + public function testTokensPost6() { - $this->expectsRequest('get', '/v1/treasury/received_credits'); - $result = $this->client->treasury->receivedCredits->all([ - 'financial_account' => 'fa_xxxxxxxxxxxxx', - 'limit' => 3, + $this->expectsRequest('post', '/v1/tokens'); + $result = $this->client->tokens->create([ + 'cvc_update' => ['cvc' => '123'], ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Token::class, $result); } - public function testRetrieveReceivedCredit() + public function testTopupsCancelPost() { - $this->expectsRequest( - 'get', - '/v1/treasury/received_credits/rc_xxxxxxxxxxxxx' - ); - $result = $this->client->treasury->receivedCredits->retrieve( - 'rc_xxxxxxxxxxxxx', - [] + $this->expectsRequest('post', '/v1/topups/tu_xxxxxxxxxxxxx/cancel'); + $result = $this->client->topups->cancel('tu_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Topup::class, $result); + } + + public function testTopupsGet() + { + $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]); + } + + public function testTopupsGet2() + { + $this->expectsRequest('get', '/v1/topups/tu_xxxxxxxxxxxxx'); + $result = $this->client->topups->retrieve('tu_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Topup::class, $result); + } + + public function testTopupsPost() + { + $this->expectsRequest('post', '/v1/topups'); + $result = $this->client->topups->create([ + 'amount' => 2000, + 'currency' => 'usd', + 'description' => 'Top-up for Jenny Rosen', + 'statement_descriptor' => 'Top-up', + ]); + static::assertInstanceOf(\Stripe\Topup::class, $result); + } + + public function testTopupsPost2() + { + $this->expectsRequest('post', '/v1/topups/tu_xxxxxxxxxxxxx'); + $result = $this->client->topups->update( + 'tu_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] ); - static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result); + static::assertInstanceOf(\Stripe\Topup::class, $result); } - public function testListReceivedDebit() + public function testTransfersGet() { - $this->expectsRequest('get', '/v1/treasury/received_debits'); - $result = $this->client->treasury->receivedDebits->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\Transfer::class, $result->data[0]); + } + + public function testTransfersGet2() + { + $this->expectsRequest('get', '/v1/transfers/tr_xxxxxxxxxxxxx'); + $result = $this->client->transfers->retrieve('tr_xxxxxxxxxxxxx', []); + static::assertInstanceOf(\Stripe\Transfer::class, $result); + } + + public function testTransfersPost() + { + $this->expectsRequest('post', '/v1/transfers'); + $result = $this->client->transfers->create([ + 'amount' => 400, + 'currency' => 'usd', + 'destination' => 'acct_xxxxxxxxxxxxx', + 'transfer_group' => 'ORDER_95', ]); + static::assertInstanceOf(\Stripe\Transfer::class, $result); + } + + public function testTransfersPost2() + { + $this->expectsRequest('post', '/v1/transfers/tr_xxxxxxxxxxxxx'); + $result = $this->client->transfers->update( + 'tr_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Transfer::class, $result); + } + + public function testTransfersReversalsGet() + { + $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\ReceivedDebit::class, $result->data[0]); + static::assertInstanceOf(\Stripe\TransferReversal::class, $result->data[0]); } - public function testRetrieveReceivedDebit() + public function testTransfersReversalsGet2() { $this->expectsRequest( 'get', - '/v1/treasury/received_debits/rd_xxxxxxxxxxxxx' + '/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->receivedDebits->retrieve( - 'rd_xxxxxxxxxxxxx', + $result = $this->client->transfers->retrieveReversal( + 'tr_xxxxxxxxxxxxx', + 'trr_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result); + static::assertInstanceOf(\Stripe\TransferReversal::class, $result); } - public function testListTransactionEntry() + public function testTransfersReversalsPost() { - $this->expectsRequest('get', '/v1/treasury/transaction_entries'); - $result = $this->client->treasury->transactionEntries->all([ + $this->expectsRequest( + 'post', + '/v1/transfers/tr_xxxxxxxxxxxxx/reversals' + ); + $result = $this->client->transfers->createReversal( + 'tr_xxxxxxxxxxxxx', + ['amount' => 100] + ); + static::assertInstanceOf(\Stripe\TransferReversal::class, $result); + } + + public function testTransfersReversalsPost2() + { + $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); + } + + public function testTreasuryCreditReversalsGet() + { + $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\TransactionEntry::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result->data[0]); } - public function testRetrieveTransactionEntry() + public function testTreasuryCreditReversalsGet2() { $this->expectsRequest( 'get', - '/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx' + '/v1/treasury/credit_reversals/credrev_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->transactionEntries->retrieve( - 'trxne_xxxxxxxxxxxxx', + $result = $this->client->treasury->creditReversals->retrieve( + 'credrev_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result); + static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result); } - public function testListTransaction2() + public function testTreasuryCreditReversalsPost() { - $this->expectsRequest('get', '/v1/treasury/transactions'); - $result = $this->client->treasury->transactions->all([ + $this->expectsRequest('post', '/v1/treasury/credit_reversals'); + $result = $this->client->treasury->creditReversals->create([ + 'received_credit' => 'rc_xxxxxxxxxxxxx', + ]); + static::assertInstanceOf(\Stripe\Treasury\CreditReversal::class, $result); + } + + public function testTreasuryDebitReversalsGet() + { + $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\Transaction::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result->data[0]); } - public function testRetrieveTransaction2() + public function testTreasuryDebitReversalsGet2() { $this->expectsRequest( 'get', - '/v1/treasury/transactions/trxn_xxxxxxxxxxxxx' + '/v1/treasury/debit_reversals/debrev_xxxxxxxxxxxxx' ); - $result = $this->client->treasury->transactions->retrieve( - 'trxn_xxxxxxxxxxxxx', + $result = $this->client->treasury->debitReversals->retrieve( + 'debrev_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result); + static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result); } - public function testListWebhookEndpoint() + public function testTreasuryDebitReversalsPost() { - $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]); + $this->expectsRequest('post', '/v1/treasury/debit_reversals'); + $result = $this->client->treasury->debitReversals->create([ + 'received_debit' => 'rd_xxxxxxxxxxxxx', + ]); + static::assertInstanceOf(\Stripe\Treasury\DebitReversal::class, $result); } - public function testDeleteWebhookEndpoint() + public function testTreasuryFinancialAccountsFeaturesGet() { $this->expectsRequest( - 'delete', - '/v1/webhook_endpoints/we_xxxxxxxxxxxxx' + 'get', + '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features' ); - $result = $this->client->webhookEndpoints->delete( - 'we_xxxxxxxxxxxxx', + $result = $this->client->treasury->financialAccounts->retrieveFeatures( + 'fa_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccountFeatures::class, $result); } - public function testRetrieveWebhookEndpoint() + public function testTreasuryFinancialAccountsGet() { - $this->expectsRequest('get', '/v1/webhook_endpoints/we_xxxxxxxxxxxxx'); - $result = $this->client->webhookEndpoints->retrieve( - 'we_xxxxxxxxxxxxx', + $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\FinancialAccount::class, $result->data[0]); + } + + public function testTreasuryFinancialAccountsGet2() + { + $this->expectsRequest( + 'get', + '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' + ); + $result = $this->client->treasury->financialAccounts->retrieve( + 'fa_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); } - public function testUpdateWebhookEndpoint() + public function testTreasuryFinancialAccountsPost() { - $this->expectsRequest('post', '/v1/webhook_endpoints/we_xxxxxxxxxxxxx'); - $result = $this->client->webhookEndpoints->update( - 'we_xxxxxxxxxxxxx', - ['url' => 'https://example.com/new_endpoint'] + $this->expectsRequest('post', '/v1/treasury/financial_accounts'); + $result = $this->client->treasury->financialAccounts->create([ + 'supported_currencies' => ['usd'], + 'features' => [], + ]); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); + } + + public function testTreasuryFinancialAccountsPost2() + { + $this->expectsRequest( + 'post', + '/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx' ); - static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); + $result = $this->client->treasury->financialAccounts->update( + 'fa_xxxxxxxxxxxxx', + ['metadata' => ['order_id' => '6735']] + ); + static::assertInstanceOf(\Stripe\Treasury\FinancialAccount::class, $result); } - public function testCreateFromCalculationTransaction() + public function testTreasuryInboundTransfersCancelPost() { $this->expectsRequest( 'post', - '/v1/tax/transactions/create_from_calculation' + '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel' ); - $result = $this->client->tax->transactions->createFromCalculation([ - 'calculation' => 'xxx', - 'reference' => 'yyy', - ]); - static::assertInstanceOf(\Stripe\Tax\Transaction::class, $result); + $result = $this->client->treasury->inboundTransfers->cancel( + 'ibt_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testListLineItemsCalculation() + public function testTreasuryInboundTransfersGet() { - $this->expectsRequest('get', '/v1/tax/calculations/xxx/line_items'); - $result = $this->client->tax->calculations->allLineItems('xxx', []); + $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\Tax\CalculationLineItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result->data[0]); } - public function testListPreviewInvoiceLinesQuote() + public function testTreasuryInboundTransfersGet2() { $this->expectsRequest( 'get', - '/v1/quotes/qt_xyz/preview_invoices/in_xyz/lines' + '/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx' ); - $result = $this->client->quotes->allPreviewInvoiceLines( - 'qt_xyz', - 'in_xyz', + $result = $this->client->treasury->inboundTransfers->retrieve( + 'ibt_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\InvoiceLineItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testCreatePaymentIntent3() + public function testTreasuryInboundTransfersPost() { - $this->expectsRequest('post', '/v1/payment_intents'); - $result = $this->client->paymentIntents->create([ - 'amount' => 200, + $this->expectsRequest('post', '/v1/treasury/inbound_transfers'); + $result = $this->client->treasury->inboundTransfers->create([ + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'amount' => 10000, 'currency' => 'usd', - 'payment_method_data' => [ - 'type' => 'p24', - 'p24' => ['bank' => 'blik'], - ], + 'origin_payment_method' => 'pm_xxxxxxxxxxxxx', + 'description' => 'InboundTransfer from my bank account', ]); - static::assertInstanceOf(\Stripe\PaymentIntent::class, $result); + static::assertInstanceOf(\Stripe\Treasury\InboundTransfer::class, $result); } - public function testListLineItemsQuote() + public function testTreasuryOutboundPaymentsCancelPost() { - $this->expectsRequest('get', '/v1/quotes/qt_xxxxxxxxxxxxx/line_items'); - $result = $this->client->quotes->allLineItems('qt_xxxxxxxxxxxxx', []); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\LineItem::class, $result->data[0]); + $this->expectsRequest( + 'post', + '/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx/cancel' + ); + $result = $this->client->treasury->outboundPayments->cancel( + 'bot_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); } - public function testCreateCalculation() + public function testTreasuryOutboundPaymentsGet() { - $this->expectsRequest('post', '/v1/tax/calculations'); - $result = $this->client->tax->calculations->create([ - 'currency' => 'usd', - 'line_items' => [ - [ - 'amount' => 1000, - 'reference' => 'L1', - ], - ], - 'customer_details' => [ - 'address' => [ - 'line1' => '354 Oyster Point Blvd', - 'city' => 'South San Francisco', - 'state' => 'CA', - 'postal_code' => '94080', - 'country' => 'US', - ], - 'address_source' => 'shipping', - ], + $this->expectsRequest('get', '/v1/treasury/outbound_payments'); + $result = $this->client->treasury->outboundPayments->all([ + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'limit' => 3, ]); - static::assertInstanceOf(\Stripe\Tax\Calculation::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result->data[0]); } - public function testPreviewLinesCreditNote() + public function testTreasuryOutboundPaymentsGet2() { - $this->expectsRequest('get', '/v1/credit_notes/preview/lines'); - $result = $this->client->creditNotes->previewLines([ - 'limit' => 3, - 'invoice' => 'in_xxxxxxxxxxxxx', + $this->expectsRequest( + 'get', + '/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx' + ); + $result = $this->client->treasury->outboundPayments->retrieve( + 'bot_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); + } + + public function testTreasuryOutboundPaymentsPost() + { + $this->expectsRequest('post', '/v1/treasury/outbound_payments'); + $result = $this->client->treasury->outboundPayments->create([ + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'amount' => 10000, + 'currency' => 'usd', + 'customer' => 'cus_xxxxxxxxxxxxx', + 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', + 'description' => 'OutboundPayment to a 3rd party', ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\CreditNoteLineItem::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\OutboundPayment::class, $result); } - public function testPdfQuote() + public function testTreasuryOutboundTransfersCancelPost() { - $this->expectsRequestStream('get', '/v1/quotes/qt_xxxxxxxxxxxxx/pdf'); - $result = $this->client->quotes->pdf( - 'qt_xxxxxxxxxxxxx', - function () {}, + $this->expectsRequest( + 'post', + '/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx/cancel' + ); + $result = $this->client->treasury->outboundTransfers->cancel( + 'obt_xxxxxxxxxxxxx', [] ); - // TODO: assert proper instance, {"shape":"file"} + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testPdfForm() + public function testTreasuryOutboundTransfersGet() { - $this->expectsRequestStream( + $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\Treasury\OutboundTransfer::class, $result->data[0]); + } + + public function testTreasuryOutboundTransfersGet2() + { + $this->expectsRequest( 'get', - '/v1/tax/forms/form_xxxxxxxxxxxxx/pdf' + '/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx' ); - $result = $this->client->tax->forms->pdf( - 'form_xxxxxxxxxxxxx', - function () {}, + $result = $this->client->treasury->outboundTransfers->retrieve( + 'obt_xxxxxxxxxxxxx', [] ); - // TODO: assert proper instance, {"shape":"file"} + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testListPaymentMethodConfiguration() + public function testTreasuryOutboundTransfersPost() { - $this->expectsRequest('get', '/v1/payment_method_configurations'); - $result = $this->client->paymentMethodConfigurations->all([ - 'application' => 'foo', + $this->expectsRequest('post', '/v1/treasury/outbound_transfers'); + $result = $this->client->treasury->outboundTransfers->create([ + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'destination_payment_method' => 'pm_xxxxxxxxxxxxx', + 'amount' => 500, + 'currency' => 'usd', + 'description' => 'OutboundTransfer to my external bank account', ]); - static::assertInstanceOf(\Stripe\Collection::class, $result); - static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result->data[0]); + static::assertInstanceOf(\Stripe\Treasury\OutboundTransfer::class, $result); } - public function testCreatePaymentMethodConfiguration() + public function testTreasuryReceivedCreditsGet() { - $this->expectsRequest('post', '/v1/payment_method_configurations'); - $result = $this->client->paymentMethodConfigurations->create([ - 'acss_debit' => ['display_preference' => ['preference' => 'none']], - 'affirm' => ['display_preference' => ['preference' => 'none']], + $this->expectsRequest('get', '/v1/treasury/received_credits'); + $result = $this->client->treasury->receivedCredits->all([ + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'limit' => 3, ]); - static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result->data[0]); } - public function testRetrievePaymentMethodConfiguration() + public function testTreasuryReceivedCreditsGet2() { - $this->expectsRequest('get', '/v1/payment_method_configurations/foo'); - $result = $this->client->paymentMethodConfigurations->retrieve( - 'foo', + $this->expectsRequest( + 'get', + '/v1/treasury/received_credits/rc_xxxxxxxxxxxxx' + ); + $result = $this->client->treasury->receivedCredits->retrieve( + 'rc_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result); + static::assertInstanceOf(\Stripe\Treasury\ReceivedCredit::class, $result); } - public function testUpdatePaymentMethodConfiguration() + public function testTreasuryReceivedDebitsGet() { - $this->expectsRequest('post', '/v1/payment_method_configurations/foo'); - $result = $this->client->paymentMethodConfigurations->update( - 'foo', - ['acss_debit' => ['display_preference' => ['preference' => 'on']]] - ); - static::assertInstanceOf(\Stripe\PaymentMethodConfiguration::class, $result); + $this->expectsRequest('get', '/v1/treasury/received_debits'); + $result = $this->client->treasury->receivedDebits->all([ + 'financial_account' => 'fa_xxxxxxxxxxxxx', + 'limit' => 3, + ]); + static::assertInstanceOf(\Stripe\Collection::class, $result); + static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result->data[0]); } - public function testCreateAuthorization() + public function testTreasuryReceivedDebitsGet2() { $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/authorizations' + 'get', + '/v1/treasury/received_debits/rd_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->issuing->authorizations->create([ - 'amount' => 100, - 'amount_details' => [ - 'atm_fee' => 10, - 'cashback_amount' => 5, - ], - 'authorization_method' => 'chip', - 'card' => 'foo', - 'currency' => 'usd', - 'is_amount_controllable' => true, - 'merchant_data' => [ - 'category' => 'ac_refrigeration_repair', - 'city' => 'foo', - 'country' => 'bar', - 'name' => 'foo', - 'network_id' => 'bar', - 'postal_code' => 'foo', - 'state' => 'bar', - 'terminal_id' => 'foo', - ], - 'network_data' => ['acquiring_institution_id' => 'foo'], - 'verification_data' => [ - 'address_line1_check' => 'mismatch', - 'address_postal_code_check' => 'match', - 'cvc_check' => 'match', - 'expiry_check' => 'mismatch', - ], - 'wallet' => 'apple_pay', - ]); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + $result = $this->client->treasury->receivedDebits->retrieve( + 'rd_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\Treasury\ReceivedDebit::class, $result); } - public function testCaptureAuthorization() + public function testTreasuryTransactionEntriesGet() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/authorizations/example_authorization/capture' - ); - $result = $this->client->testHelpers->issuing->authorizations->capture( - 'example_authorization', - [ - 'capture_amount' => 100, - 'close_authorization' => true, - 'purchase_details' => [ - 'flight' => [ - 'departure_at' => 1633651200, - 'passenger_name' => 'John Doe', - 'refundable' => true, - 'segments' => [ - [ - 'arrival_airport_code' => 'SFO', - 'carrier' => 'Delta', - 'departure_airport_code' => 'LAX', - 'flight_number' => 'DL100', - 'service_class' => 'Economy', - 'stopover_allowed' => true, - ], - ], - 'travel_agency' => 'Orbitz', - ], - 'fuel' => [ - 'type' => 'diesel', - 'unit' => 'liter', - 'unit_cost_decimal' => '3.5', - 'volume_decimal' => '10', - ], - 'lodging' => [ - 'check_in_at' => 1633651200, - 'nights' => 2, - ], - 'receipt' => [ - [ - 'description' => 'Room charge', - 'quantity' => '1', - 'total' => 200, - 'unit_cost' => 200, - ], - ], - 'reference' => 'foo', - ], - ] - ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + $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 testExpireAuthorization() + public function testTreasuryTransactionEntriesGet2() { $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/authorizations/example_authorization/expire' + 'get', + '/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->issuing->authorizations->expire( - 'example_authorization', + $result = $this->client->treasury->transactionEntries->retrieve( + 'trxne_xxxxxxxxxxxxx', [] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\Treasury\TransactionEntry::class, $result); } - public function testIncrementAuthorization() + public function testTreasuryTransactionsGet() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/authorizations/example_authorization/increment' - ); - $result = $this->client->testHelpers->issuing->authorizations->increment( - 'example_authorization', - [ - 'increment_amount' => 50, - 'is_amount_controllable' => true, - ] - ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + $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 testReverseAuthorization() + public function testTreasuryTransactionsGet2() { $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/authorizations/example_authorization/reverse' + 'get', + '/v1/treasury/transactions/trxn_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->issuing->authorizations->reverse( - 'example_authorization', - ['reverse_amount' => 20] + $result = $this->client->treasury->transactions->retrieve( + 'trxn_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Issuing\Authorization::class, $result); + static::assertInstanceOf(\Stripe\Treasury\Transaction::class, $result); } - public function testCreateForceCaptureTransaction() + public function testWebhookEndpointsDelete() { $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/transactions/create_force_capture' + 'delete', + '/v1/webhook_endpoints/we_xxxxxxxxxxxxx' ); - $result = $this->client->testHelpers->issuing->transactions->createForceCapture([ - 'amount' => 100, - 'card' => 'foo', - 'currency' => 'usd', - 'merchant_data' => [ - 'category' => 'ac_refrigeration_repair', - 'city' => 'foo', - 'country' => 'US', - 'name' => 'foo', - 'network_id' => 'bar', - 'postal_code' => '10001', - 'state' => 'NY', - 'terminal_id' => 'foo', - ], - 'purchase_details' => [ - 'flight' => [ - 'departure_at' => 1633651200, - 'passenger_name' => 'John Doe', - 'refundable' => true, - 'segments' => [ - [ - 'arrival_airport_code' => 'SFO', - 'carrier' => 'Delta', - 'departure_airport_code' => 'LAX', - 'flight_number' => 'DL100', - 'service_class' => 'Economy', - 'stopover_allowed' => true, - ], - ], - 'travel_agency' => 'Orbitz', - ], - 'fuel' => [ - 'type' => 'diesel', - 'unit' => 'liter', - 'unit_cost_decimal' => '3.5', - 'volume_decimal' => '10', - ], - 'lodging' => [ - 'check_in_at' => 1533651200, - 'nights' => 2, - ], - 'receipt' => [ - [ - 'description' => 'Room charge', - 'quantity' => '1', - 'total' => 200, - 'unit_cost' => 200, - ], - ], - 'reference' => 'foo', - ], - ]); - static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); + $result = $this->client->webhookEndpoints->delete( + 'we_xxxxxxxxxxxxx', + [] + ); + static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } - public function testCreateUnlinkedRefundTransaction() + public function testWebhookEndpointsGet() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/transactions/create_unlinked_refund' - ); - $result = $this->client->testHelpers->issuing->transactions->createUnlinkedRefund([ - 'amount' => 100, - 'card' => 'foo', - 'currency' => 'usd', - 'merchant_data' => [ - 'category' => 'ac_refrigeration_repair', - 'city' => 'foo', - 'country' => 'bar', - 'name' => 'foo', - 'network_id' => 'bar', - 'postal_code' => 'foo', - 'state' => 'bar', - 'terminal_id' => 'foo', - ], - 'purchase_details' => [ - 'flight' => [ - 'departure_at' => 1533651200, - 'passenger_name' => 'John Doe', - 'refundable' => true, - 'segments' => [ - [ - 'arrival_airport_code' => 'SFO', - 'carrier' => 'Delta', - 'departure_airport_code' => 'LAX', - 'flight_number' => 'DL100', - 'service_class' => 'Economy', - 'stopover_allowed' => true, - ], - ], - 'travel_agency' => 'Orbitz', - ], - 'fuel' => [ - 'type' => 'diesel', - 'unit' => 'liter', - 'unit_cost_decimal' => '3.5', - 'volume_decimal' => '10', - ], - 'lodging' => [ - 'check_in_at' => 1533651200, - 'nights' => 2, - ], - 'receipt' => [ - [ - 'description' => 'Room charge', - 'quantity' => '1', - 'total' => 200, - 'unit_cost' => 200, - ], - ], - 'reference' => 'foo', - ], - ]); - static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); + $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 testRefundTransaction() + public function testWebhookEndpointsGet2() { - $this->expectsRequest( - 'post', - '/v1/test_helpers/issuing/transactions/example_transaction/refund' - ); - $result = $this->client->testHelpers->issuing->transactions->refund( - 'example_transaction', - ['refund_amount' => 50] + $this->expectsRequest('get', '/v1/webhook_endpoints/we_xxxxxxxxxxxxx'); + $result = $this->client->webhookEndpoints->retrieve( + 'we_xxxxxxxxxxxxx', + [] ); - static::assertInstanceOf(\Stripe\Issuing\Transaction::class, $result); + static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } - public function testDeleteDiscountSubscription() + public function testWebhookEndpointsPost2() { - $this->expectsRequest('delete', '/v1/subscriptions/sub_xyz/discount'); - $result = $this->client->subscriptions->deleteDiscount('sub_xyz', []); - static::assertInstanceOf(\Stripe\Discount::class, $result); + $this->expectsRequest('post', '/v1/webhook_endpoints/we_xxxxxxxxxxxxx'); + $result = $this->client->webhookEndpoints->update( + 'we_xxxxxxxxxxxxx', + ['url' => 'https://example.com/new_endpoint'] + ); + static::assertInstanceOf(\Stripe\WebhookEndpoint::class, $result); } }