Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1286

Merged
merged 5 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@
require __DIR__ . '/lib/Topup.php';
require __DIR__ . '/lib/Transfer.php';
require __DIR__ . '/lib/TransferReversal.php';
require __DIR__ . '/lib/Treasury/CreditReversal.php';
require __DIR__ . '/lib/Treasury/DebitReversal.php';
require __DIR__ . '/lib/Treasury/FinancialAccount.php';
require __DIR__ . '/lib/Treasury/FinancialAccountFeatures.php';
require __DIR__ . '/lib/Treasury/InboundTransfer.php';
require __DIR__ . '/lib/Treasury/OutboundPayment.php';
require __DIR__ . '/lib/Treasury/OutboundTransfer.php';
require __DIR__ . '/lib/Treasury/ReceivedCredit.php';
require __DIR__ . '/lib/Treasury/ReceivedDebit.php';
require __DIR__ . '/lib/Treasury/Transaction.php';
require __DIR__ . '/lib/Treasury/TransactionEntry.php';
require __DIR__ . '/lib/UsageRecord.php';
require __DIR__ . '/lib/UsageRecordSummary.php';
require __DIR__ . '/lib/WebhookEndpoint.php';
Expand Down Expand Up @@ -243,9 +254,24 @@
require __DIR__ . '/lib/Service/TestHelpers/RefundService.php';
require __DIR__ . '/lib/Service/TestHelpers/Terminal/ReaderService.php';
require __DIR__ . '/lib/Service/TestHelpers/TestClockService.php';
require __DIR__ . '/lib/Service/TestHelpers/Treasury/InboundTransferService.php';
require __DIR__ . '/lib/Service/TestHelpers/Treasury/OutboundPaymentService.php';
require __DIR__ . '/lib/Service/TestHelpers/Treasury/OutboundTransferService.php';
require __DIR__ . '/lib/Service/TestHelpers/Treasury/ReceivedCreditService.php';
require __DIR__ . '/lib/Service/TestHelpers/Treasury/ReceivedDebitService.php';
require __DIR__ . '/lib/Service/TokenService.php';
require __DIR__ . '/lib/Service/TopupService.php';
require __DIR__ . '/lib/Service/TransferService.php';
require __DIR__ . '/lib/Service/Treasury/CreditReversalService.php';
require __DIR__ . '/lib/Service/Treasury/DebitReversalService.php';
require __DIR__ . '/lib/Service/Treasury/FinancialAccountService.php';
require __DIR__ . '/lib/Service/Treasury/InboundTransferService.php';
require __DIR__ . '/lib/Service/Treasury/OutboundPaymentService.php';
require __DIR__ . '/lib/Service/Treasury/OutboundTransferService.php';
require __DIR__ . '/lib/Service/Treasury/ReceivedCreditService.php';
require __DIR__ . '/lib/Service/Treasury/ReceivedDebitService.php';
require __DIR__ . '/lib/Service/Treasury/TransactionService.php';
require __DIR__ . '/lib/Service/Treasury/TransactionEntryService.php';
require __DIR__ . '/lib/Service/WebhookEndpointService.php';

// Service factories
Expand All @@ -259,7 +285,10 @@
require __DIR__ . '/lib/Service/Reporting/ReportingServiceFactory.php';
require __DIR__ . '/lib/Service/Sigma/SigmaServiceFactory.php';
require __DIR__ . '/lib/Service/Terminal/TerminalServiceFactory.php';
require __DIR__ . '/lib/Service/TestHelpers/Terminal/TerminalServiceFactory.php';
require __DIR__ . '/lib/Service/TestHelpers/TestHelpersServiceFactory.php';
require __DIR__ . '/lib/Service/TestHelpers/Treasury/TreasuryServiceFactory.php';
require __DIR__ . '/lib/Service/Treasury/TreasuryServiceFactory.php';

