Skip to content
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

[POS] Custom Payment UI — Part 3 | Emitting UI–agnostic payment states in CardReaderPaymentController #12877

Merged
merged 26 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8829f5a
Introduce `CardReaderPaymentState` model emitted by `CardReaderPaymen…
samiuelson Nov 5, 2024
a22d662
Introduce `CardReaderPaymentState` model
samiuelson Nov 6, 2024
95eba27
Map payment flow error to `PaymentFailed` state
samiuelson Nov 6, 2024
df1cf58
Emit `FetchingOrderFailed` state as `paymentState`
samiuelson Nov 6, 2024
d174491
Emit `LoadingData` state as `paymentState`
samiuelson Nov 6, 2024
f2f688f
Emit `CollectingPayment` state as `paymentState`
samiuelson Nov 6, 2024
8190ba7
Emit `ProcessingPayment` state as `paymentState`
samiuelson Nov 6, 2024
cc752b0
Emit `CapturingPayment` state as `paymentState`
samiuelson Nov 6, 2024
873479f
Fix detekt's issues
samiuelson Nov 6, 2024
899eb1d
Emit `ReFetchingOrder` as `paymentState`
samiuelson Nov 7, 2024
ee5ece5
Emit `SharingReceipt` as `paymentState`
samiuelson Nov 7, 2024
051aa78
Emit `PrintingReceipt` as `paymentState`
samiuelson Nov 7, 2024
0f5b68b
Emit `PaymentSuccessful` as `paymentState`
samiuelson Nov 7, 2024
677ed80
Emit remaining states as `paymentState`
samiuelson Nov 7, 2024
bc36059
Format code
samiuelson Nov 7, 2024
c2a4599
Clean up code
samiuelson Nov 7, 2024
76e5f9d
Fix detekt's complaints
samiuelson Nov 8, 2024
152d9e0
Update sut instances in unit test
samiuelson Nov 8, 2024
a3ea1d8
Revert interac tracking code
samiuelson Nov 8, 2024
980d649
Add `onCancel` prop to `CollectingInteracRefund`
samiuelson Nov 12, 2024
d3577a2
Merge branch 'custom-payment-ui-2' into custom-payment-ui-3
samiuelson Nov 13, 2024
c26ed71
Extract `nameForTracking` from the state model
samiuelson Nov 14, 2024
7fe2991
Fix tracking logic – add missing names
samiuelson Nov 14, 2024
44115aa
Extract `::trackCancelledFlow` into use case class
samiuelson Nov 14, 2024
f756819
Merge branch 'custom-payment-ui-2' into custom-payment-ui-3
samiuelson Nov 15, 2024
0c4e9ec
Rename `CardReaderTrackCanceledFlow` -> `CardReaderTrackCanceledFlowA…
samiuelson Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.woocommerce.android.ui.payments.cardreader.CardReaderCountryConfigPro
import com.woocommerce.android.ui.payments.cardreader.onboarding.CardReaderOnboardingChecker
import com.woocommerce.android.ui.payments.cardreader.payment.controller.CardReaderPaymentController
import com.woocommerce.android.ui.payments.cardreader.payment.controller.CardReaderPaymentEvent
import com.woocommerce.android.ui.payments.cardreader.payment.controller.CardReaderPaymentStateProvider
import com.woocommerce.android.ui.payments.receipt.PaymentReceiptHelper
import com.woocommerce.android.ui.payments.receipt.PaymentReceiptShare
import com.woocommerce.android.ui.payments.tracking.CardReaderTrackingInfoKeeper
Expand Down Expand Up @@ -48,6 +49,7 @@ class CardReaderPaymentViewModel @Inject constructor(
dispatchers: CoroutineDispatchers,
cardReaderTrackingInfoKeeper: CardReaderTrackingInfoKeeper,
cardReaderPaymentReaderTypeStateProvider: CardReaderPaymentReaderTypeStateProvider,
paymentStateProvider: CardReaderPaymentStateProvider,
cardReaderPaymentOrderHelper: CardReaderPaymentOrderHelper,
paymentReceiptHelper: PaymentReceiptHelper,
cardReaderOnboardingChecker: CardReaderOnboardingChecker,
Expand Down Expand Up @@ -78,6 +80,7 @@ class CardReaderPaymentViewModel @Inject constructor(
dispatchers = dispatchers,
cardReaderTrackingInfoKeeper = cardReaderTrackingInfoKeeper,
cardReaderPaymentReaderTypeStateProvider = cardReaderPaymentReaderTypeStateProvider,
paymentStateProvider = paymentStateProvider,
cardReaderPaymentOrderHelper = cardReaderPaymentOrderHelper,
paymentReceiptHelper = paymentReceiptHelper,
cardReaderOnboardingChecker = cardReaderOnboardingChecker,
Expand All @@ -89,6 +92,7 @@ class CardReaderPaymentViewModel @Inject constructor(
onTTPPaymentStateChanged = { isTTPPaymentInProgress = it }
)

@Suppress("DEPRECATION")
val viewStateData: LiveData<ViewState> = paymentController.viewStateData

override val event: LiveData<MultiLiveEvent.Event> =
Expand Down
Loading
Loading