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

Zero amount verification in ThreeDSecure process #620

Open
puniserv opened this issue Mar 16, 2022 · 3 comments
Open

Zero amount verification in ThreeDSecure process #620

puniserv opened this issue Mar 16, 2022 · 3 comments

Comments

@puniserv
Copy link

General information

  • SDK version: 3.85.2 and older
  • Environment: every environment
  • Browser and OS: Chrome 99.0.4844.51 (64-bit) on MacOS 12.2.1

Issue description

Zero amount verification throws error when numeric type is used:

.verifyCard({
        amount: 0,
        ...
 }, ...)

String type is working, but is not compatible with types/braintree-web definitions.

.verifyCard({
        amount: '0',
        ...
 }, ...)

Error:

{name: 'BraintreeError', code: 'THREEDS_MISSING_VERIFY_CARD_OPTION', message: 'verifyCard options must include an amount.', type: 'MERCHANT', details: undefined}

Problem is in braintree-web/three-d-secure/external/frameworks/base.js file:
Probably if(!options.amount) should be changed to null|undefined === condition .

  if (this._verifyCardInProgress === true) {
    return new BraintreeError(errors.THREEDS_AUTHENTICATION_IN_PROGRESS);
  } else if (!options.nonce) {
    errorOption = 'a nonce';
  } else if (!options.amount) {
    errorOption = 'an amount';
  }
@jplukarski
Copy link
Contributor

Hello @puniserv , thanks for bringing this to our attention. I do see that our check is erroneously throwing the THREEDS_MISSING_VERIFY_CARD_OPTION error and we can look to get this fixed. However, this amount is supposed to reflect the transaction amount and a zero dollar transaction will result in a 94505: The amount you specified must be a number greater than 0. Can you explain your use case for zero-dollar verifications so we can best prioritize this fix?

@puniserv
Copy link
Author

@jplukarski not really. You can process card verification with 0 amount. We are using this when client is adding card to our system and 0 amount does not cause 94505: The amount you specified must be a number greater than 0. error

@JoshStrobl
Copy link

Ran into this as well and had to use yarn patch to remove the option checks. Would be better if instead of inverted truthy value (where 0 is false), it just checked that is of type Number.

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

No branches or pull requests

3 participants