Adyen / adyen-android

Adyen Android Drop-in and Components
https://docs.adyen.com/checkout/android
MIT License
126 stars 66 forks source link

Diners card type -> Test 3D Secure 2 authentication -> Card Component -> The entered card brand isn't supported #1003

Closed mRogach closed 1 year ago

mRogach commented 1 year ago

Describe the bug The Diners Test card with 3D Secure 2 authentication 3056 9309 0259 04 seems to be not working in Android. Also it works fine on IOS

Android adyen gradle dependencies: def adyen_version = '4.9.1' implementation "com.adyen.checkout:drop-in:$adyen_version" implementation "com.adyen.checkout:card:$adyen_version" implementation "com.adyen.checkout:redirect:$adyen_version"

CardConfiguration : cardConfiguration = CardConfiguration.Builder( requireContext(), viewModel.adyenClientKey ?: "" ) .setEnvironment(viewModel.adyenEnvironment ?: Environment.TEST) .setHolderNameRequired(true) .setShowStorePaymentField(false) .build()

To Reproduce Steps to reproduce the behavior:

  1. Implement Card Component
  2. Try to input 3056 9309 0259 04

Expected behavior The field is correct

Screenshots image

Smartphone (please complete the following information):

Additional context Just found the difference between IOS and Android that the class com.adyen.checkout.card.data.CardType has DINERS("diners", Pattern.compile("^(36)[0-9]{0,12}$")) but IOS has "^(3[60])[0-9]{0,12}$"

etman55 commented 1 year ago

Thank you @mRogach for reaching out. Could you provide logs from when this happens?, you can enable extensive logs by calling com.adyen.checkout.core.log.Logger.setLogcatLevel(Log.VERBOSE) in your application class and filter your logs by CO. to see all the checkout logs. Maybe we can get more info from there.

mRogach commented 1 year ago

Thanks @etman55 for your quick answer. From the logs we can see in response that this card is not supported. But it works fine in Drop In in the same app and the same device. I will paste here logs body: call - https://checkoutshopper-test.adyen.com/checkoutshopper/v2/bin/binLookup?clientKey=test_STJZZW6WF5AUVGDPECJXS4W4F4JALQXZ request-{ "encryptedBin": "adyenan0_1_1$VwS1poLFRfQ7iQ3pNM8FLYjd4emC4Hmu+EEtc60rRLcCUV2La8RAFct\/BEn9Fy0aDmE1VopGnlUMVzAZZq\/38fOcRQs0C5qaS8GA5Z8+9m0u6QVIyivgiQ+jDnYb8KHMg9qRioIslkLGBx6R7L1uKpr3\/kFYELLkQGIjjLwz5EtJ4a+GBCpG5KpvCY97yJUmPbm86NrDbqWX0AmSr2Hyh+iDHt84dVdeVQ0BZR5DsIbmQY30bGZdgyKsS5rDX68joOEJGHB8igxHuGCkLKRw7\/t4RzDT+B9iq7cSCQumTmhIxeNxKLT88\/IJKryWU7PKcw9zxG6nVsmOstou9yK1+g==$38kvlPkIEfdLRf7b6QDwiYcD2f++BXB8IsgVIbhrWpy7zKlKYo48bE2V\/jlIr8R\/Zb0cxXInW6pCM3qVvFpoxKBo\/i0urR8nXLvjEOLY4cCzZR3GHPm1i75K", "requestId": "da7ee7d5-1597-455e-bbd1-d571a050d6ca", "supportedBrands": [ "visa", "amex", "mc" ] } "brands": [ { "brand": "diners", "cvcPolicy": "required", "enableLuhnCheck": true, "expiryDatePolicy": "required", "localeBrand": "Diners Club", "showExpiryDate": true, "showSocialSecurityNumber": false, "supported": false } ], "issuingCountryCode": "NL", "requestId": "da7ee7d5-1597-455e-bbd1-d571a050d6ca" }
image

mRogach commented 1 year ago

Hi @etman55, I see that in log request there are only 3 supportedBrands "visa","amex","mc". Does it mean these types sent by default ? And should I use CardConfiguration.setSupportedCardTypes(CardType.DINERS) to make this type working ? I don't want to specify any of the types? I prefer if adyen can decide it. Looking forward for you answer. Thanks

etman55 commented 1 year ago

Hey @mRogach, can you share with me how do create cardComponent? also paymentMethods object that you pass to it. And no you don't have to use CardConfiguration.setSupportedCardTypes(CardType.DINERS) to make it work.

mRogach commented 1 year ago

Hey @etman55 sure. Here is cardComponent set up. image And PaymentMethod object is pretty simple I created it like this PaymentMethod().apply { type = "scheme" }).

etman55 commented 1 year ago

Hey @mRogach thanks for helping to know what happens, so in your implementation of paymentMethods there's no brands so what happened is when brands value is null or empty we fall back to DEFAULT_SUPPORTED_CARDS_LIST which is [visa, amex, mc] so that's why diners is not supported in your card component.

etman55 commented 1 year ago

So the solution is getting the PaymentMethod model from the response of the /paymentMethods api call. You can deserialize the response using PaymentMethodsApiResponse.SERIALIZER.deserialize or PaymentMethod.SERIALIZER.deserialize (depending on whether you have the whole response JSON or just the scheme payment method) so that you can be able to extract the PaymentMethod that you will be passing to the CardComponent.PROVIDER.

mRogach commented 1 year ago

@etman55 Thank you so much! Sorry I missed this part. I don't know why maybe because the method CardComponent.PROVIDER.isPaymentMethodSupported(it) is not public. But anyway I fixed it and it works! Thank you for your kind help! I will close this issue as it is not related to the sdk.