braintree / braintree-android-drop-in

Braintree Drop-In SDK for Android
https://developers.braintreepayments.com/guides/drop-in/android/v2
MIT License
124 stars 79 forks source link

Invalid card number shown for valid card number #234

Closed rwbutler closed 2 years ago

rwbutler commented 3 years ago

General information

Issue description

We've recently found that on one type of Android device - specifically, the Xiaomi Mi 9 running Android 10 when inputting a real MasterCard card number (not sandbox) and upon tapping the Pay Now button the message "card number is invalid" is shown. I've attached a photo with the card number obfuscated for obvious reasons.

card_details

Also note that once the validation error message is shown the other fields no longer appear to be visible.

We've tried the exact same card number on another Android device without issue therefore this appears to be device specific. Thanks in advance for the assistance with this.

sshropshire commented 3 years ago

Hi @rwbutler thanks for using the Braintree SDK for Android. It does seem odd that this would be working on one device and not another. It will be difficult to reproduce this on our end since we don't have access to a Xiamoi Mi 9 phone.

We use Luhn validation in our android-card-form library to determine the validity of a card. If you Command + Click (or Control + Click for Windows) on the mCardForm's isValid() method here, then you should be able to set breakpoints in our card-form library and debug the issue on the Mi 9. This would be most helpful in diagnosing the problem.

rwbutler commented 3 years ago

Hi @sshropshire thanks for the reply. Agreed - I was surprised that this only affected a certain device type (or types). Unfortunately I don't have access to the device myself - our product manager was testing the app on his personal device when we discovered this issue (we're remotely based at the moment).

I expected that you'd be using Luhn's here - it seemed unlikely to be that the algorithm implementation itself would be at fault as I'd expect this to work regardless of device type. We also know that the card number is actually valid despite the message telling us that it isn't on this device. My guess would be that something is wrong in terms of the view hierarchy or data binding as the issue only occurs when the pay button is pressed which then causes the remaining fields to disappear and the error message to be displayed when it shouldn't be.

Can understand that this is an issue on a very edge-case device and therefore difficult to test but I wanted to flag this because of the possibility that if this issue is occurring on one Android device type there could be others out there too where this issue is occurring. Thanks again.

sarahkoop commented 3 years ago

Hi @rwbutler - We've released version 6.0.0-beta2 of the SDK, could you confirm if this issue still exists on the latest version?

sarahkoop commented 2 years ago

Hi @rwbutler - Closing this issue due to inactivity. Please feel free to re-open if you are still experiencing this on the latest version of the SDK (6.0.1)