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 40da8f0109e..f75c8828d55 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/res/values/strings.xml b/WooCommerce/src/main/res/values/strings.xml index 4b2aae8fc2e..3c758351c99 100644 --- a/WooCommerce/src/main/res/values/strings.xml +++ b/WooCommerce/src/main/res/values/strings.xml @@ -4346,7 +4346,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 5a2071ed68d..90489b91145 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 @@ -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))