From c51eb3bb4ab2c9238a99cab9c2cf893251cd124d Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Fri, 22 Dec 2023 09:48:34 +0000 Subject: [PATCH] RMET-2993 Payments Plugin - Fix dependencies and update code accordingly (#31) * fix: update dependencies and update code accordingly Context: When using the Payments plugin in an app containing another plugin, if that other plugin was already pointing to more recent versions of oscore-android and oscordova-android, the build would fail because those more recent versions would be used, and the code in OSPayments.kt wasn't compatible with them. References: https://outsystemsrd.atlassian.net/browse/RMET-2993 * chore: update changelog References: https://outsystemsrd.atlassian.net/browse/RMET-2993 --- CHANGELOG.md | 3 +++ .../com/outsystems/payments/OSPayments.kt | 18 ++++++++++-------- .../com/outsystems/payments/build.gradle | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1e7cb6..5fefb1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ The changes documented here do not include those from the original repository. ## [Unreleased] +### 21-12-2023 +- Fix: [Android] Updates dependency to OSCore and OSCordova (https://outsystemsrd.atlassian.net/browse/RMET-2993). + ### 03-10-2023 - Fix: [iOS] Fixes path, removing duplicate string (https://outsystemsrd.atlassian.net/browse/RMET-2855). diff --git a/src/android/com/outsystems/payments/OSPayments.kt b/src/android/com/outsystems/payments/OSPayments.kt index a4a812d..bb83904 100644 --- a/src/android/com/outsystems/payments/OSPayments.kt +++ b/src/android/com/outsystems/payments/OSPayments.kt @@ -107,15 +107,17 @@ class OSPayments : CordovaImplementation() { } } - override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent) { + override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) { super.onActivityResult(requestCode, resultCode, intent) - paymentsController.handleActivityResult(requestCode, resultCode, intent, - { paymentResponse -> - sendPluginResult(paymentResponse, null) - }, - { error -> - sendPluginResult(null, Pair(formatErrorCode(error.code), error.description)) - }) + if (intent != null) { + paymentsController.handleActivityResult(requestCode, resultCode, intent, + { paymentResponse -> + sendPluginResult(paymentResponse, null) + }, + { error -> + sendPluginResult(null, Pair(formatErrorCode(error.code), error.description)) + }) + } } override fun onRequestPermissionResult(requestCode: Int, diff --git a/src/android/com/outsystems/payments/build.gradle b/src/android/com/outsystems/payments/build.gradle index 38316d4..d0d6d85 100644 --- a/src/android/com/outsystems/payments/build.gradle +++ b/src/android/com/outsystems/payments/build.gradle @@ -27,8 +27,8 @@ repositories{ apply plugin: 'kotlin-kapt' dependencies { - implementation("com.github.outsystems:oscore-android:1.1.0@aar") - implementation("com.github.outsystems:oscordova-android:1.1.0@aar") + implementation("com.github.outsystems:oscore-android:1.2.0@aar") + implementation("com.github.outsystems:oscordova-android:2.0.0@aar") implementation("com.github.outsystems:ospayments-android:1.1.0@aar") implementation 'com.stripe:stripe-android:20.5.0'