adyen-android
adyen-android copied to clipboard
NPE in the BinLookupRepository
Describe the bug We have just upgrade from checkout v3.8.x to v4.4.0 and after that we saw crashes in production. Below is the stacktrace.
Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'java.lang.String com.adyen.checkout.card.data.CardType.getTxVariant()' on a null object reference
After some investigation I narrowed it down to the supportedCardTypes we are passing into the cardConfigurationBuilder. We are getting a list from the backend containing the supported cardTypes and we are then parsing them into a CardType() with the CardType.getByBrandName() and passing it into an array and passing into the builder.
When the user starts to write their cardDetails the app crashes as it is trying to call Adyen with a null CardType.
In the previous version there were a check before the call to Adyen but on the v4.x.x it is now an unchecked call.
The workaround has been to do the check on our side before passing it to the cardConfigurationBuilder.
To Reproduce Steps to reproduce the behavior:
- Add GiroCard as a supported payment card
- Add it as a CardType.getbyBrandName()
- Start writing cardDetails
- See error
Expected behavior Not crashing but filter out the null as in previous versions
Thx a lot for the detailed investigation and report! We will look into fixing this for the next release.
Hi @christianfindsen! Can you share the full stacktrace of the exception so we can investigate in more detail?
Closing for inactivity, please reopen this issue if you are still experiencing problems.
Hi again @christianfindsen , this is quite an old thread so might be irrelevant now but we think that the latest release might have fixed this.
CardType.getbyBrandName()
was indeed not behaving as expected so we added a new way to specify supported card brands which are not part of the CardType
enum class, using the CardBrand
class.
So suppose you want to support mastercard and giro card you could do this:
CardConfiguration.Builder(...)
.setSupportedCardTypes(CardBrand("GIRO_TX_VARIANT"), CardBrand(CardType.MASTERCARD))
.build()