Skip to content

Commit

Permalink
API Updates for beta branch (#1529)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe authored Aug 25, 2022
1 parent 8a33751 commit ce315b0
Show file tree
Hide file tree
Showing 20 changed files with 1,225 additions and 40 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ jobs:
- name: Test
run: yarn && yarn test

- name: Coveralls
run: yarn report && yarn coveralls
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: node-${{ matrix.node }}
COVERALLS_SERVICE_NUMBER: ${{ github.run_id }}

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
run: curl "https://coveralls.io/webhook?repo_token=${{ secrets.GITHUB_TOKEN }}&repo_name=${{ github.repository }}" -d "payload[build_num]=${{ github.run_id }}&payload[status]=done"

publish:
name: Publish
if: >-
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 10.5.0 - 2022-08-24
* [#1527](https://github.com/stripe/stripe-node/pull/1527) fix: Update FetchHttpClient to send empty string for empty POST/PUT/PATCH requests.
* [#1528](https://github.com/stripe/stripe-node/pull/1528) Update README.md to use a new NOTE notation
* [#1526](https://github.com/stripe/stripe-node/pull/1526) Add test coverage using Coveralls

## 10.4.0 - 2022-08-23
* [#1520](https://github.com/stripe/stripe-node/pull/1520) Add beta readme.md section
* [#1524](https://github.com/stripe/stripe-node/pull/1524) API Updates
* Change `Terminal.Reader.action` to be required
* Change `TreasuryOutboundTransferCreateParams.destination_payment_method` to be optional
* Change type of `Treasury.OutboundTransfer.destination_payment_method` from `string` to `string | null`
* Change the return type of `Customer.fundCashBalance` test helper from `CustomerBalanceTransaction` to `CustomerCashBalanceTransaction`.
* 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.

## 10.4.0-beta.1 - 2022-08-23
* [#1523](https://github.com/stripe/stripe-node/pull/1523) API Updates for beta branch
- Updated stable APIs to the latest version
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v183
v185
49 changes: 30 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Version](https://img.shields.io/npm/v/stripe.svg)](https://www.npmjs.org/package/stripe)
[![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)
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-node/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-node?branch=master)
[![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 All @@ -10,10 +11,6 @@ applications written in server-side JavaScript.

For collecting customer and payment information in the browser, use [Stripe.js][stripe-js].

## Support

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.

## Documentation

See the [`stripe-node` API docs](https://stripe.com/docs/api?lang=node) for Node.js.
Expand All @@ -34,20 +31,6 @@ npm install stripe --save
yarn add stripe
```

### Beta version

Stripe has features in the beta phase that can be accessed via the beta version of this package.
We would love for you to try these and share feedback with us before these features reach the stable phase.
The beta versions can be installed in one of two ways
- To install the latest beta version, run the command `npm install stripe@beta --save`
- To install a specific beta version, replace the term "beta" in the above command with the version number like `npm install [email protected] --save`

> 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.
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.

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.

## Usage

The package needs to be configured with your account's secret key, which is
Expand Down Expand Up @@ -204,7 +187,8 @@ const stripe = Stripe('sk_test_...', {
| `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. |
| `telemetry` | `true` | Allow Stripe to send latency [telemetry](#request-latency-telemetry). |

Note: Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis.
> **Note**
> Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis.
### Configuring Timeout

Expand Down Expand Up @@ -490,6 +474,33 @@ const stripe = new Stripe('sk_test_...', {
});
```

### Beta SDKs

Stripe has features in the beta phase that can be accessed via the beta version of this package.
We would love for you to try these and share feedback with us before these features reach the stable phase.
The beta versions can be installed in one of two ways
- To install the latest beta version, run the command `npm install stripe@beta --save`
- To install a specific beta version, replace the term "beta" in the above command with the version number like `npm install [email protected] --save`

> **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.
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.

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.

If your beta feature requires a `Stripe-Version` header to be sent, use the `apiVersion` property of `config` object to set it:

```js
const stripe = new Stripe('sk_test_...', {
apiVersion: '2022-08-01; feature_beta=v3',
});
```

## Support

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.

## More Information

- [REST API Version](https://github.com/stripe/stripe-node/wiki/REST-API-Version)
Expand Down
4 changes: 4 additions & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ module.exports = {
Accounts: require('./resources/FinancialConnections/Accounts'),
Sessions: require('./resources/FinancialConnections/Sessions'),
}),
GiftCards: resourceNamespace('giftCards', {
Cards: require('./resources/GiftCards/Cards'),
Transactions: require('./resources/GiftCards/Transactions'),
}),
Identity: resourceNamespace('identity', {
VerificationReports: require('./resources/Identity/VerificationReports'),
VerificationSessions: require('./resources/Identity/VerificationSessions'),
Expand Down
36 changes: 36 additions & 0 deletions lib/resources/GiftCards/Cards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// File generated from our OpenAPI spec

'use strict';

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

module.exports = StripeResource.extend({
path: 'gift_cards/cards',

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

retrieve: stripeMethod({
method: 'GET',
path: '/{id}',
}),

update: stripeMethod({
method: 'POST',
path: '/{id}',
}),

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

validate: stripeMethod({
method: 'POST',
path: '/validate',
}),
});
41 changes: 41 additions & 0 deletions lib/resources/GiftCards/Transactions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// File generated from our OpenAPI spec

'use strict';

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

module.exports = StripeResource.extend({
path: 'gift_cards/transactions',

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

retrieve: stripeMethod({
method: 'GET',
path: '/{id}',
}),

update: stripeMethod({
method: 'POST',
path: '/{id}',
}),

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

cancel: stripeMethod({
method: 'POST',
path: '/{id}/cancel',
}),

confirm: stripeMethod({
method: 'POST',
path: '/{id}/confirm',
}),
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@typescript-eslint/parser": "^2.13.0",
"chai": "~4.2.0",
"chai-as-promised": "~7.1.1",
"coveralls": "^3.1.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-chai-friendly": "^0.4.0",
Expand Down
4 changes: 2 additions & 2 deletions test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ describe('Customer', function() {
});

it('fundCashBalance method', async function() {
const customerBalanceTransaction = await stripe.testHelpers.customers.fundCashBalance(
const customerCashBalanceTransaction = await stripe.testHelpers.customers.fundCashBalance(
'cus_123',
{amount: 30, currency: 'eur'}
);
expect(customerBalanceTransaction).not.to.be.null;
expect(customerCashBalanceTransaction).not.to.be.null;
});

it('list method', async function() {
Expand Down
Loading

0 comments on commit ce315b0

Please sign in to comment.