mkharibalaji / react-native-adyen-payment

React Native Adyen Payment
https://mkharibalaji.github.io/react-native-adyen-payment/
MIT License
35 stars 35 forks source link

Plans to update for adyen-android 4.0.0? #57

Closed hackaprende closed 2 years ago

hackaprende commented 2 years ago

Is there any plan to update for adyen-android 4.0.0 soon?

Gp2mv3 commented 2 years ago

Why is this issue closed ? It's indeed important to upgrade to 4.4

rlemasquerier commented 2 years ago

+1 I think this upgrade is very important and becoming quiet urgent. Android 12 is not officially supported with current version.

Gp2mv3 commented 2 years ago

I have a patch to use with patch-package, currently in testing for my company, if we are satisfied with the result, I'll push it here. It doesn't update to 4.0.0 but it adds compatibility to Android 12.

rlemasquerier commented 2 years ago

That's great to hear, thanks @Gp2mv3 !

By any chance, would you have a link where I can see this patch, so I can try it on my side as well ?

I saw on android SDK repo that support for Android 12 has been added in 4.1.0 (https://github.com/Adyen/adyen-android/releases#4.1.0), so I wonder how you achieved it without updating the android SDK. Anycase, if your patch works that's a great news 🙂

Gp2mv3 commented 2 years ago

Yes, I just have to clean it a bit. I'll try that this evening. I also removed the dependencies to jcenter ;)

Gp2mv3 commented 2 years ago

As promised, here is the patch file (used with patch-package):

diff --git a/node_modules/react-native-adyen-payment/android/build.gradle b/node_modules/react-native-adyen-payment/android/build.gradle
index 0ad693a..327a7ba 100644
--- a/node_modules/react-native-adyen-payment/android/build.gradle
+++ b/node_modules/react-native-adyen-payment/android/build.gradle
@@ -68,13 +68,16 @@ repositories {
         url "$rootDir/../node_modules/jsc-android/dist"
     }
     google()
-    jcenter()
+    // jcenter()
     flatDir {
-      dirs 'libs'
+        dirs 'libs'
     }
 }

 dependencies {
+
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+
     // ref:
     // https://github.com/facebook/react-native/blob/0.61-stable/template/android/app/build.gradle#L192
     //noinspection GradleDynamicVersion
diff --git a/node_modules/react-native-adyen-payment/android/src/main/AndroidManifest.xml b/node_modules/react-native-adyen-payment/android/src/main/AndroidManifest.xml
index c641dca..e2a4178 100644
--- a/node_modules/react-native-adyen-payment/android/src/main/AndroidManifest.xml
+++ b/node_modules/react-native-adyen-payment/android/src/main/AndroidManifest.xml
@@ -5,16 +5,16 @@
        <activity
             android:name=".ui.AdyenComponentActivity"
             android:launchMode="singleTask"
-            android:theme="@style/AdyenCheckout.Translucent">
+            android:theme="@style/AdyenCheckout.Translucent"
+            android:exported="false">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />

                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />

-
                 <data
-                    android:host="${applicationId}"
+                    android:host="adyen.com.sparks"
                     android:scheme="${checkoutRedirectScheme}" />
             </intent-filter>
         </activity>
@@ -24,6 +24,8 @@
         <service
             android:name=".AdyenComponentService"
             android:permission="android.permission.BIND_JOB_SERVICE" />
-    </application>

+        <activity android:name="com.adyen.checkout.dropin.ui.DropInActivity" android:exported="true" />
+        <receiver android:name="com.adyen.threeds2.internal.AppUpgradeBroadcastReceiver" android:exported="false" />
+    </application>
 </manifest>

The key is to add the android:exported flags and to remove center (which is down for some days now). You'll need to add the jars for wechat-sdk and paranoid-core in android/app/libs as well.

ChielBruin commented 2 years ago

I agree that we should update the SDK (especially with all the jCenter outages recently). Sadly, I do not have much time to spend on this. But I might be able to spend some time testing the new version (in fact, that is a good excuse to finally move from my fork to using the actual repo again now that the fixes in there have been merged). I am also happy to review all the Android code changes.

FYI: @mkharibalaji Is not very active anymore in this repository (only for the occasional merge/release after some poking). @mickadoua @Gp2mv3 and me have been the most active users in this repo over the last couple of months, I think.

ChielBruin commented 1 year ago

FYI: Adyen is working on their own version of this library https://github.com/Adyen/adyen-react-native It is currently not finished enough for our usecase, but we'll keep an eye on it.