From b6bfec841775128f34d8422598ab3a795f8e5483 Mon Sep 17 00:00:00 2001 From: charliecruzan-stripe <97612659+charliecruzan-stripe@users.noreply.github.com> Date: Wed, 9 Feb 2022 09:28:57 -0500 Subject: [PATCH] chore: upgrade native stripe libraries (#801) * fix: upgrade underlying native stripe libraries * chore: pod install * chore: support android 12 in example * fix: some breaking upgrade changes, add back test,rm unused gradle props * chore: changelog --- CHANGELOG.md | 2 ++ android/build.gradle | 4 +-- android/gradle.properties | 3 -- .../java/com/reactnativestripesdk/Errors.kt | 4 +-- .../reactnativestripesdk/StripeSdkCardView.kt | 1 + e2e/paymentsWithRedirects.test.ts | 18 +++++------ .../android/app/src/main/AndroidManifest.xml | 3 +- example/android/build.gradle | 4 +-- example/ios/Podfile.lock | 30 +++++++++---------- stripe-react-native.podspec | 28 ++++++++--------- 10 files changed, 48 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 416d93ff5..832a736f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # CHANGELOG +- Upgraded `stripe-ios` to v21.11.1. Upgraded `stripe-android` to v19.1.+. Added Android 12 support to example. + ## Unreleased - [#774](https://github.com/stripe/stripe-react-native/pull/774) feat: Add `currencyCode` support to `initPaymentSheet` for Google Pay & Setup Intents diff --git a/android/build.gradle b/android/build.gradle index 7b4ac6a11..2e8d6592f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -132,9 +132,9 @@ dependencies { api 'com.facebook.react:react-native:+' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1" - implementation 'com.stripe:stripe-android:18.1.+' + implementation 'com.stripe:stripe-android:19.1.+' implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0' } diff --git a/android/gradle.properties b/android/gradle.properties index 0ca7aeb24..36a2ef9f4 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1 @@ StripeSdk_kotlinVersion=1.5.10 -StripeSdk_compileSdkVersion=28 -StripeSdk_buildToolsVersion=28.0.3 -StripeSdk_targetSdkVersion=28 diff --git a/android/src/main/java/com/reactnativestripesdk/Errors.kt b/android/src/main/java/com/reactnativestripesdk/Errors.kt index 8b8229356..f0943a247 100644 --- a/android/src/main/java/com/reactnativestripesdk/Errors.kt +++ b/android/src/main/java/com/reactnativestripesdk/Errors.kt @@ -2,10 +2,10 @@ package com.reactnativestripesdk import com.facebook.react.bridge.WritableMap import com.facebook.react.bridge.WritableNativeMap -import com.stripe.android.exception.APIException +import com.stripe.android.core.exception.APIException import com.stripe.android.exception.AuthenticationException import com.stripe.android.exception.CardException -import com.stripe.android.exception.InvalidRequestException +import com.stripe.android.core.exception.InvalidRequestException import com.stripe.android.model.PaymentIntent import com.stripe.android.model.SetupIntent diff --git a/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt b/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt index 326e2e6b3..6560254f8 100644 --- a/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt +++ b/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt @@ -212,6 +212,7 @@ class StripeSdkCardView(private val context: ThemedReactContext) : FrameLayout(c override fun onCardComplete() {} override fun onExpirationComplete() {} override fun onCvcComplete() {} + override fun onPostalCodeComplete() {} override fun onFocusChange(focusField: CardInputListener.FocusField) { if (mEventDispatcher != null) { diff --git a/e2e/paymentsWithRedirects.test.ts b/e2e/paymentsWithRedirects.test.ts index 7b16bf0ae..42d7eeb4d 100644 --- a/e2e/paymentsWithRedirects.test.ts +++ b/e2e/paymentsWithRedirects.test.ts @@ -184,17 +184,17 @@ describe('Payment scenarios with redirects', () => { BasicPaymentScreen.checkStatus(); }); - // it('Alipay payment scenario', function () { - // this.retries(2); - // homeScreen.goTo('Wallets'); - // homeScreen.goTo('Alipay'); + it('Alipay payment scenario', function () { + this.retries(2); + homeScreen.goTo('Wallets'); + homeScreen.goTo('Alipay'); - // $('~payment-screen').waitForDisplayed({ timeout: 30000 }); + $('~payment-screen').waitForDisplayed({ timeout: 30000 }); - // BasicPaymentScreen.pay({ email: 'test@stripe.com' }); - // BasicPaymentScreen.authorize(); - // BasicPaymentScreen.checkStatus(); - // }); + BasicPaymentScreen.pay({ email: 'test@stripe.com' }); + BasicPaymentScreen.authorize(); + BasicPaymentScreen.checkStatus(); + }); it('Grabpay payment scenario', function () { this.retries(2); diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 3c074e618..e8e8e6581 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -19,7 +19,8 @@ android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustResize" + android:exported="true"> diff --git a/example/android/build.gradle b/example/android/build.gradle index 5d2deec4f..1b96a60de 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -4,8 +4,8 @@ buildscript { ext { buildToolsVersion = "30.0.3" minSdkVersion = 21 - compileSdkVersion = 30 - targetSdkVersion = 30 + compileSdkVersion = 31 + targetSdkVersion = 31 ndkVersion = "21.4.7075529" } repositories { diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 0452181a9..97c16b9f6 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -287,19 +287,19 @@ PODS: - RNScreens (3.10.2): - React-Core - React-RCTImage - - Stripe (21.9.1): - - Stripe/Stripe3DS2 (= 21.9.1) - - StripeCore (= 21.9.1) - - StripeUICore (= 21.9.1) + - Stripe (21.11.1): + - Stripe/Stripe3DS2 (= 21.11.1) + - StripeCore (= 21.11.1) + - StripeUICore (= 21.11.1) - stripe-react-native (0.2.3): - React-Core - - Stripe (~> 21.9.0) - - Stripe/Stripe3DS2 (21.9.1): - - StripeCore (= 21.9.1) - - StripeUICore (= 21.9.1) - - StripeCore (21.9.1) - - StripeUICore (21.9.1): - - StripeCore (= 21.9.1) + - Stripe (~> 21.11.1) + - Stripe/Stripe3DS2 (21.11.1): + - StripeCore (= 21.11.1) + - StripeUICore (= 21.11.1) + - StripeCore (21.11.1) + - StripeUICore (21.11.1): + - StripeCore (= 21.11.1) - Yoga (1.14.0) DEPENDENCIES: @@ -459,10 +459,10 @@ SPEC CHECKSUMS: RNCMaskedView: c298b644a10c0c142055b3ae24d83879ecb13ccd RNCPicker: cb57c823d5ce8d2d0b5dfb45ad97b737260dc59e RNScreens: d6da2b9e29cf523832c2542f47bf1287318b1868 - Stripe: 22c1b8da5ee20a1aaf40fd198160efa72e71644a - stripe-react-native: 980f3d19f52a7dc4b373c6c20d30ebd760bc39e5 - StripeCore: 91ea038ac0abbb72f11014044dfd1e5d39089714 - StripeUICore: 7edf64b24c9c178bfd97e988f2cffdbb7a7628b0 + Stripe: f2bed8369154c35c8ec794704e042e05240d6f21 + stripe-react-native: 6b54d3978a5599c5004f9ab286184f3c809714ea + StripeCore: 36571be19dae15e90c8ad47e1af45712aea93f5a + StripeUICore: 1b32566d6a69581be786609a032872b0fb5a6823 Yoga: e7dc4e71caba6472ff48ad7d234389b91dadc280 PODFILE CHECKSUM: 36578772e693cd3f5c59e5bd4fd36997ba0f865b diff --git a/stripe-react-native.podspec b/stripe-react-native.podspec index 8572ec19c..af934fd20 100644 --- a/stripe-react-native.podspec +++ b/stripe-react-native.podspec @@ -1,22 +1,20 @@ -require "json" +require 'json' -package = JSON.parse(File.read(File.join(__dir__, "package.json"))) +package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) Pod::Spec.new do |s| - s.name = "stripe-react-native" - s.version = package["version"] - s.summary = package["description"] - s.homepage = package["homepage"] - s.license = package["license"] - s.authors = package["author"] + s.name = 'stripe-react-native' + s.version = package['version'] + s.summary = package['description'] + s.homepage = package['homepage'] + s.license = package['license'] + s.authors = package['author'] - s.platforms = { :ios => "11.0" } - s.source = { :git => "https://github.com/stripe/stripe-react-native.git", :tag => "#{s.version}" } + s.platforms = { ios: '11.0' } + s.source = { git: 'https://github.com/stripe/stripe-react-native.git', tag: s.version.to_s } + s.source_files = 'ios/**/*.{h,m,mm,swift}' - s.source_files = "ios/**/*.{h,m,mm,swift}" - - - s.dependency "React-Core" - s.dependency 'Stripe', '~> 21.9.0' + s.dependency 'React-Core' + s.dependency 'Stripe', '~> 21.11.1' end