diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 444f34fdd..779e39a95 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1410 \ No newline at end of file +v1414 \ No newline at end of file diff --git a/lib/Service/Treasury/FinancialAccountService.php b/lib/Service/Treasury/FinancialAccountService.php index f8ec126f9..76187a687 100644 --- a/lib/Service/Treasury/FinancialAccountService.php +++ b/lib/Service/Treasury/FinancialAccountService.php @@ -25,6 +25,24 @@ public function all($params = null, $opts = null) return $this->requestCollection('get', '/v1/treasury/financial_accounts', $params, $opts); } + /** + * Closes a FinancialAccount. A FinancialAccount can only be closed if it has a + * zero balance, has no pending InboundTransfers, and has canceled all attached + * Issuing cards. + * + * @param string $id + * @param null|array $params + * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Treasury\FinancialAccount + */ + public function close($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/treasury/financial_accounts/%s/close', $id), $params, $opts); + } + /** * Creates a new FinancialAccount. For now, each connected account can only have * one FinancialAccount. diff --git a/lib/Treasury/FinancialAccount.php b/lib/Treasury/FinancialAccount.php index b77eb7e6a..b9f1cffd4 100644 --- a/lib/Treasury/FinancialAccount.php +++ b/lib/Treasury/FinancialAccount.php @@ -17,8 +17,10 @@ * @property null|string $display_name The display name for the FinancialAccount. Use this field to customize the names of the FinancialAccounts for your connected accounts. Unlike the nickname field, display_name is not internal metadata and will be exposed to connected accounts. * @property null|\Stripe\Treasury\FinancialAccountFeatures $features Encodes whether a FinancialAccount has access to a particular Feature, with a status enum and associated status_details. Stripe or the platform can control Features via the requested field. * @property \Stripe\StripeObject[] $financial_addresses The set of credentials that resolve to a FinancialAccount. + * @property null|bool $is_default * @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|\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 $nickname The nickname for the FinancialAccount. * @property null|string[] $pending_features The array of paths to pending Features in the Features hash. * @property null|\Stripe\StripeObject $platform_restrictions The set of functionalities that the platform can restrict on the FinancialAccount. * @property null|string[] $restricted_features The array of paths to restricted Features in the Features hash. @@ -117,6 +119,23 @@ public static function update($id, $params = null, $opts = null) return $obj; } + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Treasury\FinancialAccount the closed financial account + */ + public function close($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/close'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + /** * @param null|array $params * @param null|array|string $opts