Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to issue a credit on a non-creditable card throws uninformative error #38

Open
stith opened this issue Jul 13, 2014 · 0 comments · May be fixed by #48
Open

Trying to issue a credit on a non-creditable card throws uninformative error #38

stith opened this issue Jul 13, 2014 · 0 comments · May be fixed by #48
Assignees

Comments

@stith
Copy link

stith commented Jul 13, 2014

If you try to:

balanced.get("/cards/ABCDEFG").credit({
  amount: "1000",
  description: "Test!"
})

But the card with ID ABCDEFG has can_credit == false, I'm seeing a very vague error:

TypeError: Cannot read property 'href' of undefined
    at jsonapi._getLink (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/lib.js:179:44)
    at /vagrant/node_modules/balanced-official/node_modules/jsonapi-client/lib.js:497:34
    at _fulfilled (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:749:13)
    at /vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:810:14
    at flush (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:108:17)
    at process._tickDomainCallback (node.js:372:11)

It'd be much more helpful if we instead got an error indicating that the card cannot be credited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants