-
Notifications
You must be signed in to change notification settings - Fork 131
[WOOMOB-302][Mobile Payments] Update Stripe's SDK to 4.3.1 #13970
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
base: trunk
Are you sure you want to change the base?
Conversation
…rns a Cancelable.
Project manifest changes for WooCommerceThe following changes in the --- ./build/reports/diff_manifest/WooCommerce/vanillaRelease/base_manifest.txt 2025-05-01 15:18:05.437596849 +0000
+++ ./build/reports/diff_manifest/WooCommerce/vanillaRelease/head_manifest.txt 2025-05-01 15:18:35.207865615 +0000
@@ -348,9 +348,14 @@
</service>
<activity
+ android:name="l7ae02aa90bfcbef3f181d5f7.l515457f9dd483c15b2b92380"
+ android:configChanges="orientation|keyboardHidden|screenSize"
+ android:process=":stripetaptopay"
+ android:theme="@style/NoDisplayCutout" />
+ <activity
android:name="com.stripe.cots.activity.ContactlessPaymentActivity"
android:exported="false"
- android:process=":stripelocalmobile"
+ android:process=":stripetaptopay"
android:theme="@style/Theme.CotsApp" >
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
@@ -361,18 +366,23 @@
<activity
android:name="com.stripe.cots.simulator.SimulatedContactlessPaymentActivity"
android:exported="false"
+ android:process=":stripetaptopay"
android:theme="@style/Theme.CotsApp" />
- <activity
- android:name="com.whitecryption.securepin.TuiActivity"
- android:configChanges="orientation|keyboardHidden|screenSize"
- android:process=":stripelocalmobile"
- android:screenOrientation="portrait"
- android:theme="@style/NoDisplayCutout" />
<service
android:name="com.stripe.cots.aidlservice.CotsService"
android:exported="false"
- android:process=":stripelocalmobile" />
+ android:process=":stripetaptopay" />
+ <service
+ android:name="com.stripe.cots.aidlservice.SimulatedCotsService"
+ android:exported="false"
+ android:process=":stripetaptopay" />
+
+ <provider
+ android:name="com.stripe.cots.content.CotsContentProvider"
+ android:authorities="com.woocommerce.android.stripetaptopay"
+ android:exported="false"
+ android:process=":stripetaptopay" />
<activity
android:name="zendesk.support.request.RequestActivity"
@@ -579,22 +589,6 @@
</provider>
<activity
- android:name="com.stripe.stripeterminal.internal.common.usb.UsbEventReceiverActivity"
- android:excludeFromRecents="true"
- android:exported="false"
- android:label="@string/app_name"
- android:noHistory="true"
- android:taskAffinity="com.stripe.stripeterminal.taskAffinityUsbEventReceiver"
- android:theme="@style/Theme.Transparent" >
- <intent-filter>
- <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
- </intent-filter>
-
- <meta-data
- android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
- android:resource="@xml/usb_device_filter" />
- </activity>
- <activity
android:name="androidx.compose.ui.tooling.PreviewActivity"
android:exported="true" />
@@ -714,6 +708,23 @@
android:exported="false"
android:initOrder="200" />
+ <activity
+ android:name="com.stripe.stripeterminal.internal.common.usb.UsbEventReceiverActivity"
+ android:excludeFromRecents="true"
+ android:exported="false"
+ android:label="@string/app_name"
+ android:noHistory="true"
+ android:taskAffinity="com.stripe.stripeterminal.taskAffinityUsbEventReceiver"
+ android:theme="@style/Theme.Transparent" >
+ <intent-filter>
+ <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
+ </intent-filter>
+
+ <meta-data
+ android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
+ android:resource="@xml/usb_device_filter" />
+ </activity>
+
<service
android:name="androidx.room.MultiInstanceInvalidationService"
android:directBootAware="true"
@@ -745,14 +756,6 @@
android:authorities="com.woocommerce.android.com.squareup.picasso"
android:exported="false" />
- <service
- android:name="com.google.android.datatransport.runtime.backends.TransportBackendDiscovery"
- android:exported="false" >
- <meta-data
- android:name="backend:com.google.android.datatransport.cct.CctBackendFactory"
- android:value="cct" />
- </service>
-
<receiver
android:name="androidx.profileinstaller.ProfileInstallReceiver"
android:directBootAware="false"
@@ -774,6 +777,13 @@
</receiver>
<service
+ android:name="com.google.android.datatransport.runtime.backends.TransportBackendDiscovery"
+ android:exported="false" >
+ <meta-data
+ android:name="backend:com.google.android.datatransport.cct.CctBackendFactory"
+ android:value="cct" />
+ </service>
+ <service
android:name="com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" > Go to https://buildkite.com/automattic/woocommerce-android/builds/28869/canvas?sid=01968c69-3236-4e7b-bab7-f41dac40c3a5, click on the |
Project dependencies changeslist+ New Dependencies
com.stripe:stripeterminal-taptopay:4.3.1
- Removed Dependencies
com.google.android.gms:play-services-safetynet:18.0.1
com.jaredrummler:android-device-names:1.1.9
com.neovisionaries:nv-i18n:1.29
com.stripe:stripeterminal-internal-models:3.7.1
com.stripe:stripeterminal-localmobile:3.7.1
! Upgraded Dependencies
androidx.annotation:annotation:1.9.1, (changed from 1.8.1)
androidx.annotation:annotation-jvm:1.9.1, (changed from 1.8.1)
com.squareup.wire:wire-moshi-adapter:4.9.11, (changed from 4.9.9)
com.squareup.wire:wire-runtime:4.9.11, (changed from 4.9.9)
com.squareup.wire:wire-runtime-jvm:4.9.11, (changed from 4.9.9)
com.stripe:stripeterminal-core:4.3.1, (changed from 3.7.1)
com.stripe:stripeterminal-external:4.3.1, (changed from 3.7.1)
com.stripe:stripeterminal-internal-common:4.3.1, (changed from 3.7.1)
io.reactivex.rxjava3:rxjava:3.1.9, (changed from 3.1.8)
org.jetbrains.kotlin:kotlin-reflect:1.9.25, (changed from 1.9.24)
org.jetbrains.kotlinx:kotlinx-datetime:0.6.1, (changed from 0.6.0)
org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.6.1, (changed from 0.6.0)
org.jetbrains.kotlinx:kotlinx-serialization-bom:1.6.3, (changed from 1.5.1)
org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3, (changed from 1.5.1)
org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.6.3, (changed from 1.5.1)
org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3, (changed from 1.5.1)
org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.3, (changed from 1.5.1) |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #13970 +/- ##
============================================
- Coverage 38.32% 38.31% -0.01%
+ Complexity 9474 9473 -1
============================================
Files 2113 2114 +1
Lines 116202 116223 +21
Branches 14869 14871 +2
============================================
Hits 44529 44529
- Misses 67613 67632 +19
- Partials 4060 4062 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 @toupper for tackling this task!
I tested the PR on physical devices, running jalapenoRelease
build variant. My observations:
✅ Tap To Pay works fine
❓ Unexpected behavior in card reader flow in store management. In case reader is disconnected, when collecting payment with card reader, during reader connection flow the "We couldn't connect your reader" error dialog is displayed for a few seconds. If I let it wait, the reader connected successfully and payment was collected.
- logs:
2025-04-28 14:12:44.868 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onConnectionStatusChange: DISCOVERING
2025-04-28 14:12:45.451 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onConnectionStatusChange: NOT_CONNECTED
2025-04-28 14:12:45.452 4018-4018 WooCommerce-CARD_READER com.woocommerce.android.prealpha E Connecting to reader failed.
2025-04-28 14:12:45.452 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onConnectionStatusChange: CONNECTING
2025-04-28 14:12:49.157 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onConnectionStatusChange: CONNECTED
2025-04-28 14:12:49.158 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onPaymentStatusChange: READY
2025-04-28 14:12:49.165 4018-4018 WooCommerce-CARD_READER com.woocommerce.android.prealpha E Connecting to reader succeeded.
2025-04-28 14:12:49.307 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onBatteryLevelUpdate: batteryStatus: NOMINAL, batteryLevel: 0.99, isCharging: true
2025-04-28 14:12:50.374 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: Creating payment intent succeeded
2025-04-28 14:12:50.389 4018-4953 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onPaymentStatusChange: WAITING_FOR_INPUT
2025-04-28 14:12:50.412 4018-5136 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onRequestReaderInput: Swipe / Insert / Tap
2025-04-28 14:12:50.793 4018-5136 WooCommerce-CARD_READER com.woocommerce.android.prealpha D CardReader: onRequestReaderInput: Swipe / Insert / Tap
☝️ Notice the onConnectionStatusChange: NOT_CONNECTED
state is emmited for some reason. I'm not sure why 🤔
- screen recording of the payment flow from this PR:
Screen_recording_20250428_133347.mp4
I verified that this is not happening on trunk
:
Screen_recording_20250428_140640.mp4
Could you check if you experience the same on your devices, @malinajirka, @kidinov and @toupper?
I checked on my phone and I can confirm the behavior - might be a bug in the SDK, so I'd definitely start by checking their change and back logs. |
@@ -104,6 +105,10 @@ internal class BluetoothReaderListenerImpl( | |||
_displayMessagesEvents.value = BluetoothCardReaderMessages.CardReaderInputMessage(options.toString()) | |||
} | |||
|
|||
override fun onDisconnect(reason: DisconnectReason) { | |||
logWrapper.d(LOG_TAG, "onDisconnect") |
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 believe we shouldn't just log it. We may need to handle it properly and share it with the user
import com.woocommerce.android.cardreader.LogWrapper | ||
import com.woocommerce.android.cardreader.internal.LOG_TAG | ||
|
||
class TapToPayReaderListenerImpl( |
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 don't think we can just log status changes. Probably we need to propagate this to the user and offer a correct explanation with further steps
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.
@kidinov Thanks for the comment! Before, we didn't even have this listener, so we didn't propagate the events to the user. As this PR issue is just to update the SDK without modifying behavior, what do you think if we leave it as it is on this PR and create an issue enhancement for propagating these events to the users and letting them to handle them?
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.
@toupper 👋
For Tap to Pay readers, the TapToPayConnectionConfiguration now takes in an TapToPayReaderListener parameter, replacing ReaderReconnectionListener.
Oh, I see. We didn't have ReaderReconnectionListener
either, as automatic reconnection was already added later!
As this PR issue is just to update the SDK without modifying behavior, what do you think if we leave it as it is on this PR and create an issue enhancement for propagating these events to the users and letting them to handle them?
Yep, updating to a major version often brings changes in behavior, beyond just the API modifications, indicating a need for adaptation on our side too. However, I’m uncertain in this case since it's unclear how the app will behave during the reconnection process and the duration it may require. Previously, we would display an error message when it was "not connected" and that was the end of it. Now, it will attempt to reconnect, but we will ignore the process and not present any information to the user.
It feels like if we don't want to actually handle the reconnection, we may need to disable it to keep the same behavior like now, and have a separate issue to handle this as you proposed
We recommend displaying notifications in your app to inform the users about the reader status throughout the reconnection process. To handle reader reconnection methods, the ReaderReconnectionListener has been inherited by the respective ReaderListeners. Use MobileReaderListener for mobile readers, and TapToPayReaderListener for Tap to Pay readers to handle reconnection events.
If you implemented your own reader reconnection logic and want to maintain this behavior, you can turn off auto reconnection by setting autoReconnectOnUnexpectedDisconnect to false.
@toupper Thank you for taking this on! I can confirm what @samiuelson noticed as well. Good news that the bugs we had with 3.10.2 with TTP on my Galaxy Ultra 24 is fixed here. Having said that we may want to setup our brand colors for TTP as it's been done here Reading the migration guide, we may need to address, if not yet:
The last one I don't remember what we do when PIN is required 🤔 |
… in the Stripe SDK docs.
…com/woocommerce/woocommerce-android into issue/WOOMOB-302-update-to-Stripe-4
Thanks for your test @samiuelson!
I fixed that on this commit fd7e278 As advised in their doc, we have to handle now unexpected disconnects on Screen_Recording_20250501_115307_Woo.Pre-Alpha.mp4 |
Thanks for your comment @kidinov! Let’s go one by one: 🔹 Brand colors for TTP 🔹 New enum value: DISCOVERING 🔹 Reader reconnection / notification recommendations 🔹 Timeout after 60s on collectPaymentMethod 🔹 Change from DECLINED_BY_STRIPE_API to FEATURE_NOT_ENABLED_ON_ACCOUNT |
Closes: WOOMOB-302
Description
With this PR we update the Stripe SDK to 4.3.1, handling the breaking changes it brings. The main changes we had to adapt are:
TerminalException.TerminalErrorCode
is moved to a standalone enumTerminalErrorCode
.TerminalListener::onUnexpectedReaderDisconnect
. We implementonDisconnect
onMobileReaderListener
,TapToPayReaderListener
listeners to be informed of their corresponding reader disconnects.TapToPayConnectionConfiguration
now requires a listener, so I implemented it (TapToPayReaderListenerImpl
). As we didn't have any related logic before, it only logs events.ReaderListener
is renamed toMobileReaderListener
Terminal::processPayment
returns now a cancelable, so we handle it.For an exhaustive list check the migration guide and changelog
Steps to reproduce
Try both IPP and TTP flows
Important: TTP with a card can be tested only on the real device in the release builds!
Testing information
See above.
The tests that have been performed
See above.
Images/gif
N/A
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: