Skip to content

Commit 3eb9d98

Browse files
pakrym-stripedcr-striperichardm-stripebpintokamil-stripe
authored
Merge master branch into beta branch (#1444)
* API Updates (#1413) * Bump version to 8.221.0 * API Updates (#1414) * Bump version to 8.222.0 * API Updates (#1415) * feat(http-client): retry closed connection errors (#1336) * feat(http-client): Retry requests that failed with closed connection Requests that fail with closed connection errors (ECONNRESET, EPIPE) are automatically retried. - `ECONNRESET` (Connection reset by peer): A connection was forcibly closed by a peer.closed by a peer. This normally results from a loss of the connection on the remote socket due to a timeout or reboot. Commonly encountered via the http and net modules. - `EPIPE` (Broken pipe): A write on a pipe, socket, or FIFO for which there is no process to read the data. Commonly encountered at the net and http layers, indicative that the remote side of the stream being written to has been closed. Fixes: #1040 * Remove deprecated orders-related events (#1417) * Bump version to 9.0.0 * API Updates (#1420) * Codegen for openapi 7789931 * Bump version to 9.1.0 * API Updates (#1422) * Codegen for openapi 056745c Co-authored-by: Richard Marmorstein <[email protected]> Co-authored-by: Dominic Charley-Roy <[email protected]> * Bump version to 9.2.0 * Codegen for openapi v146 (#1430) * Bump version to 9.3.0 * Codegen for openapi v147 (#1431) * Bump version to 9.4.0 * docs: Update HttpClient documentation to remove experimental status. (#1432) * Codegen for openapi v149 (#1434) * Bump version to 9.5.0 * API Updates (#1439) * Bump version to 9.6.0 * Update README.md (#1440) * Codegen for openapi v152 (#1441) * Add test for cash balance methods. (#1438) * Bump version to 9.7.0 Co-authored-by: Dominic Charley-Roy <[email protected]> Co-authored-by: Dominic Charley-Roy <[email protected]> Co-authored-by: Richard Marmorstein <[email protected]> Co-authored-by: Bruno Pinto <[email protected]> Co-authored-by: Richard Marmorstein <[email protected]> Co-authored-by: Kamil Pajdzik <[email protected]>
1 parent 9584cfa commit 3eb9d98

File tree

99 files changed

+13011
-1370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+13011
-1370
lines changed

CHANGELOG.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,111 @@
11
# CHANGELOG
22

3+
## 9.7.0 - 2022-06-08
4+
* [#1441](https://github.com/stripe/stripe-node/pull/1441) API Updates
5+
* Add support for `affirm`, `bancontact`, `card`, `ideal`, `p24`, and `sofort` on `Checkout.Session.payment_method_options` and `CheckoutSessionCreateParams.payment_method_options`
6+
* Add support for `afterpay_clearpay`, `au_becs_debit`, `bacs_debit`, `eps`, `fpx`, `giropay`, `grabpay`, `klarna`, `paynow`, and `sepa_debit` on `CheckoutSessionCreateParams.payment_method_options`
7+
* Add support for `setup_future_usage` on `Checkout.Session.payment_method_options.*` and `CheckoutSessionCreateParams.payment_method_options.*`,
8+
* Change `PaymentMethod.us_bank_account.networks` and `SetupIntent.flow_directions` to be required
9+
* Add support for `attach_to_self` on `SetupAttempt`, `SetupIntentCreateParams`, `SetupIntentListParams`, and `SetupIntentUpdateParams`
10+
* Add support for `flow_directions` on `SetupAttempt`, `SetupIntentCreateParams`, and `SetupIntentUpdateParams`
11+
12+
## 9.6.0 - 2022-06-01
13+
* [#1439](https://github.com/stripe/stripe-node/pull/1439) API Updates
14+
* 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`
15+
* 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`
16+
* 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`
17+
* 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')`
18+
* 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.
19+
* Change `PaymentIntent.next_action.display_bank_transfer_instructions.hosted_instructions_url` to be required
20+
* Add support for `network` on `SetupIntent.payment_method_options.card`
21+
* Add support for new value `simulated_wisepos_e` on enums `Terminal.Reader.device_type` and `TerminalReaderListParams.device_type`
22+
23+
24+
## 9.5.0 - 2022-05-26
25+
* [#1434](https://github.com/stripe/stripe-node/pull/1434) API Updates
26+
* Add support for `affirm_payments` and `link_payments` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities`
27+
* Add support for `id_number_secondary` on `AccountCreateParams.individual`, `AccountUpdateParams.individual`, `PersonCreateParams`, `PersonUpdateParams`, `TokenCreateParams.account.individual`, and `TokenCreateParams.person`
28+
* Add support for new value `affirm` on enum `CheckoutSessionCreateParams.payment_method_types[]`
29+
* Add support for `hosted_instructions_url` on `PaymentIntent.next_action.display_bank_transfer_instructions`
30+
* Add support for `id_number_secondary_provided` on `Person`
31+
* Add support for `card_issuing` on `TreasuryFinancialAccountCreateParams.features`, `TreasuryFinancialAccountUpdateFeaturesParams`, and `TreasuryFinancialAccountUpdateParams.features`
32+
33+
* [#1432](https://github.com/stripe/stripe-node/pull/1432) docs: Update HttpClient documentation to remove experimental status.
34+
35+
## 9.4.0 - 2022-05-23
36+
* [#1431](https://github.com/stripe/stripe-node/pull/1431) API Updates
37+
* Add support for `treasury` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities`
38+
39+
## 9.3.0 - 2022-05-23
40+
* [#1430](https://github.com/stripe/stripe-node/pull/1430) API Updates
41+
* Add support for new resource `Apps.Secret`
42+
* 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`
43+
* 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`
44+
* Add support for new values `affirm` and `link` on enums `CustomerListPaymentMethodsParams.type` and `PaymentMethodListParams.type`
45+
* 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[]`
46+
* 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`
47+
* Add support for new values `affirm` and `link` on enum `PaymentMethodCreateParams.type`
48+
* Add support for new values `affirm` and `link` on enum `PaymentMethod.type`
49+
50+
## 9.2.0 - 2022-05-19
51+
* [#1422](https://github.com/stripe/stripe-node/pull/1422) API Updates
52+
* Add support for new `Treasury` APIs: `CreditReversal`, `DebitReversal`, `FinancialAccountFeatures`, `FinancialAccount`, `FlowDetails`, `InboundTransfer`, `OutboundPayment`, `OutboundTransfer`, `ReceivedCredit`, `ReceivedDebit`, `TransactionEntry`, and `Transaction`
53+
* Add support for `treasury` on `Issuing.Authorization`, `Issuing.Dispute`, `Issuing.Transaction`, and `IssuingDisputeCreateParams`
54+
* Add support for `retrieve_payment_method` method on resource `Customer`
55+
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
56+
* Change `BillingPortalConfigurationCreateParams.features.customer_update.allowed_updates` to be optional
57+
* Change type of `BillingPortal.Session.return_url` from `string` to `nullable(string)`
58+
* 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`
59+
* Add support for `financial_account` on `Issuing.Card` and `IssuingCardCreateParams`
60+
* Add support for `client_secret` on `Order`
61+
* 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`
62+
* Add support for `attach_to_self` and `flow_directions` on `SetupIntent`
63+
* Add support for `save_default_payment_method` on `Subscription.payment_settings`, `SubscriptionCreateParams.payment_settings`, and `SubscriptionUpdateParams.payment_settings`
64+
* Add support for `czk` on `Terminal.Configuration.tipping`, `TerminalConfigurationCreateParams.tipping`, and `TerminalConfigurationUpdateParams.tipping`
65+
66+
## 9.1.0 - 2022-05-11
67+
* [#1420](https://github.com/stripe/stripe-node/pull/1420) API Updates
68+
* Add support for `description` on `CheckoutSessionCreateParams.subscription_data`, `SubscriptionCreateParams`, `SubscriptionUpdateParams`, and `Subscription`
69+
* Add support for `consent_collection`, `payment_intent_data`, `shipping_options`, `submit_type`, and `tax_id_collection` on `PaymentLinkCreateParams` and `PaymentLink`
70+
* Add support for `customer_creation` on `PaymentLinkCreateParams`, `PaymentLinkUpdateParams`, and `PaymentLink`
71+
* Add support for `metadata` on `SubscriptionSchedule.phases[]`, `SubscriptionScheduleCreateParams.phases[]`, and `SubscriptionScheduleUpdateParams.phases[]`
72+
* Add support for new value `billing_portal.session.created` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]`
73+
74+
## 9.0.0 - 2022-05-09
75+
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.
76+
(⚠️ = breaking changes):
77+
* ⚠️[#1336](https://github.com/stripe/stripe-node/pull/1336) feat(http-client): retry closed connection errors
78+
* [#1415](https://github.com/stripe/stripe-node/pull/1415) [#1417](https://github.com/stripe/stripe-node/pull/1417) API Updates
79+
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
80+
* Resource modified: `Order`.
81+
* New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
82+
* Removed methods: `pay` and `return_order`
83+
* Removed resources: `OrderItem` and `OrderReturn`
84+
* Removed references from other resources: `Charge.order`
85+
* Add support for `amount_discount`, `amount_tax`, and `product` on `LineItem`
86+
* 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`
87+
88+
## 8.222.0 - 2022-05-05
89+
* [#1414](https://github.com/stripe/stripe-node/pull/1414) API Updates
90+
* Add support for `default_price_data` on `ProductCreateParams`
91+
* Add support for `default_price` on `ProductUpdateParams` and `Product`
92+
* Add support for `instructions_email` on `RefundCreateParams` and `Refund`
93+
94+
95+
## 8.221.0 - 2022-05-05
96+
* [#1413](https://github.com/stripe/stripe-node/pull/1413) API Updates
97+
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
98+
* 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`
99+
* 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`
100+
101+
* [#1410](https://github.com/stripe/stripe-node/pull/1410) API Updates
102+
* Add support for `registered_address` on `AccountCreateParams.individual`, `AccountUpdateParams.individual`, `PersonCreateParams`, `PersonUpdateParams`, `Person`, `TokenCreateParams.account.individual`, and `TokenCreateParams.person`
103+
* Change type of `PaymentIntent.amount_details.tip.amount` from `nullable(integer)` to `integer`
104+
* Change `PaymentIntent.amount_details.tip.amount` to be optional
105+
* Add support for `payment_method_data` on `SetupIntentConfirmParams`, `SetupIntentCreateParams`, and `SetupIntentUpdateParams`
106+
* [#1409](https://github.com/stripe/stripe-node/pull/1409) Update autoPagination tests to be hermetic.
107+
* [#1411](https://github.com/stripe/stripe-node/pull/1411) Enable CI on beta branch
108+
3109
## 8.220.0 - 2022-05-03
4110
* [#1407](https://github.com/stripe/stripe-node/pull/1407) API Updates
5111
* Add support for new resource `CashBalance`
@@ -49,7 +155,7 @@
49155
* Add support for new value `customer_balance` 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[]`
50156
* Add support for `request_extended_authorization` on `PaymentIntent.payment_method_options.card_present`, `PaymentIntentConfirmParams.payment_method_options.card_present`, `PaymentIntentCreateParams.payment_method_options.card_present`, and `PaymentIntentUpdateParams.payment_method_options.card_present`
51157
* Add support for new values `payment_intent.partially_funded`, `terminal.reader.action_failed`, and `terminal.reader.action_succeeded` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]`
52-
158+
53159
* [#1388](https://github.com/stripe/stripe-node/pull/1388) Stop sending Content-Length header for verbs which don't have bodies.
54160
* Fixes https://github.com/stripe/stripe-node/issues/1360.
55161

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Stripe Node.js Library
22

33
[![Version](https://img.shields.io/npm/v/stripe.svg)](https://www.npmjs.org/package/stripe)
4-
[![Build Status](https://travis-ci.org/stripe/stripe-node.svg?branch=master)](https://travis-ci.org/stripe/stripe-node)
4+
[![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)
55
[![Downloads](https://img.shields.io/npm/dm/stripe.svg)](https://www.npmjs.com/package/stripe)
66
[![Try on RunKit](https://badge.runkitcdn.com/stripe.svg)](https://runkit.com/npm/stripe)
77

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.220.0
1+
9.7.0

lib/StripeResource.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,15 @@ StripeResource.prototype = {
273273
},
274274

275275
// For more on when and how to retry API requests, see https://stripe.com/docs/error-handling#safely-retrying-requests-with-idempotency
276-
_shouldRetry(res, numRetries, maxRetries) {
276+
_shouldRetry(res, numRetries, maxRetries, error) {
277+
if (
278+
error &&
279+
numRetries === 0 &&
280+
HttpClient.CONNECTION_CLOSED_ERROR_CODES.includes(error.code)
281+
) {
282+
return true;
283+
}
284+
277285
// Do not retry if we are out of retries.
278286
if (numRetries >= maxRetries) {
279287
return false;
@@ -529,7 +537,7 @@ StripeResource.prototype = {
529537
}
530538
})
531539
.catch((error) => {
532-
if (this._shouldRetry(null, requestRetries, maxRetries)) {
540+
if (this._shouldRetry(null, requestRetries, maxRetries, error)) {
533541
return retryRequest(
534542
makeRequest,
535543
apiVersion,

lib/net/HttpClient.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
'use strict';
22

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

39+
HttpClient.CONNECTION_CLOSED_ERROR_CODES = ['ECONNRESET', 'EPIPE'];
3440
HttpClient.TIMEOUT_ERROR_CODE = 'ETIMEDOUT';
3541

3642
class HttpClientResponse {

0 commit comments

Comments
 (0)