// OAuth
require __DIR__ . '/lib/OAuth.php';
Expand Down
2 changes: 1 addition & 1 deletion lib/BillingPortal/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @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 $locale The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer’s <code>preferred_locales</code> or browser’s locale is used.
* @property null|string $on_behalf_of The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this <code>on_behalf_of</code> account appear in the portal. For more information, see the <a href="https://stripe.com/docs/connect/charges-transfers#on-behalf-of">docs</a>. Use the <a href="https://stripe.com/docs/api/accounts/object#account_object-settings-branding">Accounts API</a> to modify the <code>on_behalf_of</code> account's branding settings, which the portal displays.
* @property string $return_url The URL to redirect customers to when they click on the portal's link to return to your website.
* @property null|string $return_url The URL to redirect customers to when they click on the portal's link to return to your website.
* @property string $url The short-lived URL of the session that gives customers access to the customer portal.
*/
class Session extends \Stripe\ApiResource
Expand Down
21 changes: 20 additions & 1 deletion lib/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function deleteDiscount($params = null, $opts = null)
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Customer> list of PaymentMethods
* @return \Stripe\Collection<\Stripe\PaymentMethod> list of PaymentMethods
*/
public static function allPaymentMethods($id, $params = null, $opts = null)
{
Expand All @@ -102,6 +102,25 @@ public static function allPaymentMethods($id, $params = null, $opts = null)
return $obj;
}

