From 83ae6760ab3e366832b2d76fc0989cf4146e2ae3 Mon Sep 17 00:00:00 2001 From: jonasbark Date: Wed, 24 Jul 2024 21:18:37 +0200 Subject: [PATCH] sync with React Native 0.38.3 (#1866) --- packages/stripe_android/android/build.gradle | 2 +- .../com/reactnativestripesdk/PaymentSheetFragment.kt | 4 +++- .../pushprovisioning/PushProvisioningProxy.kt | 2 +- .../pushprovisioning/TapAndPayProxy.kt | 12 +++++------- .../ios/Classes/Stripe Sdk/CardFormView.swift | 11 ++++++++--- packages/stripe_ios/ios/stripe_ios.podspec | 2 +- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/stripe_android/android/build.gradle b/packages/stripe_android/android/build.gradle index e659240d9..cb87ff3a6 100644 --- a/packages/stripe_android/android/build.gradle +++ b/packages/stripe_android/android/build.gradle @@ -3,7 +3,7 @@ version '1.0-SNAPSHOT' buildscript { ext.kotlin_version = '1.8.0' - ext.stripe_version = '20.44.+' + ext.stripe_version = '20.48.+' repositories { google() diff --git a/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/PaymentSheetFragment.kt b/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/PaymentSheetFragment.kt index 0daffa5e4..b1c08bbe7 100644 --- a/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/PaymentSheetFragment.kt +++ b/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/PaymentSheetFragment.kt @@ -43,7 +43,7 @@ class PaymentSheetFragment( private var confirmPromise: Promise? = null private var presentPromise: Promise? = null private var paymentSheetTimedOut = false - internal val paymentSheetIntentCreationCallback = CompletableDeferred() + internal var paymentSheetIntentCreationCallback = CompletableDeferred() override fun onCreateView( inflater: LayoutInflater, @@ -148,6 +148,8 @@ class PaymentSheetFragment( stripeSdkModule.sendEvent(context, "onConfirmHandlerCallback", params) val resultFromJavascript = paymentSheetIntentCreationCallback.await() + // reset the completable + paymentSheetIntentCreationCallback = CompletableDeferred() return@CreateIntentCallback resultFromJavascript.getString("clientSecret")?.let { CreateIntentResult.Success(clientSecret = it) diff --git a/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt b/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt index fba107d46..4cf63ffe6 100644 --- a/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +++ b/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt @@ -65,7 +65,7 @@ object PushProvisioningProxy { ) } } catch (e: Exception) { - Log.e(TAG, "PushProvisioning dependency not found") + Log.e(TAG, "There was a problem using Stripe Android PushProvisioning: " + e.message) } } diff --git a/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt b/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt index 4e31f3ec5..7ed5cd41a 100644 --- a/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +++ b/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt @@ -28,7 +28,7 @@ object TapAndPayProxy { listTokensMethod.invoke(client) as Task> } catch (e: Exception) { - Log.e(TAG, "Google TapAndPay dependency not found") + Log.e(TAG, "There was a problem listing tokens with Google TapAndPay: " + e.message) null } } @@ -39,7 +39,7 @@ object TapAndPayProxy { val existingFpanLastFour = getFpanLastFourMethod.invoke(token) as String existingFpanLastFour == newLastFour } catch (e: Exception) { - Log.e(TAG, "There was a problem finding the class com.google.android.gms.tapandpay.issuer.TokenInfo. Make sure you've included Google's TapAndPay dependency.") + Log.e(TAG, "There was a problem getting the FPAN with Google TapAndPay: " + e.message) false } } @@ -79,7 +79,7 @@ object TapAndPayProxy { token.getInt("network"), REQUEST_CODE_TOKENIZE) } catch (e: Exception) { - Log.e(TAG, "Google TapAndPay dependency not found.") + Log.e(TAG, "There was a problem tokenizing with Google TapAndPay: " + e.message) } } @@ -114,8 +114,7 @@ object TapAndPayProxy { "serviceProvider", tokenInfoClass.getMethod("getTokenServiceProvider").invoke(it) as Int) } catch (e: Exception) { - Log.e(TAG, - "There was a problem finding the class com.google.android.gms.tapandpay.issuer.TokenInfo. Make sure you've included Google's TapAndPay dependency.") + Log.e(TAG, "There was a problem mapping the token information with Google TapAndPay: " + e.message) } } return result @@ -134,8 +133,7 @@ object TapAndPayProxy { else -> "UNKNOWN" } } catch (e: Exception) { - Log.e(TAG, - "There was a problem finding Google's TapAndPay dependency.") + Log.e(TAG, "There was a problem mapping the token state with Google TapAndPay: " + e.message) return "UNKNOWN" } } diff --git a/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift b/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift index 49cff21ea..dad81a68e 100644 --- a/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift +++ b/packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift @@ -13,9 +13,7 @@ class CardFormView: UIView, STPCardFormViewDelegate { @objc var disabled: Bool = false @objc var preferredNetworks: Array? { didSet { - if let preferredNetworks = preferredNetworks { - cardForm?.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 } - } + setPreferredNetworks() } } @@ -36,6 +34,7 @@ class CardFormView: UIView, STPCardFormViewDelegate { self.cardForm = _cardForm self.addSubview(_cardForm) setStyles() + setPreferredNetworks() } @objc var cardStyle: NSDictionary = NSDictionary() { @@ -107,6 +106,12 @@ class CardFormView: UIView, STPCardFormViewDelegate { // } } + func setPreferredNetworks() { + if let preferredNetworks = preferredNetworks { + cardForm?.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 } + } + } + override init(frame: CGRect) { super.init(frame: frame) } diff --git a/packages/stripe_ios/ios/stripe_ios.podspec b/packages/stripe_ios/ios/stripe_ios.podspec index 5710284a7..e4a0eb707 100644 --- a/packages/stripe_ios/ios/stripe_ios.podspec +++ b/packages/stripe_ios/ios/stripe_ios.podspec @@ -2,7 +2,7 @@ # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. # Run `pod lib lint stripe_ios.podspec' to validate before publishing. # -stripe_version = '~> 23.27.0' +stripe_version = '~> 23.28.0' Pod::Spec.new do |s| s.name = 'stripe_ios' s.version = '0.0.1'