Skip to content

Commit

Permalink
Generate stripe-node with breaking changes (#1491)
Browse files Browse the repository at this point in the history
* Generate stripe-node with breaking changes

* Update CustomerSource enum

* Generate files

* Fix type in test

* Fix tests
  • Loading branch information
kamil-stripe authored Jul 27, 2022
1 parent 149bf9e commit 2aaa897
Show file tree
Hide file tree
Showing 28 changed files with 896 additions and 1,396 deletions.
12 changes: 6 additions & 6 deletions lib/resources/CreditNotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ module.exports = StripeResource.extend({
methodType: 'list',
}),

listPreviewLineItems: stripeMethod({
method: 'GET',
path: '/preview/lines',
methodType: 'list',
}),

preview: stripeMethod({
method: 'GET',
path: '/preview',
Expand All @@ -44,10 +50,4 @@ module.exports = StripeResource.extend({
path: '/{creditNote}/lines',
methodType: 'list',
}),

listPreviewLineItems: stripeMethod({
method: 'GET',
path: '/preview/lines',
methodType: 'list',
}),
});
12 changes: 6 additions & 6 deletions lib/resources/Invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ module.exports = StripeResource.extend({
path: '/{invoice}/finalize',
}),

listUpcomingLines: stripeMethod({
method: 'GET',
path: '/upcoming/lines',
methodType: 'list',
}),

markUncollectible: stripeMethod({
method: 'POST',
path: '/{invoice}/mark_uncollectible',
Expand Down Expand Up @@ -75,10 +81,4 @@ module.exports = StripeResource.extend({
path: '/{invoice}/lines',
methodType: 'list',
}),

listUpcomingLineItems: stripeMethod({
method: 'GET',
path: '/upcoming/lines',
methodType: 'list',
}),
});
5 changes: 0 additions & 5 deletions lib/resources/Issuing/Cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,4 @@ module.exports = StripeResource.extend({
path: '',
methodType: 'list',
}),

retrieveDetails: stripeMethod({
method: 'GET',
path: '/{card}/details',
}),
});
6 changes: 3 additions & 3 deletions test/resources/Invoices.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ describe('Invoices Resource', () => {
});
});

describe('listUpcomingLineItems', () => {
describe('listUpcomingLines', () => {
it('Sends the correct request', () => {
stripe.invoices.listUpcomingLineItems();
stripe.invoices.listUpcomingLines();
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/invoices/upcoming/lines',
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('Invoices Resource', () => {

describe('listUpcomingLineItems', () => {
it('Sends the correct request', () => {
stripe.invoices.listUpcomingLineItems({
stripe.invoices.listUpcomingLines({
customer: 'cus_abc',
subscription_items: [{plan: 'potato'}, {plan: 'rutabaga'}],
limit: 5,
Expand Down
16 changes: 0 additions & 16 deletions test/resources/Issuing/Cards.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,4 @@ describe('Issuing', () => {
});
});
});

describe('Virtual Cards Resource', () => {
describe('retrieve', () => {
it('Sends the correct request', () => {
stripe.issuing.cards.retrieveDetails('ic_123');

expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/issuing/cards/ic_123/details',
headers: {},
data: {},
settings: {},
});
});
});
});
});
14 changes: 11 additions & 3 deletions test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ describe('Checkout.Session', function() {
expect(session).not.to.be.null;
});

it('listLineItems method', async function() {
const lineItems = await stripe.checkout.sessions.listLineItems('sess_xyz');
expect(lineItems).not.to.be.null;
});

it('list method', async function() {
const sessions = await stripe.checkout.sessions.list({limit: 3});
expect(sessions).not.to.be.null;
Expand Down Expand Up @@ -311,13 +316,16 @@ describe('Order', function() {
expect(order).not.to.be.null;
});

it('update method', async function() {
const order = await stripe.orders.update('order_xyz');
it('retrieve method', async function() {
const order = await stripe.orders.retrieve('order_xyz');
expect(order).not.to.be.null;
});

it('update method', async function() {
const order = await stripe.orders.update('order_xyz');
const order = await stripe.orders.update('order_xyz', {
metadata: {reference_number: '123'},
ip_address: '0.0.0.0',
});
expect(order).not.to.be.null;
});

Expand Down
10 changes: 5 additions & 5 deletions types/2020-08-27/Accounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ declare module 'stripe' {
/**
* Business information about the account.
*/
business_profile: Account.BusinessProfile | null;
business_profile?: Account.BusinessProfile | null;

/**
* The business type.
*/
business_type: Account.BusinessType | null;
business_type?: Account.BusinessType | null;

capabilities?: Account.Capabilities;

Expand All @@ -40,7 +40,7 @@ declare module 'stripe' {
/**
* The account's country.
*/
country: string;
country?: string;

/**
* Time at which the account was connected. Measured in seconds since the Unix epoch.
Expand All @@ -50,7 +50,7 @@ declare module 'stripe' {
/**
* Three-letter ISO currency code representing the default currency for the account. This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts).
*/
default_currency: string;
default_currency?: string;

deleted?: void;

Expand Down Expand Up @@ -96,7 +96,7 @@ declare module 'stripe' {
/**
* Options for customizing how the account functions within Stripe.
*/
settings: Account.Settings | null;
settings?: Account.Settings | null;

tos_acceptance?: Account.TosAcceptance;

Expand Down
92 changes: 0 additions & 92 deletions types/2020-08-27/AlipayAccounts.d.ts

This file was deleted.

Loading

0 comments on commit 2aaa897

Please sign in to comment.