-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bump native sdk to v3 #544
Conversation
- add implementation 'com.facebook.soloader:soloader:0.10. 4+' to fix issue of 'couldn't find DSO to load'. - remove test menu and test items in e2e related to 'readReusableCard'.
…ve-sdk-to-v3-for-android
@@ -516,6 +518,9 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : | |||
collectSetupIntentCancelable = terminal.collectSetupIntentPaymentMethod( | |||
setupIntent, | |||
customerConsentCollected, | |||
SetupIntentConfiguration.Builder() | |||
.setEnableCustomerCancellation(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future note, would be nice to allow developers to configure this value for payment intents/setup intents/refunds. Definitely doesn't have to be done in this PR, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, got it~
terminal.createPaymentIntent(intentParams.build(), RNPaymentIntentCallback(promise) { | ||
paymentIntents[it.id] = it | ||
terminal.createPaymentIntent(intentParams.build(), RNPaymentIntentCallback(promise) { pi -> | ||
pi.id?.let { paymentIntents[it] = pi } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think as long as we're not yet supporting offline mode in React Native, it's okay to simply require that the id exists and crash if it doesn't:
pi.id?.let { paymentIntents[it] = pi } | |
paymentIntents[it.id!!] = it |
alternatively you could fall back to the offline mode id as well, if it exists:
pi.id?.let { paymentIntents[it] = pi } | |
(pi.id ?: pi.offlineDetails?.id)?.let { paymentIntents[it] = pi } |
(this would apply to all the other places we're doing pi.id?.let { ... }
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, let me optimize it, thanks a lot.
@@ -258,6 +258,7 @@ dependencies { | |||
implementation fileTree(dir: "libs", include: ["*.jar"]) | |||
//noinspection GradleDynamicVersion | |||
implementation "com.facebook.react:react-native:+" // From node_modules | |||
implementation 'com.facebook.soloader:soloader:0.10.4+' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this new dependency for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's added for solving this issue which also happened in our case of running "e2e:test:build:release"
test, where the app would crash on the beginning with error "java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to use a strict version instead of a dynamic one? I think using 0.10.4+
means it will just pick up the latest 0.10.*
version, which currently is 0.10.5
:
implementation 'com.facebook.soloader:soloader:0.10.4+' | |
implementation 'com.facebook.soloader:soloader:0.10.5' |
…stripe/stripe-terminal-react-native into bbpos/bump-native-sdk-to-v3-for-android
ios/StripeTerminalReactNative.swift
Outdated
Terminal.shared.createPaymentIntent(paymentIntentParams) { pi, error in | ||
if let error = error as NSError? { | ||
resolve(Errors.createError(nsError: error)) | ||
} else if let pi = pi { | ||
let paymentIntent = Mappers.mapFromPaymentIntent(pi) | ||
self.paymentIntents[pi.stripeId] = pi | ||
resolve(["paymentIntent": paymentIntent]) | ||
resolve(["paymentIntent": paymentIntent]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the whitespace here intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix it
thanks for the sdk changes! we also need to update the files in the src directory to rename process calls to confirm, remove readReusableCard, update types etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 filed some feedback on the iOS side. Mostly just updating from try? to a do/catch so we can provide the error in the resolves
ios/StripeTerminalReactNative.swift
Outdated
let connectionConfig: LocalMobileConnectionConfiguration | ||
do { | ||
connectionConfig = try LocalMobileConnectionConfigurationBuilder(locationId: locationId ?? selectedReader.locationId ?? "") | ||
.setMerchantDisplayName(nil) // use the location name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should support users passing a merchant display name. there is also a tosAcceptancePermitted field we should add
cc @bric-stripe
…while using ConnectLocalMobileReader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One or two comments for the Android changes, but overall looks good 👍
context.registerComponentCallbacks( | ||
object : ComponentCallbacks2 { | ||
override fun onTrimMemory(level: Int) { | ||
onTrimMemory(context.applicationContext as Application, level) | ||
} | ||
|
||
override fun onTrimMemory(level: Int) {} | ||
override fun onLowMemory() {} | ||
override fun onConfigurationChanged(p0: Configuration) {} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you can delete this entire init { ... }
block now since we're not actually doing anything with these ComponentCallbacks2
.
@@ -258,6 +258,7 @@ dependencies { | |||
implementation fileTree(dir: "libs", include: ["*.jar"]) | |||
//noinspection GradleDynamicVersion | |||
implementation "com.facebook.react:react-native:+" // From node_modules | |||
implementation 'com.facebook.soloader:soloader:0.10.4+' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to use a strict version instead of a dynamic one? I think using 0.10.4+
means it will just pick up the latest 0.10.*
version, which currently is 0.10.5
:
implementation 'com.facebook.soloader:soloader:0.10.4+' | |
implementation 'com.facebook.soloader:soloader:0.10.5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS changes look good, thanks for all the updates!
Only open item I'm aware of is sorting out the nullable stripe id concern. I'm OK if we want to merge this as-is and fix that up in a separate PR or do it in this PR.
@@ -169,7 +174,85 @@ extension ErrorCode.Code { | |||
return "ReaderConnectionConfigurationInvalid" | |||
case .bluetoothReconnectStarted: | |||
return "BluetoothReconnectStarted" | |||
default: | |||
case .accountIdMismatchWhileForwarding: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, this was a lot more than I expected. Thanks for adding all these! 🙏
let config: DiscoveryConfiguration | ||
do { | ||
config = try Mappers.mapToDiscoveryConfiguration(discoveryMethod, simulated: simulated ?? false) | ||
} catch { | ||
resolve(Errors.createError(nsError: error as NSError)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks for updating all these
Summary
bump native sdk to v3
Motivation
Update the native SDKs to 3.0.
Testing
Documentation
Select one: