You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('should return false for a null cardNumber',function(){assert(false===recurly.validate.cardNumber());});
Sure, a form should validate that you have a credit card number... but if someone tries to validate the form before putting anything in the number... it should just be false ;)
The text was updated successfully, but these errors were encountered:
Thanks for reporting this and providing a solution. I'd be happy to get this fix into our next release -- and moreover, if you would like to build a PR for these changes, I'd be happy to accept the contribution.
- instead of parseCard returning false, it returns an empty string that cardNumber can parse
- Fixes#161
Signed-off-by: Christopher Rogers <chrissrogers@gmail.com>
validate.cardNumber() will throw TypeError: Cannot read property 'length' of undefined
You can fix this by changing:
https://github.com/recurly/recurly-js/blob/master/lib/util/parse-card.js#L10
to:
return (number || '').toString().replace(/[-\s]/g, '');
And someone should add a test at
recurly-js/test/unit/validate.test.js
Line 12 in f877db8
like:
Sure, a form should validate that you have a credit card number... but if someone tries to validate the form before putting anything in the number... it should just be false ;)
The text was updated successfully, but these errors were encountered: