From 0cc2dbd9b1f69101df078b13797cbcb77b5e666c Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 4 May 2022 14:04:50 -0400 Subject: [PATCH 1/4] Codegen for openapi 42cbb18 --- init.php | 5 ++ lib/FinancialConnections/Account.php | 84 +++++++++++++++++++ lib/FinancialConnections/Session.php | 27 ++++++ lib/Service/CoreServiceFactory.php | 2 + .../FinancialConnections/AccountService.php | 58 +++++++++++++ .../FinancialConnectionsServiceFactory.php | 27 ++++++ .../FinancialConnections/SessionService.php | 41 +++++++++ lib/StripeClient.php | 1 + lib/Util/ObjectTypes.php | 2 + 9 files changed, 247 insertions(+) create mode 100644 lib/FinancialConnections/Account.php create mode 100644 lib/FinancialConnections/Session.php create mode 100644 lib/Service/FinancialConnections/AccountService.php create mode 100644 lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php create mode 100644 lib/Service/FinancialConnections/SessionService.php diff --git a/init.php b/init.php index 91ab70998..a23250bfd 100644 --- a/init.php +++ b/init.php @@ -108,6 +108,8 @@ require __DIR__ . '/lib/ExchangeRate.php'; require __DIR__ . '/lib/File.php'; require __DIR__ . '/lib/FileLink.php'; +require __DIR__ . '/lib/FinancialConnections/Account.php'; +require __DIR__ . '/lib/FinancialConnections/Session.php'; require __DIR__ . '/lib/FundingInstructions.php'; require __DIR__ . '/lib/Identity/VerificationReport.php'; require __DIR__ . '/lib/Identity/VerificationSession.php'; @@ -194,6 +196,8 @@ require __DIR__ . '/lib/Service/ExchangeRateService.php'; require __DIR__ . '/lib/Service/FileService.php'; require __DIR__ . '/lib/Service/FileLinkService.php'; +require __DIR__ . '/lib/Service/FinancialConnections/AccountService.php'; +require __DIR__ . '/lib/Service/FinancialConnections/SessionService.php'; require __DIR__ . '/lib/Service/Identity/VerificationReportService.php'; require __DIR__ . '/lib/Service/Identity/VerificationSessionService.php'; require __DIR__ . '/lib/Service/InvoiceService.php'; @@ -249,6 +253,7 @@ require __DIR__ . '/lib/Service/BillingPortal/BillingPortalServiceFactory.php'; require __DIR__ . '/lib/Service/Checkout/CheckoutServiceFactory.php'; require __DIR__ . '/lib/Service/CoreServiceFactory.php'; +require __DIR__ . '/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php'; require __DIR__ . '/lib/Service/Identity/IdentityServiceFactory.php'; require __DIR__ . '/lib/Service/Issuing/IssuingServiceFactory.php'; require __DIR__ . '/lib/Service/Radar/RadarServiceFactory.php'; diff --git a/lib/FinancialConnections/Account.php b/lib/FinancialConnections/Account.php new file mode 100644 index 000000000..4a61d8d51 --- /dev/null +++ b/lib/FinancialConnections/Account.php @@ -0,0 +1,84 @@ +subcategory. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $display_name A human-readable name that has been assigned to this account, either by the account holder or by the institution. + * @property string $institution_name The name of the institution that holds this account. + * @property null|string $last4 The last 4 digits of the account number. If present, this will be 4 numeric characters. + * @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\StripeObject $ownership The most recent information about the account's owners. + * @property null|\Stripe\StripeObject $ownership_refresh The state of the most recent attempt to refresh the account owners. + * @property null|string[] $permissions The list of permissions granted by this account. + * @property string $status The status of the link to the account. + * @property string $subcategory

If category is cash, one of:

- checking - savings - other

If category is credit, one of:

- mortgage - line_of_credit - credit_card - other

If category is investment or other, this will be other.

+ * @property string[] $supported_payment_method_types The PaymentMethod type(s) that can be created from this account. + */ +class Account extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'financial_connections.account'; + + use \Stripe\ApiOperations\Retrieve; + + const CATEGORY_CASH = 'cash'; + const CATEGORY_CREDIT = 'credit'; + const CATEGORY_INVESTMENT = 'investment'; + const CATEGORY_OTHER = 'other'; + + const STATUS_ACTIVE = 'active'; + const STATUS_DISCONNECTED = 'disconnected'; + const STATUS_INACTIVE = 'inactive'; + + const SUBCATEGORY_CHECKING = 'checking'; + const SUBCATEGORY_CREDIT_CARD = 'credit_card'; + const SUBCATEGORY_LINE_OF_CREDIT = 'line_of_credit'; + const SUBCATEGORY_MORTGAGE = 'mortgage'; + const SUBCATEGORY_OTHER = 'other'; + const SUBCATEGORY_SAVINGS = 'savings'; + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FinancialConnections\Account the disconnected account + */ + public function disconnect($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/disconnect'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FinancialConnections\Account the refreshed account + */ + public function refresh($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/refresh'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } +} diff --git a/lib/FinancialConnections/Session.php b/lib/FinancialConnections/Session.php new file mode 100644 index 000000000..8d55cd06e --- /dev/null +++ b/lib/FinancialConnections/Session.php @@ -0,0 +1,27 @@ + $accounts The accounts that were collected as part of this Session. + * @property string $client_secret A value that will be passed to the client to launch the authentication flow. + * @property \Stripe\StripeObject $filters + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property string[] $permissions Permissions requested for accounts collected during this session. + * @property string $return_url For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. + */ +class Session extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'financial_connections.session'; + + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Retrieve; +} diff --git a/lib/Service/CoreServiceFactory.php b/lib/Service/CoreServiceFactory.php index 5157c2b68..76f82c3c3 100644 --- a/lib/Service/CoreServiceFactory.php +++ b/lib/Service/CoreServiceFactory.php @@ -26,6 +26,7 @@ * @property ExchangeRateService $exchangeRates * @property FileLinkService $fileLinks * @property FileService $files + * @property FinancialConnections\FinancialConnectionsServiceFactory $financialConnections * @property Identity\IdentityServiceFactory $identity * @property InvoiceItemService $invoiceItems * @property InvoiceService $invoices @@ -90,6 +91,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory 'exchangeRates' => ExchangeRateService::class, 'fileLinks' => FileLinkService::class, 'files' => FileService::class, + 'financialConnections' => FinancialConnections\FinancialConnectionsServiceFactory::class, 'identity' => Identity\IdentityServiceFactory::class, 'invoiceItems' => InvoiceItemService::class, 'invoices' => InvoiceService::class, diff --git a/lib/Service/FinancialConnections/AccountService.php b/lib/Service/FinancialConnections/AccountService.php new file mode 100644 index 000000000..1c96b1244 --- /dev/null +++ b/lib/Service/FinancialConnections/AccountService.php @@ -0,0 +1,58 @@ +Account. You will + * no longer be able to access data associated with the account (e.g. balances, + * transactions). + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FinancialConnections\Account + */ + public function disconnect($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/disconnect', $id), $params, $opts); + } + + /** + * Refreshes the data associated with a Financial Connections Account. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FinancialConnections\Account + */ + public function refresh($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/financial_connections/accounts/%s/refresh', $id), $params, $opts); + } + + /** + * Retrieves the details of an Financial Connections Account. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FinancialConnections\Account + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/financial_connections/accounts/%s', $id), $params, $opts); + } +} diff --git a/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php b/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php new file mode 100644 index 000000000..7dd826341 --- /dev/null +++ b/lib/Service/FinancialConnections/FinancialConnectionsServiceFactory.php @@ -0,0 +1,27 @@ + + */ + private static $classMap = [ + 'accounts' => AccountService::class, + 'sessions' => SessionService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/lib/Service/FinancialConnections/SessionService.php b/lib/Service/FinancialConnections/SessionService.php new file mode 100644 index 000000000..eab589cda --- /dev/null +++ b/lib/Service/FinancialConnections/SessionService.php @@ -0,0 +1,41 @@ +Session. The session’s client_secret can be used to + * launch the flow using Stripe.js. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FinancialConnections\Session + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/financial_connections/sessions', $params, $opts); + } + + /** + * Retrieves the details of a Financial Connections Session. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FinancialConnections\Session + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/financial_connections/sessions/%s', $id), $params, $opts); + } +} diff --git a/lib/StripeClient.php b/lib/StripeClient.php index 89dedad2e..27c58cac4 100644 --- a/lib/StripeClient.php +++ b/lib/StripeClient.php @@ -26,6 +26,7 @@ * @property \Stripe\Service\ExchangeRateService $exchangeRates * @property \Stripe\Service\FileLinkService $fileLinks * @property \Stripe\Service\FileService $files + * @property \Stripe\Service\FinancialConnections\FinancialConnectionsServiceFactory $financialConnections * @property \Stripe\Service\Identity\IdentityServiceFactory $identity * @property \Stripe\Service\InvoiceItemService $invoiceItems * @property \Stripe\Service\InvoiceService $invoices diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index b3b8400d9..4e14da660 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -43,6 +43,8 @@ class ObjectTypes \Stripe\File::OBJECT_NAME => \Stripe\File::class, \Stripe\File::OBJECT_NAME_ALT => \Stripe\File::class, \Stripe\FileLink::OBJECT_NAME => \Stripe\FileLink::class, + \Stripe\FinancialConnections\Account::OBJECT_NAME => \Stripe\FinancialConnections\Account::class, + \Stripe\FinancialConnections\Session::OBJECT_NAME => \Stripe\FinancialConnections\Session::class, \Stripe\FundingInstructions::OBJECT_NAME => \Stripe\FundingInstructions::class, \Stripe\Identity\VerificationReport::OBJECT_NAME => \Stripe\Identity\VerificationReport::class, \Stripe\Identity\VerificationSession::OBJECT_NAME => \Stripe\Identity\VerificationSession::class, From 4db7efeb6085a6f8eac4b5e7be34f60139157f4f Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 4 May 2022 16:20:53 -0400 Subject: [PATCH 2/4] New resources. --- init.php | 2 ++ lib/FinancialConnections/Account.php | 2 +- lib/FinancialConnections/AccountOwner.php | 19 +++++++++++++++++++ lib/FinancialConnections/AccountOwnership.php | 18 ++++++++++++++++++ lib/Util/ObjectTypes.php | 2 ++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lib/FinancialConnections/AccountOwner.php create mode 100644 lib/FinancialConnections/AccountOwnership.php diff --git a/init.php b/init.php index a23250bfd..e611aa5c6 100644 --- a/init.php +++ b/init.php @@ -109,6 +109,8 @@ require __DIR__ . '/lib/File.php'; require __DIR__ . '/lib/FileLink.php'; require __DIR__ . '/lib/FinancialConnections/Account.php'; +require __DIR__ . '/lib/FinancialConnections/AccountOwner.php'; +require __DIR__ . '/lib/FinancialConnections/AccountOwnership.php'; require __DIR__ . '/lib/FinancialConnections/Session.php'; require __DIR__ . '/lib/FundingInstructions.php'; require __DIR__ . '/lib/Identity/VerificationReport.php'; diff --git a/lib/FinancialConnections/Account.php b/lib/FinancialConnections/Account.php index 4a61d8d51..f24ef43d9 100644 --- a/lib/FinancialConnections/Account.php +++ b/lib/FinancialConnections/Account.php @@ -19,7 +19,7 @@ * @property string $institution_name The name of the institution that holds this account. * @property null|string $last4 The last 4 digits of the account number. If present, this will be 4 numeric characters. * @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\StripeObject $ownership The most recent information about the account's owners. + * @property null|string|\Stripe\FinancialConnections\AccountOwnership $ownership The most recent information about the account's owners. * @property null|\Stripe\StripeObject $ownership_refresh The state of the most recent attempt to refresh the account owners. * @property null|string[] $permissions The list of permissions granted by this account. * @property string $status The status of the link to the account. diff --git a/lib/FinancialConnections/AccountOwner.php b/lib/FinancialConnections/AccountOwner.php new file mode 100644 index 000000000..9cab33175 --- /dev/null +++ b/lib/FinancialConnections/AccountOwner.php @@ -0,0 +1,19 @@ + $owners A paginated list of owners for this account. + */ +class AccountOwnership extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'financial_connections.account_ownership'; +} diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index 4e14da660..715c5bd85 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -44,6 +44,8 @@ class ObjectTypes \Stripe\File::OBJECT_NAME_ALT => \Stripe\File::class, \Stripe\FileLink::OBJECT_NAME => \Stripe\FileLink::class, \Stripe\FinancialConnections\Account::OBJECT_NAME => \Stripe\FinancialConnections\Account::class, + \Stripe\FinancialConnections\AccountOwner::OBJECT_NAME => \Stripe\FinancialConnections\AccountOwner::class, + \Stripe\FinancialConnections\AccountOwnership::OBJECT_NAME => \Stripe\FinancialConnections\AccountOwnership::class, \Stripe\FinancialConnections\Session::OBJECT_NAME => \Stripe\FinancialConnections\Session::class, \Stripe\FundingInstructions::OBJECT_NAME => \Stripe\FundingInstructions::class, \Stripe\Identity\VerificationReport::OBJECT_NAME => \Stripe\Identity\VerificationReport::class, From 5f33415978a61dda38aaa295764d7bcc74cb877f Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 4 May 2022 16:54:08 -0400 Subject: [PATCH 3/4] Add ID field --- lib/FinancialConnections/AccountOwner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/FinancialConnections/AccountOwner.php b/lib/FinancialConnections/AccountOwner.php index 9cab33175..8f00e20d8 100644 --- a/lib/FinancialConnections/AccountOwner.php +++ b/lib/FinancialConnections/AccountOwner.php @@ -5,6 +5,7 @@ namespace Stripe\FinancialConnections; /** + * @property string $id * @property string $object * @property null|string $email The email address of the owner. * @property string $name The full name of the owner. From 9395945c2ec63d62bb06ef13f55a76ad6a8c7c78 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 4 May 2022 18:03:26 -0400 Subject: [PATCH 4/4] Document --- lib/FinancialConnections/AccountOwner.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/FinancialConnections/AccountOwner.php b/lib/FinancialConnections/AccountOwner.php index 8f00e20d8..53a7f1a4c 100644 --- a/lib/FinancialConnections/AccountOwner.php +++ b/lib/FinancialConnections/AccountOwner.php @@ -5,8 +5,8 @@ namespace Stripe\FinancialConnections; /** - * @property string $id - * @property string $object + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $email The email address of the owner. * @property string $name The full name of the owner. * @property string $ownership The ownership object that this owner belongs to.