Skip to content

Commit

Permalink
[DP-309] support for Delete Invoice (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkopac authored May 19, 2017
1 parent e4f5888 commit 4eb1353
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/chartmogul/invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Resource = require('./resource.js');
class Invoice extends Resource {

static get path () {
return '/v1/import/customers/{customerUuid}/invoices{/invoiceUuid}';
return '/v1/import/customers/{customerUuid}/invoices';
}
}

Expand All @@ -21,4 +21,6 @@ Invoice.all = function (config, params, cb) {
}
};

Invoice.destroy = Resource._method('DELETE', '/v1/invoices{/uuid}');

module.exports = Invoice;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chartmogul-node",
"version": "1.0.3",
"version": "1.0.4",
"description": "Official Chartmogul API Node.js Client",
"main": "lib/chartmogul.js",
"scripts": {
Expand Down
11 changes: 11 additions & 0 deletions test/chartmogul/invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,15 @@ describe('Invoices', () => {
expect(res.invoices[0].external_id).to.equal('INV0001');
});
});

it('should delete an invoice', () => {
nock(config.API_BASE)
.delete('/v1/invoices/inv_cff3a63c-3915-435e-a675-85a8a8ef4454')
.reply(204, {});

return Invoice.destroy(config, 'inv_cff3a63c-3915-435e-a675-85a8a8ef4454')
.then(res => {
expect(res).to.be.deep.equal({});
});
});
});

0 comments on commit 4eb1353

Please sign in to comment.