Skip to content

Commit

Permalink
Merge pull request #627 from stripe/ob-invoice-lines-methods
Browse files Browse the repository at this point in the history
Add listLineItems and listUpcomingLineItems methods
  • Loading branch information
ob-stripe authored May 14, 2019
2 parents ea637ca + 746982d commit a78df24
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/resources/Invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ module.exports = StripeResource.extend({
urlParams: ['invoiceId'],
}),

listLineItems: stripeMethod({
method: 'GET',
path: '{invoiceId}/lines',
urlParams: ['invoiceId'],
}),

listUpcomingLineItems: stripeMethod({
method: 'GET',
path: 'upcoming/lines',
}),

// deprecated in favor of `listLineItems`
retrieveLines: stripeMethod({
method: 'GET',
path: '{invoiceId}/lines',
Expand Down
24 changes: 24 additions & 0 deletions test/resources/Invoices.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,30 @@ describe('Invoices Resource', function() {
});
});

describe('listLineItems', function() {
it('Sends the correct request', function() {
stripe.invoices.listLineItems('in_123');
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/invoices/in_123/lines',
headers: {},
data: {},
});
});
});

describe('listUpcomingLineItems', function() {
it('Sends the correct request', function() {
stripe.invoices.listUpcomingLineItems();
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/invoices/upcoming/lines',
headers: {},
data: {},
});
});
});

describe('retrieveLines', function() {
it('Sends the correct request', function() {
stripe.invoices.retrieveLines('in_123');
Expand Down

0 comments on commit a78df24

Please sign in to comment.