Skip to content

Commit

Permalink
Fix missing customer_uuid when creating a note or retrieving all no…
Browse files Browse the repository at this point in the history
…tes from a customer (#87)

* Fix missing `customer_uuid` when creating a note or retrieving all notes from a customer
  • Loading branch information
SoeunSona authored Dec 21, 2023
1 parent 5634dc0 commit af6272e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning].
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html

## [3.2.1] - 2023-12-20
- Fix missing `customer_uuid` when creating a note or retrieving all notes from a customer

## [3.2.0] - 2023-12-20
- Support customer notes

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ChartMogul.Contact.all(config, { per_page: 10, cursor: 'cursor==' })
```js
ChartMogul.CustomerNote.create(config, data)
ChartMogul.CustomerNote.retrieve(config, noteUuid)
ChartMogul.CustomerNote.patch(config, noteUuid)
ChartMogul.CustomerNote.patch(config, noteUuid, data)
ChartMogul.CustomerNote.destroy(config, noteUuid)
ChartMogul.CustomerNote.all(config, { per_page: 10, cursor: 'cursor==', customer_uuid: customerUuid})

Expand Down
6 changes: 3 additions & 3 deletions lib/chartmogul/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class Customer extends Resource {

static notes (config, customerId, params, callback) {
const path = util.expandPath(CustomerNote.path, []);
return Resource.request(config, 'GET', path, { ...params, customerId }, callback);
return Resource.request(config, 'GET', path, { ...params, customer_uuid: customerId }, callback);
}

static createrNote (config, customerId, params, callback) {
static createNote (config, customerId, params, callback) {
const path = util.expandPath(CustomerNote.path, []);
return Resource.request(config, 'POST', path, { ...params, customerId }, callback);
return Resource.request(config, 'POST', path, { ...params, customer_uuid: customerId }, callback);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "3.2.0",
"version": "3.2.1",
"description": "Official Chartmogul API Node.js Client",
"main": "lib/chartmogul.js",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions test/chartmogul/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ describe('Customer', () => {
it('creates a new note from a customer', () => {
const customerUuid = 'cus_00000000-0000-0000-0000-000000000000';
const postBody = {
customer_uuid: customerUuid,
type: 'note',
author_email: '[email protected]',
note: 'This is a note'
Expand All @@ -209,7 +208,7 @@ describe('Customer', () => {
type: 'note'
});

Customer.createrNote(config, customerUuid, postBody)
Customer.createNote(config, customerUuid, postBody)
.then(res => {
expect(res).to.have.property('uuid');
});
Expand Down

0 comments on commit af6272e

Please sign in to comment.