Mangopay / cardregistration-android-kit

MIT License
5 stars 2 forks source link

SDK still fails when creating a new Card #28

Closed cesaramnuel closed 3 years ago

cesaramnuel commented 3 years ago

As suggested by your support contact center, I open this issue, with exactly the same comment I posted on an already existing issue regarding the same problem:

"As of December 2020, this issues is still open. We have added -keep class com.mangopay.* { ; } as specified, and it worked on emulators with API 30, but did not on physical devices. The problem still persists when trying to create a new card with registerCard. For some reason, callback function is not triggered. We have also set minifyEnabled false. Any advice?"

I hope this can be solved soon

mangomaxoasis commented 3 years ago

Hi @cesaramnuel We're looking into it pi @catacraciun Max

cesaramnuel commented 3 years ago

Hi @mangomaxoasis!

Thank you very much! If you need anything from us, we're right here!

mangomaxoasis commented 3 years ago

Hi @cesaramnuel Sorry for the delay, we're just fine tuning the release Should be done shortly max

cesaramnuel commented 3 years ago

H @mangomaxoasis

Thank you for the hard work!

cesaramnuel commented 3 years ago

Hi @mangomaxoasis

How's that release going?

Regards!

octa-george commented 3 years ago

Duplicate of #23

cesaramnuel commented 3 years ago

Hi @octa-george, with the given instructions you guys provided, and the package in version 1.0.2, we still can't make it work.

mangomaxoasis commented 3 years ago

Hey @cesaramnuel We're looking into it

octa-george commented 3 years ago

Hey @cesaramnuel.

How are you using the registerCard method? It's slightly unlikely for it not to return something on the callback. This can happen only if you don't specify a callback or if there's something wrong on the backend side which we need to further inspect. Are you using it as in the example? Can you share a snippet of your code with us so we can better understand the issue. Do you receive any IllegalArgumentException or MangoException? If so, please share with us the code and message of that exception.

As you can see in the open source SDK, that method is triggering two requests.

  1. the token request, which is a post to your cardRegistrationURL
  2. the card registration request which is another post that's constructed from the baseUrl, clientId and cardPreregistrationId. You need to make sure that those informations are being set correctly on the MangoSettings.

Please also share with us your proguard settings.

Did you tried a full proguard ignore?

-keep class com.mangopay.android.sdk.* { *; }
-keep interface com.mangopay.android.sdk.** { *; }
-keep enum com.mangopay.android.sdk.** { *; }
-keepclasseswithmembers class class com.mangopay.android.sdk.** { *; }
-keepclassmembers class * extends java.lang.Enum {
    <fields>;
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

Do you have any issues in debug or only in release?

cesaramnuel commented 3 years ago

Hi @octa-george,

Here's the data you asked for:

This is our implementation of the SDK and our proguard conf: https://gist.github.com/cesaramnuel/25c13ec21b31dad302acc81f43a2bd55

The SDK does not throw any kind of error. It's Android Studio who detects, over time, that no callback has been invoked, so it throws: W/System: A resource failed to call end.

As of now, this error is only in debug, since we don't have a production release yet. If you need any other info, just ask =)

octa-george commented 3 years ago

Hello @cesaramnuel. We've checked everything on our side, but we weren't able to reproduce your issue. The Callback is called on both debug and release, minified or non-obfuscated builds, on emulators or real devices with the test app.

The only logical scenario where this could happen in your side is if somehow the connection runs into a timeout. This being said, we have set a default connection and read timeout in the SDK to 30 seconds (it was infinite before), and you should get a proper socket timeout exception on your callback if it runs into it.

The fix will be released shortly with version number 1.0.3. However, if you do get this exception, it's very likely that you are passing over some wrong values (url) to the sdk.

mangomaxoasis commented 3 years ago

Hi @cesaramnuel Please let us know how it goes Max

cesaramnuel commented 3 years ago

Hi @mangomaxoasis!

We finally got it to work! Great work guys! Thank you very much!