Nets-mobile-acceptance / Netaxept-Android-SDK

PiA Netaxept Android SDK is a library that provides the native In-App interaction to perform Netaxept payments directly from an app on Android devices while minimizing PCI DSS requirements for you.
31 stars 15 forks source link

Crash when trying to pay with MobilePay #35

Closed mkovalyk closed 3 years ago

mkovalyk commented 3 years ago

I'm trying to pay using MobilePay, but I've got an exception:

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nemlig.test/eu.nets.pia.wallets.MobilepayActivity}: kotlin.TypeCastException: null cannot be cast to non-null type android.webkit.WebView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3374)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3513)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2109)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7682)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
     Caused by: kotlin.TypeCastException: null cannot be cast to non-null type android.webkit.WebView
        at eu.nets.pia.wallets.MobilepayActivity.launchApp(Unknown Source:26)
        at eu.nets.pia.wallets.WalletAppLifecycle$b.run(Unknown Source:23)
        at android.app.Activity.runOnUiThread(Activity.java:6917)
        at eu.nets.pia.wallets.WalletAppLifecycle.launchWithWalletURL(Unknown Source:5)
        at eu.nets.pia.wallets.WalletAppLifecycle.access$launchWithWalletURL(Unknown Source:0)
        at eu.nets.pia.wallets.WalletAppLifecycle$launchFrom$1.successWithWalletURL(Unknown Source:10)
...

Looks like the ID is of the view is: app_switch_webview I initialise mobilePay via:

PiaSDK.initiateMobileWallet(
                it,
                WalletPaymentRegistrationImpl(requestManager, paymentService)

This is how I proceed in WalletPaymentRegistration:

....
                    if (walletUrl != null) {
                        callbackWithWalletURL.successWithWalletURL(Uri.parse(walletUrl))
                    } else {
                        callbackWithWalletURL.failureWithError(IllegalStateException("WalletUrl is null"))
                    }

SDK version - 2.3.0

It is not reproducible on SDK 2.0.1

Miss-PiA commented 3 years ago

Hi @mkovalyk

Hope you are doing good.

Could you please confirm on the following points

If this crash occurs everytime or is there any specific scenario that replicates this issue? Is this is specific to any device or android version? Could you please send us the compileSdkVersion of your app and Android device version/ brand if the issue is specific to any

These would make it easy to replicate the issue on our end.

Thank you

BR

mkovalyk commented 3 years ago

@Miss-PiA

  1. Yes, the issue is 100% reproducible. Not sure, if it might be related, but I'm working with test app for verification MobilePay at https://developer.mobilepay.dk/products/online/test
  2. Occurred at least on API 29 and API 30. According to the stacktrace it doesn't look to be device-specific issue.
  3. compileSdkVersion = 30.
  4. No specific devices. Tested on devices:
    • OnePlus 6, API 29,
    • Emulator Google Pixel API 30
    • Emulator Google Pixel C, API 30
Miss-PiA commented 3 years ago

Hello @DmytroKataryna ,

Could you please confirm if this issue is still reproducible in our latest version 2.4.0 or not?

mkovalyk commented 3 years ago

The issue is fixed as of 2.4.0