datatrans / android-sdk

Accept payments on your Android apps: Our mobile SDKs support your entire payment and registration process and simplify the integration of any payment method in your mobile apps.
Other
6 stars 0 forks source link

Back on card payment make the SDK unusable #12

Open Kevinrob opened 1 year ago

Kevinrob commented 1 year ago

Hi, We found a bug with the card payment process.

Steps to reproduce:

UPDATE / TL;DR: This is caused by predictive back gesture feature (enableOnBackInvokedCallback)

luiscosta commented 1 year ago

Hello @Kevinrob,

Can you give us a mobile token for that use case?

Are you perhaps using compose?

Also, are you able to record a video of this bug happening? As I am not being able to reproduce on version 3.1.1 I would like to see how it happens. In version 3.1.0 we added a condition that when testing mode is enabled you can record our window.

Thank you!

Kevinrob commented 1 year ago

Mobile Token: 29e841c68570e0ef1821277137f74e8c03335bf07b5ce5f7

Yes, we use Compose.

It's with the version 3.1.1.

https://github.com/datatrans/android-sdk/assets/4509277/1424c7ce-5963-41b6-b6fb-8e6e1bd291b5

When I try after making the backs, I get errors in logcat:

A transaction with mobileToken '29e841c68570e0ef1821277137f74e8c03335bf07b5ce5f7' is already in progress
luiscosta commented 1 year ago

Hello @Kevinrob,

I have here an Android SDK sample project in Compose with exactly the same init as yours on that mobile token.

Can you run it and check if the device you are using behaves the same way on this project?

I tried this sample on: Device Pixel 7 Pro (Android 14) Emulator Pixel 6 (Android 13) Emulator Pixel 6 (Android 9) Emulator Pixel 6 (Android 5)

All worked as expected.

Thanks!

sampleapp-android.zip

Kevinrob commented 1 year ago

I test on a Pixel 7 Pro too.

With the sampleapp, I get the Transaction CANCELLED message 👍🏻 I don't understand why I don't get it in my application. We start the transaction the same.

Do you have custom logic for cancelling the transaction on back press? Maybe you can add some log to a build that I can try?

luiscosta commented 1 year ago

Hello @Kevinrob,

I created a version for you to test with logs on our back pressed logic. You can only see these logs in testing mode (isTesting = true).

The version is "1.0.0-QoQaVersion311".

Two examples of logs with the Android SDK Sample project:

When two payment methods are display and we go back on credit card screen: ch.datatrans.sdksample D/Datatrans: onBackPressed ch.datatrans.sdksample D/Datatrans: onBackPressed: Back or Cancel SDK ch.datatrans.sdksample D/Datatrans: onBackPressed: Back

When only the credit card screen is displayed: ch.datatrans.sdksample D/Datatrans: onBackPressed ch.datatrans.sdksample D/Datatrans: onBackPressed: Back or Cancel SDK ch.datatrans.sdksample D/Datatrans: onBackPressed: Cancel SDK

Thanks!

Kevinrob commented 1 year ago

I think I found the cause of the problem.

android:enableOnBackInvokedCallback=true in the manifest. This is from predictive back gesture feature.

If I remove it, it's works. I get the cancellation callback and I see the 3 logs onBackPressed.

For the moment we will disable this in our application. But maybe there is something to do in the SDK for supporting this?

luiscosta commented 1 year ago

Hello @Kevinrob,

I just tried it out too. Yes, that affects our back pressed behaviour.

We will analyse when we can release a fix to support it and will inform you in this ticket whenever it is released.

Thank you again for bringing it up!

Kevinrob commented 10 months ago

Hi @luiscosta, any updates on this?

luiscosta commented 10 months ago

Hello,

I just tried my Compose Sample App (the same one I sent to you) with Datatrans SDK 3.3.0 and the flag android:enableOnBackInvokedCallback="true" and it worked fine for me, I receive the cancels and successes.

Do you still see this problem in 3.3.0?

Please let me know.

luiscosta commented 10 months ago

@Kevinrob, I forgot to tag you on last message, do you still see this problem?

Thanks!

bacherma commented 6 months ago

We consider this as fixed. Please report again if the issue persists.

Kevinrob commented 4 months ago

I just tested again to enable enableOnBackInvokedCallback and the issue is still here.

https://github.com/datatrans/android-sdk/assets/4509277/66aa97b1-7d87-4b95-b395-cd82585e9961

SDK version: 3.6.0

And I can reproduce with your sample project too:

https://github.com/datatrans/android-sdk/assets/4509277/77150acd-1655-4cf5-a8f5-20190b7f27bd

sampleapp-android.zip

Kevinrob commented 4 months ago

@bacherma can you re-open this issue?

luiscosta commented 4 months ago

Hello @Kevinrob,

Can you please test this issue on your solution with the version 1.0.0-Qoqa360?

Please note that you shouldn't use this version on your release because it will be removed later from our JFrog. This version is only for testing purposes.

Thanks!

Kevinrob commented 4 months ago

Hi @luiscosta

Yes, it's working! Thank you! I can't wait to have this fixed in a future release 😊