shop: replace disabled native-payment button with pay on merchant website
- Commit
af9916e0e7176243b629bcd46c9b5460507ea116- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-01 05:51 UTC (1 month ago)
- Parents
e52539d
Diff
metadata_data/photos/shop/phone/4.png
diff --git a/metadata_data/photos/shop/phone/4.png b/metadata_data/photos/shop/phone/4.pngindex a5a543a12d..a975478f2b 100644Binary files a/metadata_data/photos/shop/phone/4.png and b/metadata_data/photos/shop/phone/4.png differ
shop/src/main/java/com/vayunmathur/shop/ui/CheckoutReviewContent.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutReviewContent.kt b/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutReviewContent.ktindex a10a223d39..04a454d42b 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutReviewContent.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutReviewContent.kt@@ -13,6 +13,7 @@ import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton import com.vayunmathur.shop.data.CheckoutInputs import com.vayunmathur.shop.data.NativeCheckoutState+import com.vayunmathur.shop.domain.MerchantUrls import com.vayunmathur.shop.domain.MoneyFormat /** Pure session presentation shared by the live checkout and deterministic screenshot fixtures. */@@ -60,8 +61,10 @@ internal fun CheckoutReviewContent( } } }- if (checkout.status == "ready_for_complete") Text("The merchant reports payment readiness. Native payment is unavailable; no completion call will be made.", style = MaterialTheme.typography.bodySmall)- Button(onClick = {}, enabled = state.completionEnabled, modifier = Modifier.fillMaxWidth()) { Text("Native payment unavailable") }+ if (checkout.status == "ready_for_complete") Text("The merchant reports payment readiness. Pay on its website to place the order.", style = MaterialTheme.typography.bodySmall)+ MerchantUrls.httpsUrl(checkout.continueUrl)?.let { payUrl ->+ Button(onClick = { onOpenUrl(payUrl) }, modifier = Modifier.fillMaxWidth()) { Text("Pay on merchant website") }+ } Text("Pending session only. Check purchase and payment status on the merchant website.", style = MaterialTheme.typography.bodySmall) checkout.review.links.forEach { link -> TextButton(onClick = { onOpenUrl(link.url) }) { Text(link.title.ifBlank { link.type }) }
shop/src/main/java/com/vayunmathur/shop/ui/CheckoutScreen.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutScreen.kt b/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutScreen.ktindex 552d912a15..d21b155b5e 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutScreen.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/CheckoutScreen.kt@@ -88,12 +88,9 @@ fun CheckoutScreen(viewModel: ShopViewModel, onBack: () -> Unit) { if (state.busy) CircularProgressIndicator() else Text(if (checkout == null) "Create review session" else "Update review session") }- val browserUrl = checkout?.continueUrl?.let(MerchantUrls::httpsUrl)- ?: MerchantUrls.domain(key.second)?.let { "https://$it" }- if (browserUrl != null) {- TextButton(onClick = { openContinueUrl(context, browserUrl) }) {- Text(if (checkout?.continueUrl?.let(MerchantUrls::httpsUrl) != null) "Continue in browser" else "Open merchant website")- }+ val merchantSiteUrl = MerchantUrls.domain(key.second)?.let { "https://$it" }+ if (checkout?.continueUrl?.let(MerchantUrls::httpsUrl) == null && merchantSiteUrl != null) {+ TextButton(onClick = { openContinueUrl(context, merchantSiteUrl) }) { Text("Open merchant website") } } } }
shop/src/screenshotTest/kotlin/com/vayunmathur/shop/ui/CheckoutMetadataPreviews.kt
diff --git a/shop/src/screenshotTest/kotlin/com/vayunmathur/shop/ui/CheckoutMetadataPreviews.kt b/shop/src/screenshotTest/kotlin/com/vayunmathur/shop/ui/CheckoutMetadataPreviews.ktindex 14dd7a9a78..510f721e17 100644--- a/shop/src/screenshotTest/kotlin/com/vayunmathur/shop/ui/CheckoutMetadataPreviews.kt+++ b/shop/src/screenshotTest/kotlin/com/vayunmathur/shop/ui/CheckoutMetadataPreviews.kt@@ -42,7 +42,7 @@ class CheckoutMetadataPreviews { checkout = UcpCheckout( checkoutId = "fixture-checkout", status = "ready_for_complete", currency = "USD", totals = UcpTotals(subtotal = totals.first().money, shipping = totals[1].money, tax = totals[2].money, total = totals.last().money),- totalEntries = totals, expiresAt = "2026-10-27T00:00:00Z",+ totalEntries = totals, expiresAt = "2026-10-27T00:00:00Z", continueUrl = "https://trail.example/checkout", review = CheckoutReview( shipping = listOf(CheckoutShippingMethod("fixture-shipping", listOf( CheckoutShippingGroup("fixture-group", "fixture-standard", listOf(