/**
* @param string $payment_method
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Customer the retrieved customer
*/
public function retrievePaymentMethod($payment_method, $params = null, $opts = null)
{
$url = $this->instanceUrl() . '/payment_methods/' . $payment_method;
list($response, $opts) = $this->_request('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);

return $obj;
}

/**
* @param null|array $params
* @param null|array|string $opts
Expand Down
29 changes: 29 additions & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,33 @@ class Event extends ApiResource
const TRANSFER_PAID = 'transfer.paid';
const TRANSFER_REVERSED = 'transfer.reversed';
const TRANSFER_UPDATED = 'transfer.updated';
const TREASURY_CREDIT_REVERSAL_CREATED = 'treasury.credit_reversal.created';
const TREASURY_CREDIT_REVERSAL_POSTED = 'treasury.credit_reversal.posted';
const TREASURY_DEBIT_REVERSAL_COMPLETED = 'treasury.debit_reversal.completed';
const TREASURY_DEBIT_REVERSAL_CREATED = 'treasury.debit_reversal.created';
const TREASURY_DEBIT_REVERSAL_INITIAL_CREDIT_GRANTED = 'treasury.debit_reversal.initial_credit_granted';
const TREASURY_FINANCIAL_ACCOUNT_CLOSED = 'treasury.financial_account.closed';
const TREASURY_FINANCIAL_ACCOUNT_CREATED = 'treasury.financial_account.created';
const TREASURY_FINANCIAL_ACCOUNT_FEATURES_STATUS_UPDATED = 'treasury.financial_account.features_status_updated';
const TREASURY_INBOUND_TRANSFER_CANCELED = 'treasury.inbound_transfer.canceled';
const TREASURY_INBOUND_TRANSFER_CREATED = 'treasury.inbound_transfer.created';
const TREASURY_INBOUND_TRANSFER_FAILED = 'treasury.inbound_transfer.failed';
const TREASURY_INBOUND_TRANSFER_SUCCEEDED = 'treasury.inbound_transfer.succeeded';
const TREASURY_OUTBOUND_PAYMENT_CANCELED = 'treasury.outbound_payment.canceled';
const TREASURY_OUTBOUND_PAYMENT_CREATED = 'treasury.outbound_payment.created';
const TREASURY_OUTBOUND_PAYMENT_EXPECTED_ARRIVAL_DATE_UPDATED = 'treasury.outbound_payment.expected_arrival_date_updated';
const TREASURY_OUTBOUND_PAYMENT_FAILED = 'treasury.outbound_payment.failed';
const TREASURY_OUTBOUND_PAYMENT_POSTED = 'treasury.outbound_payment.posted';
const TREASURY_OUTBOUND_PAYMENT_RETURNED = 'treasury.outbound_payment.returned';
const TREASURY_OUTBOUND_TRANSFER_CANCELED = 'treasury.outbound_transfer.canceled';
const TREASURY_OUTBOUND_TRANSFER_CREATED = 'treasury.outbound_transfer.created';
const TREASURY_OUTBOUND_TRANSFER_EXPECTED_ARRIVAL_DATE_UPDATED = 'treasury.outbound_transfer.expected_arrival_date_updated';
const TREASURY_OUTBOUND_TRANSFER_FAILED = 'treasury.outbound_transfer.failed';
const TREASURY_OUTBOUND_TRANSFER_POSTED = 'treasury.outbound_transfer.posted';
const TREASURY_OUTBOUND_TRANSFER_RETURNED = 'treasury.outbound_transfer.returned';
const TREASURY_RECEIVED_CREDIT_CREATED = 'treasury.received_credit.created';
const TREASURY_RECEIVED_CREDIT_FAILED = 'treasury.received_credit.failed';
const TREASURY_RECEIVED_CREDIT_REVERSED = 'treasury.received_credit.reversed';
const TREASURY_RECEIVED_CREDIT_SUCCEEDED = 'treasury.received_credit.succeeded';
const TREASURY_RECEIVED_DEBIT_CREATED = 'treasury.received_debit.created';
}
20 changes: 20 additions & 0 deletions lib/FinancialConnections/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Account extends \Stripe\ApiResource
{
const OBJECT_NAME = 'financial_connections.account';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Retrieve;

const CATEGORY_CASH = 'cash';
Expand Down Expand Up @@ -65,6 +66,25 @@ public function disconnect($params = null, $opts = null)
return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
* @param mixed $id
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\AccountOwner> list of BankConnectionsResourceOwners
*/
public static function allOwners($id, $params = null, $opts = null)
{
$url = static::resourceUrl($id) . '/owners';
list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
$obj->setLastResponse($response);

return $obj;
}

/**
* @param null|array $params
* @param null|array|string $opts
Expand Down
1 change: 1 addition & 0 deletions lib/Issuing/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* @property \Stripe\StripeObject[] $request_history History of every time <code>pending_request</code> was approved/denied, either by you directly or by Stripe (e.g. based on your <code>spending_controls</code>). If the merchant changes the authorization by performing an <a href="https://stripe.com/docs/issuing/purchases/authorizations">incremental authorization</a>, you can look at this field to see the previous requests for the authorization.
* @property string $status The current status of the authorization in its lifecycle.
* @property \Stripe\Issuing\Transaction[] $transactions List of <a href="https://stripe.com/docs/api/issuing/transactions">transactions</a> associated with this authorization.
* @property null|\Stripe\StripeObject $treasury <a href="https://stripe.com/docs/api/treasury">Treasury</a> details related to this authorization if it was created on a <a href="https://stripe.com/docs/api/treasury/financial_accounts">FinancialAccount</a>.
* @property \Stripe\StripeObject $verification_data
* @property null|string $wallet The digital wallet used for this authorization. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
*/
Expand Down
1 change: 1 addition & 0 deletions lib/Issuing/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @property string $cvc The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with <a href="https://stripe.com/docs/api/expanding_objects">the <code>expand</code> parameter</a>. Additionally, it's only available via the <a href="https://stripe.com/docs/api/issuing/cards/retrieve">&quot;Retrieve a card&quot; endpoint</a>, not via &quot;List all cards&quot; or any other endpoint.
* @property int $exp_month The expiration month of the card.
* @property int $exp_year The expiration year of the card.
* @property null|string $financial_account The financial account this card is attached to.
* @property string $last4 The last 4 digits of the card number.
* @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 \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
Expand Down
1 change: 1 addition & 0 deletions lib/Issuing/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $status Current status of the dispute.
* @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed.
* @property null|\Stripe\StripeObject $treasury <a href="https://stripe.com/docs/api/treasury">Treasury</a> details related to this dispute if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts
*/
class Dispute extends \Stripe\ApiResource
{
Expand Down
1 change: 1 addition & 0 deletions lib/Issuing/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* @property \Stripe\StripeObject $merchant_data
* @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property null|\Stripe\StripeObject $purchase_details Additional purchase information that is optionally provided by the merchant.
* @property null|\Stripe\StripeObject $treasury <a href="https://stripe.com/docs/api/treasury">Treasury</a> details related to this transaction if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts
* @property string $type The nature of the transaction.
* @property null|string $wallet The digital wallet used for this transaction. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
*/
Expand Down
3 changes: 2 additions & 1 deletion lib/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the Order, if any.
* @property \Stripe\StripeObject $automatic_tax
* @property null|\Stripe\StripeObject $billing_details Customer billing details associated with the order.
* @property null|string $client_secret <p>The client secret of this Order. Used for client-side retrieval using a publishable key.</p><p>The client secret can be used to complete a payment for an Order from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.</p><p>Refer to our docs for <a href="https://stripe.com/docs/orders-beta/create-and-process">creating and processing an order</a> to learn about how client_secret should be handled.</p>
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|string|\Stripe\Customer $customer The customer which this orders belongs to.
Expand Down Expand Up @@ -73,7 +74,7 @@ public function cancel($params = null, $opts = null)
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Order> list of LineItems
* @return \Stripe\Collection<\Stripe\LineItem> list of LineItems
*/
public static function allLineItems($id, $params = null, $opts = null)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/PaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class PaymentLink extends ApiResource
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\PaymentLink> list of LineItems
* @return \Stripe\Collection<\Stripe\LineItem> list of LineItems
*/
public static function allLineItems($id, $params = null, $opts = null)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function finalizeQuote($params = null, $opts = null)
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Quote> list of LineItems
* @return \Stripe\Collection<\Stripe\LineItem> list of LineItems
*/
public static function allComputedUpfrontLineItems($id, $params = null, $opts = null)
{
Expand All @@ -157,7 +157,7 @@ public static function allComputedUpfrontLineItems($id, $params = null, $opts =
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Quote> list of LineItems
richardm-stripe marked this conversation as resolved.
Show resolved Hide resolved
* @return \Stripe\Collection<\Stripe\LineItem> list of LineItems
*/
public static function allLineItems($id, $params = null, $opts = null)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Service/CoreServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
* @property TokenService $tokens
* @property TopupService $topups
* @property TransferService $transfers
* @property Treasury\TreasuryServiceFactory $treasury
* @property WebhookEndpointService $webhookEndpoints
*/
class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
Expand Down Expand Up @@ -127,6 +128,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
'tokens' => TokenService::class,
'topups' => TopupService::class,
'transfers' => TransferService::class,
'treasury' => Treasury\TreasuryServiceFactory::class,
'webhookEndpoints' => WebhookEndpointService::class,
];

Expand Down
17 changes: 17 additions & 0 deletions lib/Service/CustomerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,23 @@ public function retrieveCashBalance($parentId, $params = null, $opts = null)
return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance', $parentId), $params, $opts);
}

/**
* Retrieves a PaymentMethod object.
*
* @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\Customer
*/
public function retrievePaymentMethod($parentId, $id, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/customers/%s/payment_methods/%s', $parentId, $id), $params, $opts);
}

/**
* Retrieve a specified source for a given customer.
*
Expand Down
31 changes: 31 additions & 0 deletions lib/Service/FinancialConnections/AccountService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,37 @@

class AccountService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of Financial Connections <code>Account</code> objects.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\FinancialConnections\Account>
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/financial_connections/accounts', $params, $opts);
}

/**
* Lists all owners for a given <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\Collection<\Stripe\FinancialConnections\Account>
*/
public function allOwners($id, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/financial_connections/accounts/%s/owners', $id), $params, $opts);
}

/**
* 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,
Expand Down
2 changes: 2 additions & 0 deletions lib/Service/TestHelpers/TestHelpersServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* @property RefundService $refunds
* @property Terminal\TerminalServiceFactory $terminal
* @property TestClockService $testClocks
* @property Treasury\TreasuryServiceFactory $treasury
*/
class TestHelpersServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
Expand All @@ -20,6 +21,7 @@ class TestHelpersServiceFactory extends \Stripe\Service\AbstractServiceFactory
'refunds' => RefundService::class,
'terminal' => Terminal\TerminalServiceFactory::class,
'testClocks' => TestClockService::class,
'treasury' => Treasury\TreasuryServiceFactory::class,
];

protected function getServiceClass($name)
Expand Down
Loading