[CIAB: POS] Payment successful screen not displayed after booking cash payment#15407
[CIAB: POS] Payment successful screen not displayed after booking cash payment#15407samiuelson wants to merge 4 commits intotrunkfrom
Conversation
Extract payment success UI into a standalone navigation destination that can be reused by both card and cash payment flows.
Navigate to the shared success screen on payment success instead of showing an inline composable. Remove PaymentSuccess state, the CardPaymentSuccess composable, and onDoneClicked/onEmailReceiptClicked from the card payment ViewModel.
Navigate to the shared success screen after a successful cash payment for bookings instead of immediately navigating back.
Generated by 🚫 Danger |
There was a problem hiding this comment.
Pull request overview
Adds a dedicated POS “Payment successful” screen and routes both card and cash (Bookings) flows to it, addressing cases where the success UI wasn’t shown after completing a booking cash payment.
Changes:
- Introduces a new Payment Success destination (screen + navigation route) and wires it into the main POS graph and navigation handler.
- Updates cash/card payment ViewModels to emit a new
OpenPaymentSuccessnavigation event (and removes the old in-place card success state/UI). - Updates unit tests to assert the new navigation behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/paymentsuccess/WooPosPaymentSuccessScreen.kt |
New Compose UI for the unified payment success screen and its “Done/Email receipt” actions. |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/paymentsuccess/WooPosPaymentSuccessNavigation.kt |
New navigation route + args encoding/decoding + PaymentSuccessSource. |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/root/navigation/WooPosNavigationEvent.kt |
Adds OpenPaymentSuccess navigation event. |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/root/navigation/WooPosNavigationEventHandler.kt |
Handles OpenPaymentSuccess by navigating to the new destination. |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/root/navigation/WooPosMainFlowGraph.kt |
Registers the new paymentSuccessScreen in the graph. |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cashpayment/WooPosCashPaymentViewModel.kt |
For BOOKINGS cash success, emits OpenPaymentSuccess (instead of navigating back immediately). |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cardpayment/WooPosCardPaymentViewModel.kt |
On card payment success, emits OpenPaymentSuccess instead of transitioning to an in-screen success state. |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cardpayment/WooPosCardPaymentState.kt |
Removes the PaymentSuccess state (success is now a separate screen). |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cardpayment/WooPosCardPaymentScreen.kt |
Removes the embedded “CardPaymentSuccess” UI and related callbacks. |
WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/cashpayment/WooPosCashPaymentViewModelTest.kt |
Updates BOOKINGS success test to expect OpenPaymentSuccess. |
WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/cardpayment/WooPosCardPaymentViewModelTest.kt |
Updates/expands tests to assert OpenPaymentSuccess emission and receipt message passing. |
Comments suppressed due to low confidence (3)
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/paymentsuccess/WooPosPaymentSuccessNavigation.kt:47
navigateToPaymentSuccessScreen()always includes thereceiptSentMessagequery parameter, and whenreceiptSentMessageis null it gets replaced with an empty string. Because the param is present,navArgument(... defaultValue = null, nullable = true)won’t apply and the screen receives""instead ofnull, which can break the intended semantics. Consider building the route so the query parameter is omitted entirely whenreceiptSentMessage == null(or using a sentinel value and mapping it back to null).
val route = PAYMENT_SUCCESS_ROUTE
.replace("{$PAYMENT_SUCCESS_ORDER_ID_KEY}", orderId.toString())
.replace("{$PAYMENT_SUCCESS_ORDER_TOTAL_TEXT_KEY}", orderTotalText.encodeForRoute())
.replace("{$PAYMENT_SUCCESS_SOURCE_KEY}", source.name)
.replace(
"{$PAYMENT_SUCCESS_RECEIPT_SENT_MESSAGE_KEY}",
receiptSentMessage?.encodeForRoute().orEmpty()
)
navigateOnce(route)
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/paymentsuccess/WooPosPaymentSuccessScreen.kt:74
- The Email Receipt button now only emits
OpenEmailReceipt(orderId)and no longer tracks theEmailReceiptTappedanalytics event (previously tracked fromWooPosCardPaymentViewModel.onEmailReceiptClicked()). If this metric is still needed, consider adding analytics tracking back in this flow (e.g., via a small PaymentSuccess ViewModel, or by plumbing a callback that tracks before emitting the navigation event).
}
},
onEmailReceiptClicked = {
onNavigationEvent(WooPosNavigationEvent.OpenEmailReceipt(orderId))
},
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cashpayment/WooPosCashPaymentViewModel.kt:146
- In the BOOKINGS success path you fetch the order again via
repository.getOrderById(orderId)just to buildorderTotalText, even though the ViewModel already has the total instateBeforeCompleting.total. This adds an extra IO call and introduces an avoidable null fallback; consider using the existing state value to format the success text instead of reloading the order.
CashPaymentSource.BOOKINGS -> {
val order = repository.getOrderById(orderId)
val orderTotalText = if (order != null) {
resourceProvider.getString(
R.string.woopos_totals_success_payment_cash,
priceFormat(order.total)
)
} else {
resourceProvider.getString(R.string.woopos_payment_successful_label)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…-screen-not-displayed-after
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #15407 +/- ##
============================================
- Coverage 39.31% 39.29% -0.03%
+ Complexity 10990 10988 -2
============================================
Files 2239 2240 +1
Lines 127647 127709 +62
Branches 17832 17844 +12
============================================
- Hits 50187 50184 -3
- Misses 72331 72394 +63
- Partials 5129 5131 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

Description
Adds a dedicated POS “Payment successful” screen and routes both card and cash (Bookings) flows to it, addressing cases where the success UI wasn’t shown after completing a booking cash payment.
Changes:
Test Steps
Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.