stripe 10.3.0 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 10.5.0 - 2022-08-24
4
+ * [#1527](https://github.com/stripe/stripe-node/pull/1527) fix: Update FetchHttpClient to send empty string for empty POST/PUT/PATCH requests.
5
+ * [#1528](https://github.com/stripe/stripe-node/pull/1528) Update README.md to use a new NOTE notation
6
+ * [#1526](https://github.com/stripe/stripe-node/pull/1526) Add test coverage using Coveralls
7
+
8
+ ## 10.4.0 - 2022-08-23
9
+ * [#1520](https://github.com/stripe/stripe-node/pull/1520) Add beta readme.md section
10
+ * [#1524](https://github.com/stripe/stripe-node/pull/1524) API Updates
11
+ * Change `Terminal.Reader.action` to be required
12
+ * Change `TreasuryOutboundTransferCreateParams.destination_payment_method` to be optional
13
+ * Change type of `Treasury.OutboundTransfer.destination_payment_method` from `string` to `string | null`
14
+ * Change the return type of `Customer.fundCashBalance` test helper from `CustomerBalanceTransaction` to `CustomerCashBalanceTransaction`.
15
+ * This would generally be considered a breaking change, but we've worked with all existing users to migrate and are comfortable releasing this as a minor as it is solely a test helper method. This was essentially broken prior to this change.
16
+
17
+
3
18
  ## 10.3.0 - 2022-08-19
4
19
  * [#1516](https://github.com/stripe/stripe-node/pull/1516) API Updates
5
20
  * Add support for new resource `CustomerCashBalanceTransaction`
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Version](https://img.shields.io/npm/v/stripe.svg)](https://www.npmjs.org/package/stripe)
4
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)
5
+ [![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-node/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-node?branch=master)
5
6
  [![Downloads](https://img.shields.io/npm/dm/stripe.svg)](https://www.npmjs.com/package/stripe)
6
7
  [![Try on RunKit](https://badge.runkitcdn.com/stripe.svg)](https://runkit.com/npm/stripe)
7
8
 
@@ -10,10 +11,6 @@ applications written in server-side JavaScript.
10
11
 
11
12
  For collecting customer and payment information in the browser, use [Stripe.js][stripe-js].
12
13
 
13
- ## Support
14
-
15
- New features and bug fixes are released on the latest major version of the `stripe` package. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
16
-
17
14
  ## Documentation
18
15
 
19
16
  See the [`stripe-node` API docs](https://stripe.com/docs/api?lang=node) for Node.js.
@@ -34,20 +31,6 @@ npm install stripe --save
34
31
  yarn add stripe
35
32
  ```
36
33
 
37
- ### Beta version
38
-
39
- Stripe has features in the beta phase that can be accessed via the beta version of this package.
40
- We would love for you to try these and share feedback with us before these features reach the stable phase.
41
- The beta versions can be installed in one of two ways
42
- - To install the latest beta version, run the command `npm install stripe@beta --save`
43
- - To install a specific beta version, replace the term "beta" in the above command with the version number like `npm install stripe@1.2.3-beta.1 --save`
44
-
45
- > Note: There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific beta version in your package.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version.
46
-
47
- We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
48
-
49
- The versions tab on the [stripe page on npm](https://www.npmjs.com/package/stripe) lists the current tags in use. The `beta` tag here corresponds to the the latest beta version of the package.
50
-
51
34
  ## Usage
52
35
 
53
36
  The package needs to be configured with your account's secret key, which is
@@ -204,7 +187,8 @@ const stripe = Stripe('sk_test_...', {
204
187
  | `protocol` | `'https'` | `'https'` or `'http'`. `http` is never appropriate for sending requests to Stripe servers, and we strongly discourage `http`, even in local testing scenarios, as this can result in your credentials being transmitted over an insecure channel. |
205
188
  | `telemetry` | `true` | Allow Stripe to send latency [telemetry](#request-latency-telemetry). |
206
189
 
207
- Note: Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis.
190
+ > **Note**
191
+ > Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis.
208
192
 
209
193
  ### Configuring Timeout
210
194
 
@@ -490,6 +474,33 @@ const stripe = new Stripe('sk_test_...', {
490
474
  });
491
475
  ```
492
476
 
477
+ ### Beta SDKs
478
+
479
+ Stripe has features in the beta phase that can be accessed via the beta version of this package.
480
+ We would love for you to try these and share feedback with us before these features reach the stable phase.
481
+ The beta versions can be installed in one of two ways
482
+ - To install the latest beta version, run the command `npm install stripe@beta --save`
483
+ - To install a specific beta version, replace the term "beta" in the above command with the version number like `npm install stripe@1.2.3-beta.1 --save`
484
+
485
+ > **Note**
486
+ > There can be breaking changes between beta versions. Therefore we recommend pinning the package version to a specific beta version in your package.json file. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest beta version.
487
+
488
+ We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
489
+
490
+ The versions tab on the [stripe page on npm](https://www.npmjs.com/package/stripe) lists the current tags in use. The `beta` tag here corresponds to the the latest beta version of the package.
491
+
492
+ If your beta feature requires a `Stripe-Version` header to be sent, use the `apiVersion` property of `config` object to set it:
493
+
494
+ ```js
495
+ const stripe = new Stripe('sk_test_...', {
496
+ apiVersion: '2022-08-01; feature_beta=v3',
497
+ });
498
+ ```
499
+
500
+ ## Support
501
+
502
+ New features and bug fixes are released on the latest major version of the `stripe` package. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
503
+
493
504
  ## More Information
494
505
 
495
506
  - [REST API Version](https://github.com/stripe/stripe-node/wiki/REST-API-Version)
package/VERSION CHANGED
@@ -1 +1 @@
1
- 10.3.0
1
+ 10.5.0
@@ -39,11 +39,19 @@ class FetchHttpClient extends HttpClient {
39
39
  );
40
40
  url.port = port;
41
41
 
42
+ // For methods which expect payloads, we should always pass a body value
43
+ // even when it is empty. Without this, some JS runtimes (eg. Deno) will
44
+ // inject a second Content-Length header. See https://github.com/stripe/stripe-node/issues/1519
45
+ // for more details.
46
+ const methodHasPayload =
47
+ method == 'POST' || method == 'PUT' || method == 'PATCH';
48
+ const body = requestData || (methodHasPayload ? '' : undefined);
49
+
42
50
  const fetchFn = this._fetchFn || fetch;
43
51
  const fetchPromise = fetchFn(url.toString(), {
44
52
  method,
45
53
  headers,
46
- body: requestData || undefined,
54
+ body,
47
55
  });
48
56
 
49
57
  // The Fetch API does not support passing in a timeout natively, so a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "10.3.0",
3
+ "version": "10.5.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -31,6 +31,7 @@
31
31
  "@typescript-eslint/parser": "^2.13.0",
32
32
  "chai": "~4.2.0",
33
33
  "chai-as-promised": "~7.1.1",
34
+ "coveralls": "^3.1.1",
34
35
  "eslint": "^6.8.0",
35
36
  "eslint-config-prettier": "^4.1.0",
36
37
  "eslint-plugin-chai-friendly": "^0.4.0",
@@ -22,7 +22,7 @@ declare module 'stripe' {
22
22
  /**
23
23
  * The most recent action performed by the reader.
24
24
  */
25
- action?: Reader.Action | null;
25
+ action: Reader.Action | null;
26
26
 
27
27
  deleted?: void;
28
28
 
@@ -133,6 +133,9 @@ declare module 'stripe' {
133
133
  }
134
134
 
135
135
  interface ProcessSetupIntent {
136
+ /**
137
+ * ID of a card PaymentMethod generated from the card_present PaymentMethod that may be attached to a Customer for future transactions. Only present if it was possible to generate a card PaymentMethod.
138
+ */
136
139
  generated_card?: string;
137
140
 
138
141
  /**
@@ -30,7 +30,7 @@ declare module 'stripe' {
30
30
  id: string,
31
31
  params: CustomerFundCashBalanceParams,
32
32
  options?: RequestOptions
33
- ): Promise<Stripe.Response<Stripe.CustomerBalanceTransaction>>;
33
+ ): Promise<Stripe.Response<Stripe.CustomerCashBalanceTransaction>>;
34
34
  }
35
35
  }
36
36
  }
@@ -47,7 +47,7 @@ declare module 'stripe' {
47
47
  /**
48
48
  * The PaymentMethod used as the payment instrument for an OutboundTransfer.
49
49
  */
50
- destination_payment_method: string;
50
+ destination_payment_method: string | null;
51
51
 
52
52
  destination_payment_method_details: OutboundTransfer.DestinationPaymentMethodDetails;
53
53
 
@@ -239,11 +239,6 @@ declare module 'stripe' {
239
239
  */
240
240
  currency: string;
241
241
 
242
- /**
243
- * The PaymentMethod to use as the payment instrument for the OutboundTransfer.
244
- */
245
- destination_payment_method: string;
246
-
247
242
  /**
248
243
  * The FinancialAccount to pull funds from.
249
244
  */
@@ -254,6 +249,11 @@ declare module 'stripe' {
254
249
  */
255
250
  description?: string;
256
251
 
252
+ /**
253
+ * The PaymentMethod to use as the payment instrument for the OutboundTransfer.
254
+ */
255
+ destination_payment_method?: string;
256
+
257
257
  /**
258
258
  * Hash describing payment method configuration details.
259
259
  */