From c36f057690411d5a29336292cb03d180b0526e1e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 15 Aug 2022 17:45:53 +0300 Subject: [PATCH 1/7] Allow passing PSR-3 loggers to setLogger as they are compatible (#1304) * Allow passing PSR-3 loggers to setLogger as they are compatible * Fix cs Co-authored-by: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com> --- lib/Stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Stripe.php b/lib/Stripe.php index df76fa16b..fc1290f67 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -90,7 +90,7 @@ public static function getLogger() } /** - * @param Util\LoggerInterface $logger the logger to which the library + * @param \Psr\Log\LoggerInterface|Util\LoggerInterface $logger the logger to which the library * will produce messages */ public static function setLogger($logger) From ec4572378c32349928afb1d1b1a96434f5e5e649 Mon Sep 17 00:00:00 2001 From: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com> Date: Wed, 17 Aug 2022 14:06:10 -0700 Subject: [PATCH 2/7] Add a support section to the readme (#1351) We have user feedback on the lack of clarity around whether or not we maintain and improve older major versions of the SDK. This PR adds a support section clarifying this --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 41c202164..f7b9192b3 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the Stripe API. +## Support + +New features and bug fixes are released on the latest major version of the Stripe PHP library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates. + ## Requirements PHP 5.6.0 and later. From 9f872169705c06f5fe2b668ee31d75d520734ee0 Mon Sep 17 00:00:00 2001 From: Kamil Pajdzik Date: Thu, 18 Aug 2022 16:02:20 -0700 Subject: [PATCH 3/7] Codegen for openapi v183 --- OPENAPI_VERSION | 2 +- init.php | 1 + lib/Checkout/Session.php | 4 +-- lib/Customer.php | 30 +++++++++++++++++++ lib/CustomerCashBalanceTransaction.php | 41 ++++++++++++++++++++++++++ lib/Event.php | 1 + lib/Identity/VerificationSession.php | 2 +- lib/PaymentLink.php | 1 + lib/Service/CustomerService.php | 35 ++++++++++++++++++++++ lib/Topup.php | 2 +- lib/Util/ObjectTypes.php | 1 + tests/Stripe/GeneratedExamplesTest.php | 16 +++++----- 12 files changed, 123 insertions(+), 13 deletions(-) create mode 100644 lib/CustomerCashBalanceTransaction.php diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index fe5aa3c01..d9f3b7218 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v178 \ No newline at end of file +v183 \ No newline at end of file diff --git a/init.php b/init.php index b869746a5..39adb4c21 100644 --- a/init.php +++ b/init.php @@ -100,6 +100,7 @@ require __DIR__ . '/lib/CreditNoteLineItem.php'; require __DIR__ . '/lib/Customer.php'; require __DIR__ . '/lib/CustomerBalanceTransaction.php'; +require __DIR__ . '/lib/CustomerCashBalanceTransaction.php'; require __DIR__ . '/lib/Discount.php'; require __DIR__ . '/lib/Dispute.php'; require __DIR__ . '/lib/EphemeralKey.php'; diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php index 03ddc71c5..e7f09df60 100644 --- a/lib/Checkout/Session.php +++ b/lib/Checkout/Session.php @@ -20,8 +20,8 @@ * You can create a Checkout Session on your server and pass its ID to the client * to begin Checkout. * - * Related guide: Checkout - * Server Quickstart. + * Related guide: Checkout + * Quickstart. * * @property string $id Unique identifier for the object. Used to pass to redirectToCheckout in Stripe.js. * @property string $object String representing the object's type. Objects of the same type share the same value. diff --git a/lib/Customer.php b/lib/Customer.php index efbf083fd..db1148c3b 100644 --- a/lib/Customer.php +++ b/lib/Customer.php @@ -227,6 +227,36 @@ public static function updateBalanceTransaction($id, $balanceTransactionId, $par { return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); } + const PATH_CASH_BALANCE_TRANSACTIONS = '/cash_balance_transactions'; + + /** + * @param string $id the ID of the customer on which to retrieve the customer cash balance transactions + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection<\Stripe\CustomerCashBalanceTransaction> the list of customer cash balance transactions + */ + public static function allCashBalanceTransactions($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_CASH_BALANCE_TRANSACTIONS, $params, $opts); + } + + /** + * @param string $id the ID of the customer to which the customer cash balance transaction belongs + * @param string $cashBalanceTransactionId the ID of the customer cash balance transaction to retrieve + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CustomerCashBalanceTransaction + */ + public static function retrieveCashBalanceTransaction($id, $cashBalanceTransactionId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE_TRANSACTIONS, $cashBalanceTransactionId, $params, $opts); + } const PATH_SOURCES = '/sources'; /** diff --git a/lib/CustomerCashBalanceTransaction.php b/lib/CustomerCashBalanceTransaction.php new file mode 100644 index 000000000..143875a4f --- /dev/null +++ b/lib/CustomerCashBalanceTransaction.php @@ -0,0 +1,41 @@ +ISO currency code, in lowercase. Must be a supported currency. + * @property string|\Stripe\Customer $customer The customer whose available cash balance changed as a result of this transaction. + * @property int $ending_balance The total available cash balance for the specified currency after this transaction was applied. Represented in the smallest currency unit. + * @property \Stripe\StripeObject $funded + * @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 int $net_amount The amount by which the cash balance changed, represented in the smallest currency unit. A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance. + * @property \Stripe\StripeObject $refunded_from_payment + * @property string $type The type of the cash balance transaction. One of applied_to_payment, unapplied_from_payment, refunded_from_payment, funded, return_initiated, or return_canceled. New types may be added in future. See Customer Balance to learn more about these types. + * @property \Stripe\StripeObject $unapplied_from_payment + */ +class CustomerCashBalanceTransaction extends ApiResource +{ + const OBJECT_NAME = 'customer_cash_balance_transaction'; + + use ApiOperations\All; + use ApiOperations\Retrieve; + + const TYPE_APPLIED_TO_PAYMENT = 'applied_to_payment'; + const TYPE_FUNDED = 'funded'; + const TYPE_REFUNDED_FROM_PAYMENT = 'refunded_from_payment'; + const TYPE_RETURN_CANCELED = 'return_canceled'; + const TYPE_RETURN_INITIATED = 'return_initiated'; + const TYPE_UNAPPLIED_FROM_PAYMENT = 'unapplied_from_payment'; +} diff --git a/lib/Event.php b/lib/Event.php index 507d3f53c..c934ec2c3 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -117,6 +117,7 @@ class Event extends ApiResource const CUSTOMER_TAX_ID_DELETED = 'customer.tax_id.deleted'; const CUSTOMER_TAX_ID_UPDATED = 'customer.tax_id.updated'; const CUSTOMER_UPDATED = 'customer.updated'; + const CUSTOMER_CASH_BALANCE_TRANSACTION_CREATED = 'customer_cash_balance_transaction.created'; const FILE_CREATED = 'file.created'; const FINANCIAL_CONNECTIONS_ACCOUNT_CREATED = 'financial_connections.account.created'; const FINANCIAL_CONNECTIONS_ACCOUNT_DEACTIVATED = 'financial_connections.account.deactivated'; diff --git a/lib/Identity/VerificationSession.php b/lib/Identity/VerificationSession.php index 501939976..180e5091e 100644 --- a/lib/Identity/VerificationSession.php +++ b/lib/Identity/VerificationSession.php @@ -14,7 +14,7 @@ * A VerificationSession transitions through multiple statuses throughout its * lifetime as it progresses through the verification flow. The VerificationSession - * contains the user’s verified data after verification checks are complete. + * contains the user's verified data after verification checks are complete. * * Related guide: The Verification diff --git a/lib/PaymentLink.php b/lib/PaymentLink.php index 9de3e91b6..d2fc6df63 100644 --- a/lib/PaymentLink.php +++ b/lib/PaymentLink.php @@ -27,6 +27,7 @@ * @property \Stripe\StripeObject $automatic_tax * @property string $billing_address_collection Configuration for collecting the customer's billing address. * @property null|\Stripe\StripeObject $consent_collection When set, provides configuration to gather active consent from customers. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property string $customer_creation Configuration for Customer creation during checkout. * @property \Stripe\Collection<\Stripe\LineItem> $line_items The line items representing what is being sold. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. diff --git a/lib/Service/CustomerService.php b/lib/Service/CustomerService.php index 5735f32cf..5cb7910a2 100644 --- a/lib/Service/CustomerService.php +++ b/lib/Service/CustomerService.php @@ -39,6 +39,23 @@ public function allBalanceTransactions($parentId, $params = null, $opts = null) return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); } + /** + * Returns a list of transactions that modified the customer’s cash balance. + * + * @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\CustomerCashBalanceTransaction> + */ + public function allCashBalanceTransactions($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions', $parentId), $params, $opts); + } + /** * Returns a list of PaymentMethods for a given Customer. * @@ -292,6 +309,24 @@ public function retrieveCashBalance($parentId, $params = null, $opts = null) return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts); } + /** + * Retrieves a specific cash balance transaction, which updated the customer’s cash balance. + * + * @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\CustomerCashBalanceTransaction + */ + public function retrieveCashBalanceTransaction($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions/%s', $parentId, $id), $params, $opts); + } + /** * Retrieves a PaymentMethod object for a given Customer. * diff --git a/lib/Topup.php b/lib/Topup.php index 69cdd689b..a0ea053cd 100644 --- a/lib/Topup.php +++ b/lib/Topup.php @@ -24,7 +24,7 @@ * @property null|string $failure_message Message to user further explaining reason for top-up failure if available. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. - * @property \Stripe\Source $source

Source objects allow you to accept a variety of payment methods. They represent a customer's payment instrument, and can be used with the Stripe API just like a Card object: once chargeable, they can be charged, or can be attached to customers.

Related guides: Sources API and Sources & Customers.

+ * @property null|\Stripe\Source $source For most Stripe users, the source of every top-up is a bank account. This hash is then the source object describing that bank account. * @property null|string $statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter. * @property string $status The status of the top-up is either canceled, failed, pending, reversed, or succeeded. * @property null|string $transfer_group A string that identifies this top-up as part of a group. diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index b0b8f1e3e..a94b58291 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -33,6 +33,7 @@ class ObjectTypes \Stripe\CreditNoteLineItem::OBJECT_NAME => \Stripe\CreditNoteLineItem::class, \Stripe\Customer::OBJECT_NAME => \Stripe\Customer::class, \Stripe\CustomerBalanceTransaction::OBJECT_NAME => \Stripe\CustomerBalanceTransaction::class, + \Stripe\CustomerCashBalanceTransaction::OBJECT_NAME => \Stripe\CustomerCashBalanceTransaction::class, \Stripe\Discount::OBJECT_NAME => \Stripe\Discount::class, \Stripe\Dispute::OBJECT_NAME => \Stripe\Dispute::class, \Stripe\EphemeralKey::OBJECT_NAME => \Stripe\EphemeralKey::class, diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index d457906fb..206a87c18 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -1005,7 +1005,7 @@ public function testSearchCharge() $result = $this->client->charges->search( ['query' => 'amount>999 AND metadata[\'order_id\']:\'6735\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Charge","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Charge","namespaces":[]},"hasSearchResultType":true} } public function testListSession() @@ -1337,7 +1337,7 @@ public function testSearchCustomer() $result = $this->client->customers->search( ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]},"hasSearchResultType":true} } public function testSearchCustomer2() @@ -1346,7 +1346,7 @@ public function testSearchCustomer2() $result = $this->client->customers->search( ['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]},"hasSearchResultType":true} } public function testListDispute() @@ -1732,7 +1732,7 @@ public function testSearchInvoice() $result = $this->client->invoices->search( ['query' => 'total>999 AND metadata[\'order_id\']:\'6735\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Invoice","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Invoice","namespaces":[]},"hasSearchResultType":true} } public function testListAuthorization() @@ -2065,7 +2065,7 @@ public function testSearchPaymentIntent() $result = $this->client->paymentIntents->search( ['query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"PaymentIntent","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"PaymentIntent","namespaces":[]},"hasSearchResultType":true} } public function testListPaymentLink() @@ -2308,7 +2308,7 @@ public function testSearchPrice() $result = $this->client->prices->search( ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Price","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Price","namespaces":[]},"hasSearchResultType":true} } public function testListProduct() @@ -2356,7 +2356,7 @@ public function testSearchProduct() $result = $this->client->products->search( ['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Product","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Product","namespaces":[]},"hasSearchResultType":true} } public function testListPromotionCode() @@ -3074,7 +3074,7 @@ public function testSearchSubscription() $result = $this->client->subscriptions->search( ['query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\''] ); - // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Subscription","namespaces":[]}} + // TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Subscription","namespaces":[]},"hasSearchResultType":true} } public function testListTaxCode() From 19218fbe744b8fc05ca2d0afcd36d3eaf0fadb9d Mon Sep 17 00:00:00 2001 From: Kamil Pajdzik Date: Fri, 19 Aug 2022 11:53:38 -0700 Subject: [PATCH 4/7] Bump version to 9.2.0 --- CHANGELOG.md | 8 ++++++++ VERSION | 2 +- lib/Stripe.php | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a24f839d0..7f3b562f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 9.2.0 - 2022-08-19 +* [#1352](https://github.com/stripe/stripe-php/pull/1352) API Updates + * Add support for new resource `CustomerCashBalanceTransaction` + * Add support for `currency` on `PaymentLink` + * Add constant for `customer_cash_balance_transaction.created` webhook event. +* [#1351](https://github.com/stripe/stripe-php/pull/1351) Add a support section to the readme +* [#1304](https://github.com/stripe/stripe-php/pull/1304) Allow passing PSR-3 loggers to setLogger as they are compatible + ## 9.1.0 - 2022-08-11 * [#1348](https://github.com/stripe/stripe-php/pull/1348) API Updates * Add support for `payment_method_collection` on `Checkout.Session` and `PaymentLink` diff --git a/VERSION b/VERSION index 47da986f8..deeb3d66e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.1.0 +9.2.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index fc1290f67..5bf94ed4a 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '9.1.0'; + const VERSION = '9.2.0'; /** * @return string the API key used for requests From ef84d4cefb3509dfb6b937a8156ea0454519640c Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 23 Aug 2022 05:36:02 -0700 Subject: [PATCH 5/7] Set version to 9.2.0 to simplify merge --- VERSION | 2 +- lib/Stripe.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 9251426c8..deeb3d66e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.2.0-beta.1 +9.2.0 diff --git a/lib/Stripe.php b/lib/Stripe.php index d969c5a61..76ce0d903 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '9.2.0-beta.1'; + const VERSION = '9.2.0'; /** * @return string the API key used for requests From 511d39f3e9f435b72dee1ba101cb9166af175d56 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 23 Aug 2022 05:36:02 -0700 Subject: [PATCH 6/7] Reset version to 9.2.0-beta.1 --- VERSION | 2 +- lib/Stripe.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index deeb3d66e..9251426c8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.2.0 +9.2.0-beta.1 diff --git a/lib/Stripe.php b/lib/Stripe.php index 5bf94ed4a..df6cf1e16 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -58,7 +58,7 @@ class Stripe /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '9.2.0'; + const VERSION = '9.2.0-beta.1'; /** * @return string the API key used for requests From 16e8e72b7959908707858d52aa8faa845f21e490 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 23 Aug 2022 05:36:34 -0700 Subject: [PATCH 7/7] Codegen for openapi v184 --- OPENAPI_VERSION | 2 +- init.php | 2 ++ lib/AccountSession.php | 30 ++++++++++++++++++++++++++ lib/Service/AccountSessionService.php | 24 +++++++++++++++++++++ lib/Service/CoreServiceFactory.php | 2 ++ lib/StripeClient.php | 1 + lib/Treasury/OutboundTransfer.php | 2 +- lib/Util/ApiVersion.php | 2 +- lib/Util/ObjectTypes.php | 1 + tests/Stripe/GeneratedExamplesTest.php | 2 +- 10 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 lib/AccountSession.php create mode 100644 lib/Service/AccountSessionService.php diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d9f3b7218..c13f8f959 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v183 \ No newline at end of file +v184 \ No newline at end of file diff --git a/init.php b/init.php index 35d506c08..c077152ba 100644 --- a/init.php +++ b/init.php @@ -79,6 +79,7 @@ // Stripe API Resources require __DIR__ . '/lib/Account.php'; require __DIR__ . '/lib/AccountLink.php'; +require __DIR__ . '/lib/AccountSession.php'; require __DIR__ . '/lib/ApplePayDomain.php'; require __DIR__ . '/lib/ApplicationFee.php'; require __DIR__ . '/lib/ApplicationFeeRefund.php'; @@ -188,6 +189,7 @@ // Services require __DIR__ . '/lib/Service/AccountService.php'; require __DIR__ . '/lib/Service/AccountLinkService.php'; +require __DIR__ . '/lib/Service/AccountSessionService.php'; require __DIR__ . '/lib/Service/ApplePayDomainService.php'; require __DIR__ . '/lib/Service/ApplicationFeeService.php'; require __DIR__ . '/lib/Service/Apps/SecretService.php'; diff --git a/lib/AccountSession.php b/lib/AccountSession.php new file mode 100644 index 000000000..ab1936d57 --- /dev/null +++ b/lib/AccountSession.php @@ -0,0 +1,30 @@ +Connect + * Elements. + * + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string $account The ID of the account the AccountSession was created for + * @property string $client_secret

The client secret of this AccountSession. Used on the client to set up secure access to the given account.

The client secret can be used to provide access to account from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.

Refer to our docs to setup Connect Elements and learn about how client_secret should be handled.

+ * @property int $expires_at The timestamp at which this AccountSession will expire. + * @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. + */ +class AccountSession extends ApiResource +{ + const OBJECT_NAME = 'account_session'; + + use ApiOperations\Create; +} diff --git a/lib/Service/AccountSessionService.php b/lib/Service/AccountSessionService.php new file mode 100644 index 000000000..e7d8a1f9f --- /dev/null +++ b/lib/Service/AccountSessionService.php @@ -0,0 +1,24 @@ +request('post', '/v1/account_sessions', $params, $opts); + } +} diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index dd9f0a66c..193c02e41 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -9,6 +9,7 @@ * * @property AccountLinkService $accountLinks * @property AccountService $accounts + * @property AccountSessionService $accountSessions * @property ApplePayDomainService $applePayDomains * @property ApplicationFeeService $applicationFees * @property Apps\AppsServiceFactory $apps @@ -76,6 +77,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory private static $classMap = [ 'accountLinks' => AccountLinkService::class, 'accounts' => AccountService::class, + 'accountSessions' => AccountSessionService::class, 'applePayDomains' => ApplePayDomainService::class, 'applicationFees' => ApplicationFeeService::class, 'apps' => Apps\AppsServiceFactory::class, diff --git a/lib/StripeClient.php b/lib/StripeClient.php index bc0fcd613..3c5b7d1b0 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -8,6 +8,7 @@ * Client used to send requests to Stripe's API. * * @property \Stripe\Service\AccountLinkService $accountLinks + * @property \Stripe\Service\AccountSessionService $accountSessions * @property \Stripe\Service\AccountService $accounts * @property \Stripe\Service\ApplePayDomainService $applePayDomains * @property \Stripe\Service\ApplicationFeeService $applicationFees diff --git a/lib/Treasury/OutboundTransfer.php b/lib/Treasury/OutboundTransfer.php index f78c8653f..66e0ce1d8 100644 --- a/lib/Treasury/OutboundTransfer.php +++ b/lib/Treasury/OutboundTransfer.php @@ -23,7 +23,7 @@ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. - * @property string $destination_payment_method The PaymentMethod used as the payment instrument for an OutboundTransfer. + * @property null|string $destination_payment_method The PaymentMethod used as the payment instrument for an OutboundTransfer. * @property \Stripe\StripeObject $destination_payment_method_details * @property int $expected_arrival_date The date when funds are expected to arrive in the destination account. * @property string $financial_account The FinancialAccount that funds were pulled from. diff --git a/lib/Util/ApiVersion.php b/lib/Util/ApiVersion.php index 99099de23..7cd0170ae 100644 --- a/lib/Util/ApiVersion.php +++ b/lib/Util/ApiVersion.php @@ -6,5 +6,5 @@ class ApiVersion { - const CURRENT = '2022-08-01; server_side_confirmation_beta=v1; orders_beta=v4; terminal_interac_refunds_beta=v1'; + const CURRENT = '2022-08-01'; } diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index 5262e78d5..2a70a1364 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -12,6 +12,7 @@ class ObjectTypes const mapping = [ \Stripe\Account::OBJECT_NAME => \Stripe\Account::class, \Stripe\AccountLink::OBJECT_NAME => \Stripe\AccountLink::class, + \Stripe\AccountSession::OBJECT_NAME => \Stripe\AccountSession::class, \Stripe\ApplePayDomain::OBJECT_NAME => \Stripe\ApplePayDomain::class, \Stripe\ApplicationFee::OBJECT_NAME => \Stripe\ApplicationFee::class, \Stripe\ApplicationFeeRefund::OBJECT_NAME => \Stripe\ApplicationFeeRefund::class, diff --git a/tests/Stripe/GeneratedExamplesTest.php b/tests/Stripe/GeneratedExamplesTest.php index 65d17e5ed..e55400caa 100644 --- a/tests/Stripe/GeneratedExamplesTest.php +++ b/tests/Stripe/GeneratedExamplesTest.php @@ -444,7 +444,7 @@ public function testFundCashBalanceCustomer() 'cus_123', ['amount' => 30, 'currency' => 'eur'] ); - static::assertInstanceOf(\Stripe\CustomerBalanceTransaction::class, $result); + static::assertInstanceOf(\Stripe\CustomerCashBalanceTransaction::class, $result); } public function testDeliverCardCard()