From 932feffeb2b0a6d013f89b56aa7f8cb50c4ceef7 Mon Sep 17 00:00:00 2001 From: Yejia Chen Date: Thu, 3 Feb 2022 15:07:56 -0800 Subject: [PATCH 1/2] Codegen for openapi 10fe9f5 --- init.php | 3 +- lib/Account.php | 8 +- lib/AccountLink.php | 2 +- lib/ApplePayDomain.php | 2 +- lib/ApplicationFee.php | 2 +- lib/ApplicationFeeRefund.php | 3 +- lib/Balance.php | 3 +- lib/BalanceTransaction.php | 2 +- lib/BankAccount.php | 2 +- lib/BillingPortal/Configuration.php | 2 +- lib/BillingPortal/Session.php | 2 +- lib/BitcoinReceiver.php | 2 +- lib/BitcoinTransaction.php | 3 +- lib/Capability.php | 2 +- lib/Card.php | 2 +- lib/Charge.php | 2 +- lib/Checkout/Session.php | 2 +- lib/CountrySpec.php | 2 +- lib/Coupon.php | 2 +- lib/CreditNote.php | 2 +- lib/CreditNoteLineItem.php | 3 +- lib/Customer.php | 4 +- lib/CustomerBalanceTransaction.php | 3 +- lib/Dispute.php | 2 +- lib/EphemeralKey.php | 6 +- lib/Event.php | 2 +- lib/ExchangeRate.php | 2 +- lib/File.php | 2 +- lib/FileLink.php | 2 +- lib/Identity/VerificationReport.php | 2 +- lib/Identity/VerificationSession.php | 2 +- lib/Invoice.php | 3 +- lib/InvoiceItem.php | 2 +- lib/InvoiceLineItem.php | 3 +- lib/Issuing/Authorization.php | 2 +- lib/Issuing/Card.php | 2 +- lib/Issuing/Cardholder.php | 2 +- lib/Issuing/Dispute.php | 2 +- lib/Issuing/Transaction.php | 2 +- lib/LineItem.php | 2 +- lib/LoginLink.php | 3 +- lib/Mandate.php | 2 +- lib/Order.php | 2 +- lib/OrderReturn.php | 2 +- lib/PaymentIntent.php | 4 +- lib/PaymentLink.php | 3 +- lib/PaymentMethod.php | 2 +- lib/Payout.php | 2 +- lib/Person.php | 2 +- lib/Plan.php | 2 +- lib/Price.php | 2 +- lib/Product.php | 2 +- lib/PromotionCode.php | 2 +- lib/Quote.php | 4 +- lib/Radar/EarlyFraudWarning.php | 2 +- lib/Radar/ValueList.php | 2 +- lib/Radar/ValueListItem.php | 2 +- lib/Recipient.php | 2 +- lib/Refund.php | 5 +- lib/Reporting/ReportRun.php | 2 +- lib/Reporting/ReportType.php | 2 +- lib/Review.php | 2 +- lib/SKU.php | 2 +- lib/Service/AccountLinkService.php | 2 +- lib/Service/AccountService.php | 2 +- lib/Service/ApplePayDomainService.php | 2 +- lib/Service/ApplicationFeeService.php | 2 +- lib/Service/BalanceService.php | 2 +- lib/Service/BalanceTransactionService.php | 2 +- .../BillingPortalServiceFactory.php | 5 +- .../BillingPortal/ConfigurationService.php | 4 +- lib/Service/BillingPortal/SessionService.php | 2 +- lib/Service/ChargeService.php | 2 +- .../Checkout/CheckoutServiceFactory.php | 3 +- lib/Service/Checkout/SessionService.php | 4 +- lib/Service/CoreServiceFactory.php | 113 +- lib/Service/CountrySpecService.php | 2 +- lib/Service/CouponService.php | 2 +- lib/Service/CreditNoteService.php | 4 +- lib/Service/CustomerService.php | 4 +- lib/Service/DisputeService.php | 2 +- lib/Service/EphemeralKeyService.php | 2 +- lib/Service/EventService.php | 2 +- lib/Service/ExchangeRateService.php | 2 +- lib/Service/FileLinkService.php | 2 +- lib/Service/FileService.php | 2 +- .../Identity/IdentityServiceFactory.php | 5 +- .../Identity/VerificationReportService.php | 4 +- .../Identity/VerificationSessionService.php | 4 +- lib/Service/InvoiceItemService.php | 2 +- lib/Service/InvoiceService.php | 2 +- lib/Service/Issuing/AuthorizationService.php | 2 +- lib/Service/Issuing/CardService.php | 2 +- lib/Service/Issuing/CardholderService.php | 2 +- lib/Service/Issuing/DisputeService.php | 2 +- lib/Service/Issuing/IssuingServiceFactory.php | 11 +- lib/Service/Issuing/TransactionService.php | 2 +- lib/Service/MandateService.php | 2 +- lib/Service/OrderReturnService.php | 2 +- lib/Service/OrderService.php | 2 +- lib/Service/PaymentIntentService.php | 2 +- lib/Service/PaymentLinkService.php | 2 +- lib/Service/PaymentMethodService.php | 4 +- lib/Service/PayoutService.php | 2 +- lib/Service/PlanService.php | 2 +- lib/Service/PriceService.php | 2 +- lib/Service/ProductService.php | 2 +- lib/Service/PromotionCodeService.php | 2 +- lib/Service/QuoteService.php | 12 +- .../Radar/EarlyFraudWarningService.php | 2 +- lib/Service/Radar/RadarServiceFactory.php | 7 +- lib/Service/Radar/ValueListItemService.php | 2 +- lib/Service/Radar/ValueListService.php | 2 +- lib/Service/RefundService.php | 2 +- lib/Service/Reporting/ReportRunService.php | 4 +- lib/Service/Reporting/ReportTypeService.php | 4 +- .../Reporting/ReportingServiceFactory.php | 5 +- lib/Service/ReviewService.php | 2 +- lib/Service/SetupAttemptService.php | 2 +- lib/Service/SetupIntentService.php | 2 +- lib/Service/ShippingRateService.php | 2 +- .../Sigma/ScheduledQueryRunService.php | 2 +- lib/Service/Sigma/SigmaServiceFactory.php | 3 +- lib/Service/SkuService.php | 2 +- lib/Service/SourceService.php | 2 +- lib/Service/SubscriptionItemService.php | 2 +- lib/Service/SubscriptionScheduleService.php | 2 +- lib/Service/SubscriptionService.php | 2 +- lib/Service/TaxCodeService.php | 2 +- lib/Service/TaxRateService.php | 4 +- .../Terminal/ConnectionTokenService.php | 2 +- lib/Service/Terminal/LocationService.php | 2 +- lib/Service/Terminal/ReaderService.php | 2 +- .../Terminal/TerminalServiceFactory.php | 7 +- lib/Service/TokenService.php | 2 +- lib/Service/TopupService.php | 4 +- lib/Service/TransferService.php | 2 +- lib/Service/WebhookEndpointService.php | 2 +- lib/SetupAttempt.php | 2 +- lib/SetupIntent.php | 2 +- lib/ShippingRate.php | 2 +- lib/Sigma/ScheduledQueryRun.php | 2 +- lib/Source.php | 2 +- lib/StripeClient.php | 1 - lib/Subscription.php | 3 +- lib/SubscriptionItem.php | 2 +- lib/SubscriptionSchedule.php | 2 +- lib/TaxCode.php | 2 +- lib/TaxId.php | 2 +- lib/TaxRate.php | 2 +- lib/Terminal/ConnectionToken.php | 2 +- lib/Terminal/Location.php | 2 +- lib/Terminal/Reader.php | 2 +- lib/ThreeDSecure.php | 2 +- lib/Token.php | 2 +- lib/Topup.php | 2 +- lib/Transfer.php | 2 +- lib/TransferReversal.php | 3 +- lib/UsageRecord.php | 3 +- lib/UsageRecordSummary.php | 3 +- lib/Util/ObjectTypes.php | 196 +- lib/WebhookEndpoint.php | 2 +- tests/Stripe/GeneratedExamplesTest.php | 5123 ++++++++--------- 163 files changed, 2787 insertions(+), 3059 deletions(-) diff --git a/init.php b/init.php index 70cfdde68..798bb586f 100644 --- a/init.php +++ b/init.php @@ -1,5 +1,4 @@ serializeParameters() : $v; if ([] !== $update) { - if (!$originalValue - || !\array_key_exists($i, $originalValue) - || ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { + if (!$originalValue || + !\array_key_exists($i, $originalValue) || + ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { $updateArr[$i] = $update; } } @@ -213,6 +212,7 @@ public function reject($params = null, $opts = null) return $this; } + /* * Capabilities methods * We can not add the capabilities() method today as the Account object already has a diff --git a/lib/AccountLink.php b/lib/AccountLink.php index 24a9e68aa..259588100 100644 --- a/lib/AccountLink.php +++ b/lib/AccountLink.php @@ -1,5 +1,4 @@ _save($opts); } + } diff --git a/lib/Balance.php b/lib/Balance.php index 0fdc2850c..428cec866 100644 --- a/lib/Balance.php +++ b/lib/Balance.php @@ -1,5 +1,4 @@ instanceUrl() . '/discount'; list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom(['discount' => null], $opts, true); - return $this; } /** * @param null|array $params * @param null|array|string $opts - * @param mixed $id * * @throws \Stripe\Exception\ApiErrorException if the request fails * @@ -99,6 +96,7 @@ public static function allPaymentMethods($id, $params = null, $opts = null) return $obj; } + const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; /** diff --git a/lib/CustomerBalanceTransaction.php b/lib/CustomerBalanceTransaction.php index 8c306760d..6d6181984 100644 --- a/lib/CustomerBalanceTransaction.php +++ b/lib/CustomerBalanceTransaction.php @@ -1,5 +1,4 @@ Indicates that you intend to make future payments with this PaymentIntent's payment method.

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

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

* @property null|\Stripe\StripeObject $shipping Shipping information for this PaymentIntent. - * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. + * @property null|string|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Account|\Stripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. * @property null|string $statement_descriptor For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters. * @property null|string $statement_descriptor_suffix Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. * @property string $status Status of this PaymentIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, canceled, or succeeded. Read more about each PaymentIntent status. @@ -124,4 +123,5 @@ public function confirm($params = null, $opts = null) return $this; } + } diff --git a/lib/PaymentLink.php b/lib/PaymentLink.php index c0399fe2c..862cf922b 100644 --- a/lib/PaymentLink.php +++ b/lib/PaymentLink.php @@ -1,5 +1,4 @@ request('post', '/v1/account_links', $params, $opts); } + } diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php index 28d094ec2..1fea1e384 100644 --- a/lib/Service/AccountService.php +++ b/lib/Service/AccountService.php @@ -1,5 +1,4 @@ request('get', $this->buildPath('/v1/accounts/%s', $id), $params, $opts); } + } diff --git a/lib/Service/ApplePayDomainService.php b/lib/Service/ApplePayDomainService.php index 6577b6b62..84675d668 100644 --- a/lib/Service/ApplePayDomainService.php +++ b/lib/Service/ApplePayDomainService.php @@ -1,5 +1,4 @@ request('get', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts); } + } diff --git a/lib/Service/ApplicationFeeService.php b/lib/Service/ApplicationFeeService.php index c05c3cd59..55f4f0a5e 100644 --- a/lib/Service/ApplicationFeeService.php +++ b/lib/Service/ApplicationFeeService.php @@ -1,5 +1,4 @@ request('post', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts); } + } diff --git a/lib/Service/BalanceService.php b/lib/Service/BalanceService.php index 0f55385f1..79da649b4 100644 --- a/lib/Service/BalanceService.php +++ b/lib/Service/BalanceService.php @@ -1,5 +1,4 @@ request('get', '/v1/balance', $params, $opts); } + } diff --git a/lib/Service/BalanceTransactionService.php b/lib/Service/BalanceTransactionService.php index fb1da5018..46d880200 100644 --- a/lib/Service/BalanceTransactionService.php +++ b/lib/Service/BalanceTransactionService.php @@ -1,5 +1,4 @@ request('get', $this->buildPath('/v1/balance_transactions/%s', $id), $params, $opts); } + } diff --git a/lib/Service/BillingPortal/BillingPortalServiceFactory.php b/lib/Service/BillingPortal/BillingPortalServiceFactory.php index 23a4d30b2..91e569288 100644 --- a/lib/Service/BillingPortal/BillingPortalServiceFactory.php +++ b/lib/Service/BillingPortal/BillingPortalServiceFactory.php @@ -1,5 +1,4 @@ */ private static $classMap = [ - 'configurations' => ConfigurationService::class, - 'sessions' => SessionService::class, + 'configurations' => ConfigurationService::class, + 'sessions' => SessionService::class, ]; protected function getServiceClass($name) diff --git a/lib/Service/BillingPortal/ConfigurationService.php b/lib/Service/BillingPortal/ConfigurationService.php index 5a0d70db7..e9f9a1fd9 100644 --- a/lib/Service/BillingPortal/ConfigurationService.php +++ b/lib/Service/BillingPortal/ConfigurationService.php @@ -1,5 +1,4 @@ request('post', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts); } + } diff --git a/lib/Service/BillingPortal/SessionService.php b/lib/Service/BillingPortal/SessionService.php index 6b3e60263..588e78c66 100644 --- a/lib/Service/BillingPortal/SessionService.php +++ b/lib/Service/BillingPortal/SessionService.php @@ -1,5 +1,4 @@ request('post', '/v1/billing_portal/sessions', $params, $opts); } + } diff --git a/lib/Service/ChargeService.php b/lib/Service/ChargeService.php index f8960edfb..87ac426e8 100644 --- a/lib/Service/ChargeService.php +++ b/lib/Service/ChargeService.php @@ -1,5 +1,4 @@ request('post', $this->buildPath('/v1/charges/%s', $id), $params, $opts); } + } diff --git a/lib/Service/Checkout/CheckoutServiceFactory.php b/lib/Service/Checkout/CheckoutServiceFactory.php index bb26a837f..64993f805 100644 --- a/lib/Service/Checkout/CheckoutServiceFactory.php +++ b/lib/Service/Checkout/CheckoutServiceFactory.php @@ -1,5 +1,4 @@ */ private static $classMap = [ - 'sessions' => SessionService::class, + 'sessions' => SessionService::class, ]; protected function getServiceClass($name) diff --git a/lib/Service/Checkout/SessionService.php b/lib/Service/Checkout/SessionService.php index b42ab8a17..daa3c5b6e 100644 --- a/lib/Service/Checkout/SessionService.php +++ b/lib/Service/Checkout/SessionService.php @@ -1,5 +1,4 @@ open. + * A Session can be expired when it is in one of these statuses: open * * After it expires, a customer can’t complete a Session and customers loading the * Session see a message saying the Session is expired. @@ -89,4 +88,5 @@ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/checkout/sessions/%s', $id), $params, $opts); } + } diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index edaadd3fa..036ca3ae7 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -1,5 +1,4 @@ */ private static $classMap = [ - 'accountLinks' => AccountLinkService::class, - 'accounts' => AccountService::class, - 'applePayDomains' => ApplePayDomainService::class, - 'applicationFees' => ApplicationFeeService::class, - 'balance' => BalanceService::class, - 'balanceTransactions' => BalanceTransactionService::class, - 'billingPortal' => BillingPortal\BillingPortalServiceFactory::class, - 'charges' => ChargeService::class, - 'checkout' => Checkout\CheckoutServiceFactory::class, - 'countrySpecs' => CountrySpecService::class, - 'coupons' => CouponService::class, - 'creditNotes' => CreditNoteService::class, - 'customers' => CustomerService::class, - 'disputes' => DisputeService::class, - 'ephemeralKeys' => EphemeralKeyService::class, - 'events' => EventService::class, - 'exchangeRates' => ExchangeRateService::class, - 'fileLinks' => FileLinkService::class, - 'files' => FileService::class, - 'identity' => Identity\IdentityServiceFactory::class, - 'invoiceItems' => InvoiceItemService::class, - 'invoices' => InvoiceService::class, - 'issuing' => Issuing\IssuingServiceFactory::class, - 'mandates' => MandateService::class, - 'oauth' => OAuthService::class, - 'orderReturns' => OrderReturnService::class, - 'orders' => OrderService::class, - 'paymentIntents' => PaymentIntentService::class, - 'paymentLinks' => PaymentLinkService::class, - 'paymentMethods' => PaymentMethodService::class, - 'payouts' => PayoutService::class, - 'plans' => PlanService::class, - 'prices' => PriceService::class, - 'products' => ProductService::class, - 'promotionCodes' => PromotionCodeService::class, - 'quotes' => QuoteService::class, - 'radar' => Radar\RadarServiceFactory::class, - 'refunds' => RefundService::class, - 'reporting' => Reporting\ReportingServiceFactory::class, - 'reviews' => ReviewService::class, - 'setupAttempts' => SetupAttemptService::class, - 'setupIntents' => SetupIntentService::class, - 'shippingRates' => ShippingRateService::class, - 'sigma' => Sigma\SigmaServiceFactory::class, - 'skus' => SkuService::class, - 'sources' => SourceService::class, - 'subscriptionItems' => SubscriptionItemService::class, - 'subscriptions' => SubscriptionService::class, - 'subscriptionSchedules' => SubscriptionScheduleService::class, - 'taxCodes' => TaxCodeService::class, - 'taxRates' => TaxRateService::class, - 'terminal' => Terminal\TerminalServiceFactory::class, - 'tokens' => TokenService::class, - 'topups' => TopupService::class, - 'transfers' => TransferService::class, - 'webhookEndpoints' => WebhookEndpointService::class, + 'accountLinks' => AccountLinkService::class, + 'accounts' => AccountService::class, + 'applePayDomains' => ApplePayDomainService::class, + 'applicationFees' => ApplicationFeeService::class, + 'balance' => BalanceService::class, + 'balanceTransactions' => BalanceTransactionService::class, + 'billingPortal' => BillingPortal\BillingPortalServiceFactory::class, + 'charges' => ChargeService::class, + 'checkout' => Checkout\CheckoutServiceFactory::class, + 'countrySpecs' => CountrySpecService::class, + 'coupons' => CouponService::class, + 'creditNotes' => CreditNoteService::class, + 'customers' => CustomerService::class, + 'disputes' => DisputeService::class, + 'ephemeralKeys' => EphemeralKeyService::class, + 'events' => EventService::class, + 'exchangeRates' => ExchangeRateService::class, + 'fileLinks' => FileLinkService::class, + 'files' => FileService::class, + 'identity' => Identity\IdentityServiceFactory::class, + 'invoiceItems' => InvoiceItemService::class, + 'invoices' => InvoiceService::class, + 'issuing' => Issuing\IssuingServiceFactory::class, + 'mandates' => MandateService::class, + 'oauth' => OAuthService::class, + 'orderReturns' => OrderReturnService::class, + 'orders' => OrderService::class, + 'paymentIntents' => PaymentIntentService::class, + 'paymentLinks' => PaymentLinkService::class, + 'paymentMethods' => PaymentMethodService::class, + 'payouts' => PayoutService::class, + 'plans' => PlanService::class, + 'prices' => PriceService::class, + 'products' => ProductService::class, + 'promotionCodes' => PromotionCodeService::class, + 'quotes' => QuoteService::class, + 'radar' => Radar\RadarServiceFactory::class, + 'refunds' => RefundService::class, + 'reporting' => Reporting\ReportingServiceFactory::class, + 'reviews' => ReviewService::class, + 'setupAttempts' => SetupAttemptService::class, + 'setupIntents' => SetupIntentService::class, + 'shippingRates' => ShippingRateService::class, + 'sigma' => Sigma\SigmaServiceFactory::class, + 'skus' => SkuService::class, + 'sources' => SourceService::class, + 'subscriptionItems' => SubscriptionItemService::class, + 'subscriptions' => SubscriptionService::class, + 'subscriptionSchedules' => SubscriptionScheduleService::class, + 'taxCodes' => TaxCodeService::class, + 'taxRates' => TaxRateService::class, + 'terminal' => Terminal\TerminalServiceFactory::class, + 'tokens' => TokenService::class, + 'topups' => TopupService::class, + 'transfers' => TransferService::class, + 'webhookEndpoints' => WebhookEndpointService::class, ]; protected function getServiceClass($name) diff --git a/lib/Service/CountrySpecService.php b/lib/Service/CountrySpecService.php index 573444fd3..3b5d43fd5 100644 --- a/lib/Service/CountrySpecService.php +++ b/lib/Service/CountrySpecService.php @@ -1,5 +1,4 @@ request('get', $this->buildPath('/v1/country_specs/%s', $id), $params, $opts); } + } diff --git a/lib/Service/CouponService.php b/lib/Service/CouponService.php index 82a880f53..76bf0a90d 100644 --- a/lib/Service/CouponService.php +++ b/lib/Service/CouponService.php @@ -1,5 +1,4 @@ request('post', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); } + } diff --git a/lib/Service/CreditNoteService.php b/lib/Service/CreditNoteService.php index 23681402e..1a3dd0998 100644 --- a/lib/Service/CreditNoteService.php +++ b/lib/Service/CreditNoteService.php @@ -1,5 +1,4 @@ status=open invoice, a credit note reduces its * amount_due. For a status=paid invoice, a credit note * does not affect its amount_due. Instead, it can result in any - * combination of the following:. + * combination of the following: * *