Skip to content

Commit

Permalink
API Updates (#1281)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe authored May 5, 2022
1 parent 4158d88 commit e29cc51
Show file tree
Hide file tree
Showing 11 changed files with 289 additions and 0 deletions.
7 changes: 7 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
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/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';
require __DIR__ . '/lib/Identity/VerificationSession.php';
Expand Down Expand Up @@ -194,6 +198,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';
Expand Down Expand Up @@ -249,6 +255,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';
Expand Down
84 changes: 84 additions & 0 deletions lib/FinancialConnections/Account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\FinancialConnections;

/**
* A Financial Connections Account represents an account that exists outside of
* Stripe, to which you have been granted some degree of access.
*
* @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|\Stripe\StripeObject $account_holder The account holder that this account belongs to.
* @property null|\Stripe\StripeObject $balance The most recent information about the account's balance.
* @property null|\Stripe\StripeObject $balance_refresh The state of the most recent attempt to refresh the account balance.
* @property string $category The type of the account. Account category is further divided in <code>subcategory</code>.
* @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 <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @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.
* @property string $subcategory <p>If <code>category</code> is <code>cash</code>, one of:</p><p>- <code>checking</code> - <code>savings</code> - <code>other</code></p><p>If <code>category</code> is <code>credit</code>, one of:</p><p>- <code>mortgage</code> - <code>line_of_credit</code> - <code>credit_card</code> - <code>other</code></p><p>If <code>category</code> is <code>investment</code> or <code>other</code>, this will be <code>other</code>.</p>
* @property string[] $supported_payment_method_types The <a href="https://stripe.com/docs/api/payment_methods/object#payment_method_object-type">PaymentMethod type</a>(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;
}
}
20 changes: 20 additions & 0 deletions lib/FinancialConnections/AccountOwner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\FinancialConnections;

/**
* @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.
* @property null|string $phone The raw phone number of the owner.
* @property null|string $raw_address The raw physical address of the owner.
* @property null|int $refreshed_at The timestamp of the refresh that updated this owner.
*/
class AccountOwner extends \Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.account_owner';
}
18 changes: 18 additions & 0 deletions lib/FinancialConnections/AccountOwnership.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\FinancialConnections;

/**
* Describes a snapshot of the owners of an account at a particular point in time.
*
* @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 int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property \Stripe\Collection<\Stripe\FinancialConnections\AccountOwner> $owners A paginated list of owners for this account.
*/
class AccountOwnership extends \Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.account_ownership';
}
27 changes: 27 additions & 0 deletions lib/FinancialConnections/Session.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\FinancialConnections;

/**
* A Financial Connections Session is the secure way to programmatically launch the
* client-side Stripe.js modal that lets your users link their accounts.
*
* @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|\Stripe\StripeObject $account_holder The account holder for whom accounts are collected in this session.
* @property \Stripe\Collection<\Stripe\FinancialConnections\Account> $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 <code>true</code> if the object exists in live mode or the value <code>false</code> 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;
}
2 changes: 2 additions & 0 deletions lib/Service/CoreServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
58 changes: 58 additions & 0 deletions lib/Service/FinancialConnections/AccountService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\FinancialConnections;

class AccountService extends \Stripe\Service\AbstractService
{
/**
* Disables your access to a Financial Connections <code>Account</code>. 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 <code>Account</code>.
*
* @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 <code>Account</code>.
*
* @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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\FinancialConnections;

/**
* Service factory class for API resources in the FinancialConnections namespace.
*
* @property AccountService $accounts
* @property SessionService $sessions
*/
class FinancialConnectionsServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'accounts' => AccountService::class,
'sessions' => SessionService::class,
];

protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}
41 changes: 41 additions & 0 deletions lib/Service/FinancialConnections/SessionService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\FinancialConnections;

class SessionService extends \Stripe\Service\AbstractService
{
/**
* To launch the Financial Connections authorization flow, create a
* <code>Session</code>. The session’s <code>client_secret</code> 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 <code>Session</code>.
*
* @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);
}
}
1 change: 1 addition & 0 deletions lib/StripeClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/Util/ObjectTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ 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\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,
\Stripe\Identity\VerificationSession::OBJECT_NAME => \Stripe\Identity\VerificationSession::class,
Expand Down

0 comments on commit e29cc51

Please sign in to comment.