Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
# Conflicts:
#	OPENAPI_VERSION
  • Loading branch information
pakrym-stripe committed Jun 6, 2022
2 parents 8988910 + d0f14ef commit c2959a0
Show file tree
Hide file tree
Showing 99 changed files with 12,322 additions and 1,328 deletions.
97 changes: 97 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,102 @@
# CHANGELOG

## 9.6.0 - 2022-06-01
* [#1439](https://github.com/stripe/stripe-node/pull/1439) API Updates
* Add support for `radar_options` on `ChargeCreateParams`, `Charge`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentMethodCreateParams`, `PaymentMethod`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_data`
* Add support for `account_holder_name`, `account_number`, `account_type`, `bank_code`, `bank_name`, `branch_code`, and `branch_name` on `FundingInstructions.bank_transfer.financial_addresses[].zengin` and `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].zengin`
* Add support for new values `en-AU` and `en-NZ` on enums `OrderCreateParams.payment.settings.payment_method_options.klarna.preferred_locale`, `OrderUpdateParams.payment.settings.payment_method_options.klarna.preferred_locale`, `PaymentIntentConfirmParams.payment_method_options.klarna.preferred_locale`, `PaymentIntentCreateParams.payment_method_options.klarna.preferred_locale`, and `PaymentIntentUpdateParams.payment_method_options.klarna.preferred_locale`
* Change type of `Order.payment.settings.payment_method_options.customer_balance.bank_transfer.type` and `PaymentIntent.payment_method_options.customer_balance.bank_transfer.type` from `enum` to `literal('jp_bank_transfer')`
* This is technically breaking in Typescript, but now accurately represents the behavior that was allowed by the server. We haven't historically treated breaking Typescript changes as requiring a major.
* Change `PaymentIntent.next_action.display_bank_transfer_instructions.hosted_instructions_url` to be required
* Add support for `network` on `SetupIntent.payment_method_options.card`
* Add support for new value `simulated_wisepos_e` on enums `Terminal.Reader.device_type` and `TerminalReaderListParams.device_type`


## 9.5.0 - 2022-05-26
* [#1434](https://github.com/stripe/stripe-node/pull/1434) API Updates
* Add support for `affirm_payments` and `link_payments` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities`
* Add support for `id_number_secondary` on `AccountCreateParams.individual`, `AccountUpdateParams.individual`, `PersonCreateParams`, `PersonUpdateParams`, `TokenCreateParams.account.individual`, and `TokenCreateParams.person`
* Add support for new value `affirm` on enum `CheckoutSessionCreateParams.payment_method_types[]`
* Add support for `hosted_instructions_url` on `PaymentIntent.next_action.display_bank_transfer_instructions`
* Add support for `id_number_secondary_provided` on `Person`
* Add support for `card_issuing` on `TreasuryFinancialAccountCreateParams.features`, `TreasuryFinancialAccountUpdateFeaturesParams`, and `TreasuryFinancialAccountUpdateParams.features`

* [#1432](https://github.com/stripe/stripe-node/pull/1432) docs: Update HttpClient documentation to remove experimental status.

## 9.4.0 - 2022-05-23
* [#1431](https://github.com/stripe/stripe-node/pull/1431) API Updates
* Add support for `treasury` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities`

## 9.3.0 - 2022-05-23
* [#1430](https://github.com/stripe/stripe-node/pull/1430) API Updates
* Add support for new resource `Apps.Secret`
* Add support for `affirm` on `Charge.payment_method_details`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodCreateParams`, `PaymentMethodUpdateParams`, `PaymentMethod`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_data`
* Add support for `link` on `Charge.payment_method_details`, `Mandate.payment_method_details`, `OrderCreateParams.payment.settings.payment_method_options`, `OrderUpdateParams.payment.settings.payment_method_options`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodCreateParams`, `PaymentMethodUpdateParams`, `PaymentMethod`, `SetupAttempt.payment_method_details`, `SetupIntent.payment_method_options`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentConfirmParams.payment_method_options`, `SetupIntentCreateParams.payment_method_data`, `SetupIntentCreateParams.payment_method_options`, `SetupIntentUpdateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_options`
* Add support for new values `affirm` and `link` on enums `CustomerListPaymentMethodsParams.type` and `PaymentMethodListParams.type`
* Add support for new value `link` on enums `Invoice.payment_settings.payment_method_types[]`, `InvoiceCreateParams.payment_settings.payment_method_types[]`, `InvoiceUpdateParams.payment_settings.payment_method_types[]`, `Subscription.payment_settings.payment_method_types[]`, `SubscriptionCreateParams.payment_settings.payment_method_types[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_types[]`
* Add support for new values `affirm` and `link` on enums `PaymentIntentConfirmParams.payment_method_data.type`, `PaymentIntentCreateParams.payment_method_data.type`, `PaymentIntentUpdateParams.payment_method_data.type`, `SetupIntentConfirmParams.payment_method_data.type`, `SetupIntentCreateParams.payment_method_data.type`, and `SetupIntentUpdateParams.payment_method_data.type`
* Add support for new values `affirm` and `link` on enum `PaymentMethodCreateParams.type`
* Add support for new values `affirm` and `link` on enum `PaymentMethod.type`

## 9.2.0 - 2022-05-19
* [#1422](https://github.com/stripe/stripe-node/pull/1422) API Updates
* Add support for new `Treasury` APIs: `CreditReversal`, `DebitReversal`, `FinancialAccountFeatures`, `FinancialAccount`, `FlowDetails`, `InboundTransfer`, `OutboundPayment`, `OutboundTransfer`, `ReceivedCredit`, `ReceivedDebit`, `TransactionEntry`, and `Transaction`
* Add support for `treasury` on `Issuing.Authorization`, `Issuing.Dispute`, `Issuing.Transaction`, and `IssuingDisputeCreateParams`
* Add support for `retrieve_payment_method` method on resource `Customer`
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
* Change `BillingPortalConfigurationCreateParams.features.customer_update.allowed_updates` to be optional
* Change type of `BillingPortal.Session.return_url` from `string` to `nullable(string)`
* Add support for `afterpay_clearpay`, `au_becs_debit`, `bacs_debit`, `eps`, `fpx`, `giropay`, `grabpay`, `klarna`, `paynow`, and `sepa_debit` on `Checkout.Session.payment_method_options`
* Add support for `financial_account` on `Issuing.Card` and `IssuingCardCreateParams`
* Add support for `client_secret` on `Order`
* Add support for `networks` on `PaymentIntentConfirmParams.payment_method_options.us_bank_account`, `PaymentIntentCreateParams.payment_method_options.us_bank_account`, `PaymentIntentUpdateParams.payment_method_options.us_bank_account`, `PaymentMethod.us_bank_account`, `SetupIntentConfirmParams.payment_method_options.us_bank_account`, `SetupIntentCreateParams.payment_method_options.us_bank_account`, and `SetupIntentUpdateParams.payment_method_options.us_bank_account`
* Add support for `attach_to_self` and `flow_directions` on `SetupIntent`
* Add support for `save_default_payment_method` on `Subscription.payment_settings`, `SubscriptionCreateParams.payment_settings`, and `SubscriptionUpdateParams.payment_settings`
* Add support for `czk` on `Terminal.Configuration.tipping`, `TerminalConfigurationCreateParams.tipping`, and `TerminalConfigurationUpdateParams.tipping`

## 9.1.0 - 2022-05-11
* [#1420](https://github.com/stripe/stripe-node/pull/1420) API Updates
* Add support for `description` on `CheckoutSessionCreateParams.subscription_data`, `SubscriptionCreateParams`, `SubscriptionUpdateParams`, and `Subscription`
* Add support for `consent_collection`, `payment_intent_data`, `shipping_options`, `submit_type`, and `tax_id_collection` on `PaymentLinkCreateParams` and `PaymentLink`
* Add support for `customer_creation` on `PaymentLinkCreateParams`, `PaymentLinkUpdateParams`, and `PaymentLink`
* Add support for `metadata` on `SubscriptionSchedule.phases[]`, `SubscriptionScheduleCreateParams.phases[]`, and `SubscriptionScheduleUpdateParams.phases[]`
* Add support for new value `billing_portal.session.created` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]`

## 9.0.0 - 2022-05-09
Major version release - The [migration guide](https://github.com/stripe/stripe-node/wiki/Migration-Guide-for-v9) contains a detailed list of backwards-incompatible changes with upgrade instructions.
(⚠️ = breaking changes):
* ⚠️[#1336](https://github.com/stripe/stripe-node/pull/1336) feat(http-client): retry closed connection errors
* [#1415](https://github.com/stripe/stripe-node/pull/1415) [#1417](https://github.com/stripe/stripe-node/pull/1417) API Updates
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
* Resource modified: `Order`.
* New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
* Removed methods: `pay` and `return_order`
* Removed resources: `OrderItem` and `OrderReturn`
* Removed references from other resources: `Charge.order`
* Add support for `amount_discount`, `amount_tax`, and `product` on `LineItem`
* Change type of `Charge.shipping.name`, `Checkout.Session.shipping.name`, `Customer.shipping.name`, `Invoice.customer_shipping.name`, `PaymentIntent.shipping.name`, `ShippingDetails.name`, and `Source.source_order.shipping.name` from `nullable(string)` to `string`

## 8.222.0 - 2022-05-05
* [#1414](https://github.com/stripe/stripe-node/pull/1414) API Updates
* Add support for `default_price_data` on `ProductCreateParams`
* Add support for `default_price` on `ProductUpdateParams` and `Product`
* Add support for `instructions_email` on `RefundCreateParams` and `Refund`


## 8.221.0 - 2022-05-05
* [#1413](https://github.com/stripe/stripe-node/pull/1413) API Updates
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
* Add support for `financial_connections` on `Checkout.Session.payment_method_options.us_bank_account`, `CheckoutSessionCreateParams.payment_method_options.us_bank_account`, `Invoice.payment_settings.payment_method_options.us_bank_account`, `InvoiceCreateParams.payment_settings.payment_method_options.us_bank_account`, `InvoiceUpdateParams.payment_settings.payment_method_options.us_bank_account`, `PaymentIntent.payment_method_options.us_bank_account`, `PaymentIntentConfirmParams.payment_method_options.us_bank_account`, `PaymentIntentCreateParams.payment_method_options.us_bank_account`, `PaymentIntentUpdateParams.payment_method_options.us_bank_account`, `SetupIntent.payment_method_options.us_bank_account`, `SetupIntentConfirmParams.payment_method_options.us_bank_account`, `SetupIntentCreateParams.payment_method_options.us_bank_account`, `SetupIntentUpdateParams.payment_method_options.us_bank_account`, `Subscription.payment_settings.payment_method_options.us_bank_account`, `SubscriptionCreateParams.payment_settings.payment_method_options.us_bank_account`, and `SubscriptionUpdateParams.payment_settings.payment_method_options.us_bank_account`
* Add support for `financial_connections_account` on `PaymentIntentConfirmParams.payment_method_data.us_bank_account`, `PaymentIntentCreateParams.payment_method_data.us_bank_account`, `PaymentIntentUpdateParams.payment_method_data.us_bank_account`, `PaymentMethod.us_bank_account`, `PaymentMethodCreateParams.us_bank_account`, `SetupIntentConfirmParams.payment_method_data.us_bank_account`, `SetupIntentCreateParams.payment_method_data.us_bank_account`, and `SetupIntentUpdateParams.payment_method_data.us_bank_account`

* [#1410](https://github.com/stripe/stripe-node/pull/1410) API Updates
* Add support for `registered_address` on `AccountCreateParams.individual`, `AccountUpdateParams.individual`, `PersonCreateParams`, `PersonUpdateParams`, `Person`, `TokenCreateParams.account.individual`, and `TokenCreateParams.person`
* Change type of `PaymentIntent.amount_details.tip.amount` from `nullable(integer)` to `integer`
* Change `PaymentIntent.amount_details.tip.amount` to be optional
* Add support for `payment_method_data` on `SetupIntentConfirmParams`, `SetupIntentCreateParams`, and `SetupIntentUpdateParams`
* [#1409](https://github.com/stripe/stripe-node/pull/1409) Update autoPagination tests to be hermetic.
* [#1411](https://github.com/stripe/stripe-node/pull/1411) Enable CI on beta branch

## 8.220.0 - 2022-05-03
* [#1407](https://github.com/stripe/stripe-node/pull/1407) API Updates
* Add support for new resource `CashBalance`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Stripe Node.js Library

[![Version](https://img.shields.io/npm/v/stripe.svg)](https://www.npmjs.org/package/stripe)
[![Build Status](https://travis-ci.org/stripe/stripe-node.svg?branch=master)](https://travis-ci.org/stripe/stripe-node)
[![Build Status](https://github.com/stripe/stripe-node/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-node/actions?query=branch%3Amaster)
[![Downloads](https://img.shields.io/npm/dm/stripe.svg)](https://www.npmjs.com/package/stripe)
[![Try on RunKit](https://badge.runkitcdn.com/stripe.svg)](https://runkit.com/npm/stripe)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.220.0
9.6.0
12 changes: 10 additions & 2 deletions lib/StripeResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,15 @@ StripeResource.prototype = {
},

// For more on when and how to retry API requests, see https://stripe.com/docs/error-handling#safely-retrying-requests-with-idempotency
_shouldRetry(res, numRetries, maxRetries) {
_shouldRetry(res, numRetries, maxRetries, error) {
if (
error &&
numRetries === 0 &&
HttpClient.CONNECTION_CLOSED_ERROR_CODES.includes(error.code)
) {
return true;
}

// Do not retry if we are out of retries.
if (numRetries >= maxRetries) {
return false;
Expand Down Expand Up @@ -529,7 +537,7 @@ StripeResource.prototype = {
}
})
.catch((error) => {
if (this._shouldRetry(null, requestRetries, maxRetries)) {
if (this._shouldRetry(null, requestRetries, maxRetries, error)) {
return retryRequest(
makeRequest,
apiVersion,
Expand Down
10 changes: 8 additions & 2 deletions lib/net/HttpClient.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
'use strict';

/**
* Encapsulates the logic for issuing a request to the Stripe API. This is an
* experimental interface and is not yet stable.
* Encapsulates the logic for issuing a request to the Stripe API.
*
* A custom HTTP client should should implement:
* 1. A response class which extends HttpClientResponse and wraps around their
* own internal representation of a response.
* 2. A client class which extends HttpClient and implements all methods,
* returning their own response class when making requests.
*/
class HttpClient {
/** The client name used for diagnostics. */
Expand Down Expand Up @@ -31,6 +36,7 @@ class HttpClient {
}
}

HttpClient.CONNECTION_CLOSED_ERROR_CODES = ['ECONNRESET', 'EPIPE'];
HttpClient.TIMEOUT_ERROR_CODE = 'ETIMEDOUT';

class HttpClientResponse {
Expand Down
27 changes: 26 additions & 1 deletion lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = {
Mandates: require('./resources/Mandates'),
OAuth: require('./resources/OAuth'),
Orders: require('./resources/Orders'),
OrderReturns: require('./resources/OrderReturns'),
PaymentIntents: require('./resources/PaymentIntents'),
PaymentLinks: require('./resources/PaymentLinks'),
PaymentMethods: require('./resources/PaymentMethods'),
Expand All @@ -56,13 +55,20 @@ module.exports = {
Topups: require('./resources/Topups'),
Transfers: require('./resources/Transfers'),
WebhookEndpoints: require('./resources/WebhookEndpoints'),
Apps: resourceNamespace('apps', {
Secrets: require('./resources/Apps/Secrets'),
}),
BillingPortal: resourceNamespace('billingPortal', {
Configurations: require('./resources/BillingPortal/Configurations'),
Sessions: require('./resources/BillingPortal/Sessions'),
}),
Checkout: resourceNamespace('checkout', {
Sessions: require('./resources/Checkout/Sessions'),
}),
FinancialConnections: resourceNamespace('financialConnections', {
Accounts: require('./resources/FinancialConnections/Accounts'),
Sessions: require('./resources/FinancialConnections/Sessions'),
}),
Identity: resourceNamespace('identity', {
VerificationReports: require('./resources/Identity/VerificationReports'),
VerificationSessions: require('./resources/Identity/VerificationSessions'),
Expand Down Expand Up @@ -98,5 +104,24 @@ module.exports = {
Terminal: resourceNamespace('terminal', {
Readers: require('./resources/TestHelpers/Terminal/Readers'),
}),
Treasury: resourceNamespace('treasury', {
InboundTransfers: require('./resources/TestHelpers/Treasury/InboundTransfers'),
OutboundPayments: require('./resources/TestHelpers/Treasury/OutboundPayments'),
OutboundTransfers: require('./resources/TestHelpers/Treasury/OutboundTransfers'),
ReceivedCredits: require('./resources/TestHelpers/Treasury/ReceivedCredits'),
ReceivedDebits: require('./resources/TestHelpers/Treasury/ReceivedDebits'),
}),
}),
Treasury: resourceNamespace('treasury', {
CreditReversals: require('./resources/Treasury/CreditReversals'),
DebitReversals: require('./resources/Treasury/DebitReversals'),
FinancialAccounts: require('./resources/Treasury/FinancialAccounts'),
InboundTransfers: require('./resources/Treasury/InboundTransfers'),
OutboundPayments: require('./resources/Treasury/OutboundPayments'),
OutboundTransfers: require('./resources/Treasury/OutboundTransfers'),
ReceivedCredits: require('./resources/Treasury/ReceivedCredits'),
ReceivedDebits: require('./resources/Treasury/ReceivedDebits'),
Transactions: require('./resources/Treasury/Transactions'),
TransactionEntries: require('./resources/Treasury/TransactionEntries'),
}),
};
31 changes: 31 additions & 0 deletions lib/resources/Apps/Secrets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// File generated from our OpenAPI spec

'use strict';

const StripeResource = require('../../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'apps/secrets',

create: stripeMethod({
method: 'POST',
path: '',
}),

list: stripeMethod({
method: 'GET',
path: '',
methodType: 'list',
}),

deleteWhere: stripeMethod({
method: 'POST',
path: '/delete',
}),

find: stripeMethod({
method: 'GET',
path: '/find',
}),
});
5 changes: 5 additions & 0 deletions lib/resources/Customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ module.exports = StripeResource.extend({
methodType: 'list',
}),

retrievePaymentMethod: stripeMethod({
method: 'GET',
path: '/{customer}/payment_methods/{paymentMethod}',
}),

search: stripeMethod({
method: 'GET',
path: '/search',
Expand Down
Loading

0 comments on commit c2959a0

Please sign in to comment.