diff --git a/README.md b/README.md index 4d097a6..46adf06 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,8 @@ ChartMogul.Plan.destroy(config, uuid) ```js ChartMogul.Invoice.create(config, customerUuid, data) ChartMogul.Invoice.all(config, customerUuid, query) +ChartMogul.Invoice.all(config, query) +ChartMogul.Invoice.retrieve(config, invoiceUuid) ``` #### [Transactions](https://dev.chartmogul.com/docs/transactions) diff --git a/lib/chartmogul/invoice.js b/lib/chartmogul/invoice.js index 044e3b6..b85e118 100644 --- a/lib/chartmogul/invoice.js +++ b/lib/chartmogul/invoice.js @@ -11,6 +11,7 @@ class Invoice extends Resource { // @Override Invoice.all_customer = Invoice.all; + Invoice.all_any = Resource._method('GET', '/v1/invoices'); Invoice.all = function (config, params, cb) { @@ -23,4 +24,6 @@ Invoice.all = function (config, params, cb) { Invoice.destroy = Resource._method('DELETE', '/v1/invoices{/uuid}'); +Invoice.retrieve = Resource._method('GET', '/v1/invoices{/uuid}'); + module.exports = Invoice; diff --git a/package.json b/package.json index 233a2e5..109010b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chartmogul-node", - "version": "1.0.4", + "version": "1.0.5", "description": "Official Chartmogul API Node.js Client", "main": "lib/chartmogul.js", "scripts": { diff --git a/test/chartmogul/invoice.js b/test/chartmogul/invoice.js index f3aedeb..918ddf2 100644 --- a/test/chartmogul/invoice.js +++ b/test/chartmogul/invoice.js @@ -227,4 +227,16 @@ describe('Invoices', () => { expect(res).to.be.deep.equal({}); }); }); + + it('should retrieve an invoice', () => { + var payload = {external_id: 'some_invoice_id'}; + nock(config.API_BASE) + .get('/v1/invoices/inv_cff3a63c-3915-435e-a675-85a8a8ef4454') + .reply(200, payload); + + return Invoice.retrieve(config, 'inv_cff3a63c-3915-435e-a675-85a8a8ef4454') + .then(res => { + expect(res).to.be.deep.equal(payload); + }); + }); });