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

Failure delivering result ResultInfo #67

Open
kuxtal opened this issue Mar 17, 2023 · 0 comments
Open

Failure delivering result ResultInfo #67

kuxtal opened this issue Mar 17, 2023 · 0 comments

Comments

@kuxtal
Copy link

kuxtal commented Mar 17, 2023

I have a problem to implement mad_pay with flutter on Android Application.
I already followed the guide and example, but I can't receive response after payment.
I'm using a Test enviroment and android test cards, and I have configured a MainActivity with onActivityResult.

I have configured the google pay button in this form:

googlePayButton: GooglePayButton(
                  width: 290,
                  height: 120,
                  style: GooglePayButtonStyle.black,
                  type: GooglePayButtonType.pay,
                  request: PaymentRequest.google(
                    paymentNetworks: <PaymentNetwork>[
                      PaymentNetwork.amex,
                      PaymentNetwork.discover,
                      PaymentNetwork.interac,
                      PaymentNetwork.jcb,
                      PaymentNetwork.mastercard,
                      PaymentNetwork.visa,
                      PaymentNetwork.mir,
                    ],
                    google: googleParameters,
                    currencyCode: 'USD',
                    countryCode: 'US',
                    paymentItems: items,
                  ),
                  onPaymentResult: (PaymentResponse? req) {
                    setState(() {
                      result = 'GooglePayButton, Try to pay:\n${req?.token}';
                    });
                  },
                  onError: (Object? e) {
                    setState(() {
                      result = 'GooglePayButton, Error:\n$e';
                    });
                  },

I have configured MainActivity:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        Log.i(TAG, "Card info: $resultCode - $requestCode - $data");

         if(resultCode != RESULT_CANCELED && data != null){
             super.onActivityResult(requestCode, resultCode, data);
         }
}

I'm using mad_pay 2.2.12, I when I finalized the pay, the app doesn't enter onPaymentResult neither onError, however onActivityResult I can see:

Card info: -1 - 991 - Intent { (has extras) }

And after I receive

[        ] E/AndroidRuntime(20743): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=991, result=-1, data=Intent { (has extras) }} to activity {com.media/com.media.MainActivity}: java.lang.NullPointerException
[        ] E/AndroidRuntime(20743): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5397)
[        ] E/AndroidRuntime(20743): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5438)
[        ] E/AndroidRuntime(20743): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
[        ] E/AndroidRuntime(20743): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140)
[        ] E/AndroidRuntime(20743): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:100)
[        ] E/AndroidRuntime(20743): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2326)
[        ] E/AndroidRuntime(20743): 	at android.os.Handler.dispatchMessage(Handler.java:106)
[        ] E/AndroidRuntime(20743): 	at android.os.Looper.loop(Looper.java:263)
[        ] E/AndroidRuntime(20743): 	at android.app.ActivityThread.main(ActivityThread.java:8299)
[        ] E/AndroidRuntime(20743): 	at java.lang.reflect.Method.invoke(Native Method)
[        ] E/AndroidRuntime(20743): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
[        ] E/AndroidRuntime(20743): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
[        ] E/AndroidRuntime(20743): Caused by: java.lang.NullPointerException
[        ] E/AndroidRuntime(20743): 	at io.flutter.plugins.pay_android.GooglePayHandler.handlePaymentSuccess(GooglePayHandler.kt:216)
[        ] E/AndroidRuntime(20743): 	at io.flutter.plugins.pay_android.GooglePayHandler.onActivityResult(GooglePayHandler.kt:180)
[        ] E/AndroidRuntime(20743): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:805)
[        ] E/AndroidRuntime(20743): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:428)
[        ] E/AndroidRuntime(20743): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:807)
[        ] E/AndroidRuntime(20743): 	at io.flutter.embedding.android.FlutterFragment.onActivityResult(FlutterFragment.java:964)
[        ] E/AndroidRuntime(20743): 	at io.flutter.embedding.android.FlutterFragmentActivity.onActivityResult(FlutterFragmentActivity.java:566)
[        ] E/AndroidRuntime(20743): 	at com.media.MainActivity.onActivityResult(MainActivity.kt:46)
[        ] E/AndroidRuntime(20743): 	at android.app.Activity.dispatchActivityResult(Activity.java:8464)
[        ] E/AndroidRuntime(20743): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5390)
[        ] E/AndroidRuntime(20743): 	... 11 more

Thanks

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

1 participant