mrdishant / Paytm-All-in-one-flutter-sdk

A Flutter plugin to use the Paytm as a gateway for accepting online payments in Flutter app.
Other
10 stars 7 forks source link

Paytm screen exits automatically after getting OTP. #12

Open riskyRahul opened 3 years ago

riskyRahul commented 3 years ago

Hello. Friends, I have a problem with this library, please help me. I have this kind of exception

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

D/AssistLogs(14200): com.paytm.pgsdk.PaytmPGActivity$SmsConsentBroadCastReciever@b10e141:Receiver started: D/AndroidRuntime(14200): Shutting down VM E/AndroidRuntime(14200): FATAL EXCEPTION: main E/AndroidRuntime(14200): Process: com.example.pro_advisor, PID: 14200 E/AndroidRuntime(14200): java.lang.RuntimeException: Unable to start receiver com.oohyugi.sms_otp_auto_verify.SmsBroadcastReceiver: kotlin.TypeCastException: null cannot be cast to non-null type kotlin.String E/AndroidRuntime(14200): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4111) E/AndroidRuntime(14200): at android.app.ActivityThread.access$1700(ActivityThread.java:242) E/AndroidRuntime(14200): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2078) E/AndroidRuntime(14200): at android.os.Handler.dispatchMessage(Handler.java:107) E/AndroidRuntime(14200): at android.os.Looper.loop(Looper.java:237) E/AndroidRuntime(14200): at android.app.ActivityThread.main(ActivityThread.java:7830) E/AndroidRuntime(14200): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(14200): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/AndroidRuntime(14200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040) E/AndroidRuntime(14200): Caused by: kotlin.TypeCastException: null cannot be cast to non-null type kotlin.String Lost connection to the device.

mrdishant commented 3 years ago

Plugin updated. Have a look and let me know.

MaheshPeri19 commented 3 years ago

I am having same issue now. Using paytm: ^2.0.0 version. After entering mobile number, it is asking alert to accept for sms. At that time app is crashing and getting same above logs.

Edit :

I found this same issue in official paytm flutter library also and submitted as new issue there.

paytm_allinonesdk 1.0.3

@mrdishant Is it related to paytm android sdk ? Any clue ?

MaheshPeri19 commented 3 years ago

I found exact issue. Paytm package is clashing with sms_otp_auto_verify package.

By running example project of paytm, it is working fine for production. But when i use it in my app, it is getting above error. Bcz i also used sms auto verify package.

@riskyRahul Did you use sms_otp_auto_verify: ^1.2.2 in your project ?

MaheshPeri19 commented 3 years ago

Update :

Issue is not related to paytm sdk. It is with sms_otp_auto_verify.

In sms_otp_auto_verify ====> SmsBroadcastReceiver.kt file ===>  line no 28, change from below line

val sms: String? = extras.get(SmsRetriever.EXTRA_SMS_MESSAGE) as String
to this line.
val sms: String? = extras.get(SmsRetriever.EXTRA_SMS_MESSAGE) as? String

Just added question mark after "as" solved this issue.