diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModel.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModel.kt index 40da8f0109eb..f75c8828d550 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModel.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModel.kt @@ -292,13 +292,13 @@ class WooPosTotalsViewModel @Inject constructor( viewModelScope.launch { cardReaderPaymentController?.paymentState?.collect { paymentState -> when (paymentState) { - is CardReaderPaymentState.CollectingPayment -> handleCollectingPaymentState() + is CardReaderPaymentState.CollectingPayment -> handleCollectingPaymentState(paymentState) is CardReaderPaymentState.LoadingData -> handleReaderLoadingPaymentState() is CardReaderPaymentState.ProcessingPayment, is CardReaderPaymentState.PaymentCapturing -> { - uiState.value = buildPaymentInProgressState(paymentState) + uiState.value = buildPaymentInProgressState() childrenToParentEventSender.sendToParent(ChildToParentEvent.PaymentInProgress) } @@ -324,13 +324,15 @@ class WooPosTotalsViewModel @Inject constructor( } } - private suspend fun handleCollectingPaymentState() { + private suspend fun handleCollectingPaymentState(paymentState: CardReaderPaymentState.CollectingPayment) { val totalsState = uiState.value if (totalsState is WooPosTotalsViewState.Totals) { uiState.value = totalsState.copy( readerStatus = WooPosTotalsViewState.ReaderStatus.ReadyForPayment( title = resourceProvider.getString(R.string.woopos_totals_reader_ready_for_payment_title), - subtitle = resourceProvider.getString(R.string.woopos_totals_reader_ready_for_payment_subtitle) + subtitle = resourceProvider.getString( + paymentState.cardReaderHint ?: R.string.woopos_totals_reader_ready_for_payment_subtitle + ) ) ) } else { @@ -378,16 +380,12 @@ class WooPosTotalsViewModel @Inject constructor( ) } - private fun buildPaymentInProgressState(paymentState: CardReaderPaymentOrRefundState): PaymentInProgress { - val subtitle = when (paymentState) { - is CardReaderPaymentState.ProcessingPayment -> R.string.woo_pos_payment_remove_card - else -> R.string.woopos_success_totals_payment_processing_subtitle - } + private fun buildPaymentInProgressState(): PaymentInProgress { return PaymentInProgress( title = resourceProvider.getString( R.string.woopos_success_totals_payment_processing_title ), - subtitle = resourceProvider.getString(subtitle) + subtitle = resourceProvider.getString(R.string.woopos_success_totals_payment_processing_subtitle) ) } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/payment/inprogress/WooPosTotalsPaymentInProgressScreen.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/payment/inprogress/WooPosTotalsPaymentInProgressScreen.kt index cf28ea96991f..2add10026b35 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/payment/inprogress/WooPosTotalsPaymentInProgressScreen.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/payment/inprogress/WooPosTotalsPaymentInProgressScreen.kt @@ -81,7 +81,7 @@ fun WooPosPaymentInProgressScreen( style = MaterialTheme.typography.h6, fontWeight = FontWeight.Normal, ) - Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding())) + Spacer(modifier = Modifier.height(8.dp.toAdaptivePadding())) Text( text = state.subtitle, color = WooPosTheme.colors.paymentProcessingText, diff --git a/WooCommerce/src/main/res/values/strings.xml b/WooCommerce/src/main/res/values/strings.xml index 0a3978730ec9..7cd739309dda 100644 --- a/WooCommerce/src/main/res/values/strings.xml +++ b/WooCommerce/src/main/res/values/strings.xml @@ -4350,7 +4350,6 @@ Try another payment method Try payment again Go back to checkout - Remove card Dimmed background. Tap to close the menu. Card reader connected diff --git a/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModelTest.kt b/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModelTest.kt index 5a2071ed68dc..b3c13bd998ac 100644 --- a/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModelTest.kt +++ b/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModelTest.kt @@ -861,7 +861,7 @@ class WooPosTotalsViewModelTest { assertThat(processingState).isInstanceOf(WooPosTotalsViewState.PaymentInProgress::class.java) with(processingState) { assertThat(title).isEqualTo("Processing payment") - assertThat(subtitle).isEqualTo("Remove card") + assertThat(subtitle).isEqualTo("Please wait…") } } @@ -1180,8 +1180,6 @@ class WooPosTotalsViewModelTest { .thenReturn("Ready for payment") whenever(resourceProvider.getString(R.string.woopos_totals_reader_ready_for_payment_subtitle)) .thenReturn("Tap, swipe or insert card") - whenever(resourceProvider.getString(R.string.woo_pos_payment_remove_card)) - .thenReturn("Remove card") whenever(resourceProvider.getString(R.string.woopos_no_internet_message)) .thenReturn("No internet") whenever(resourceProvider.getString(R.string.woopos_success_totals_payment_failed_title))