Skip to content

Commit

Permalink
API Updates (#1124)
Browse files Browse the repository at this point in the history
* Codegen for openapi 403fdb8
  • Loading branch information
richardm-stripe authored Feb 22, 2021
1 parent 47a4be4 commit a80a93e
Show file tree
Hide file tree
Showing 10 changed files with 750 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = {
Transfers: require('./resources/Transfers'),
WebhookEndpoints: require('./resources/WebhookEndpoints'),
BillingPortal: resourceNamespace('billingPortal', {
Configurations: require('./resources/BillingPortal/Configurations'),
Sessions: require('./resources/BillingPortal/Sessions'),
}),
Checkout: resourceNamespace('checkout', {
Expand Down
11 changes: 11 additions & 0 deletions lib/resources/BillingPortal/Configurations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// File generated from our OpenAPI spec

'use strict';

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

module.exports = StripeResource.extend({
path: 'billing_portal/configurations',

includeBasic: ['create', 'retrieve', 'update', 'list'],
});
73 changes: 73 additions & 0 deletions test/resources/BillingPortal/Configurations.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';

const stripe = require('../../../testUtils').getSpyableStripe();

const expect = require('chai').expect;

describe('BillingPortal', () => {
describe('Configurations Resource', () => {
describe('create', () => {
it('Sends the correct request', () => {
const params = {
business_profile: {
privacy_policy_url: 'https://example.com/privacy',
terms_of_service_url: 'https://example.com/tos',
},
features: {
customer_update: {
allowed_updates: ['address'],
enabled: true,
},
},
};
stripe.billingPortal.configurations.create(params);
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/billing_portal/configurations',
headers: {},
data: params,
settings: {},
});
});
});
describe('update', () => {
it('Sends the correct request', () => {
const params = {
active: false,
};
stripe.billingPortal.configurations.update('bpc_123', params);
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/billing_portal/configurations/bpc_123',
headers: {},
data: params,
settings: {},
});
});
});
describe('retrieve', () => {
it('Sends the correct request', () => {
stripe.billingPortal.configurations.retrieve('bpc_123');
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/billing_portal/configurations/bpc_123',
headers: {},
data: {},
settings: {},
});
});
});
describe('list', () => {
it('Sends the correct request', () => {
stripe.billingPortal.configurations.list();
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/billing_portal/configurations',
headers: {},
data: {},
settings: {},
});
});
});
});
});
Loading

0 comments on commit a80a93e

Please sign in to comment.