Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Oct 30, 2025

Closes WOOMOB-1610

Description

This PR adds the payments onboarding modal flow through POS settings. For this we copy the existing implementation held in PointOfSaleDashboardView.

I'll attempt to reduce the code duplication from both onboarding and card connection in the next PR, some of it is a bit tricky.

Changes

  • Adds new .posModal to the hardware detail view to handle onboarding presentation.
  • Adds new .posSheet to the hardware detail view to handle support webview presentation from onboarding.

Test Steps

  • If you don't have a store with pending requirements, or that need to be onboarded, hardcode the state by returning .stripeAccountOverdueRequirement(plugin: .wcPay) in CardPresentPaymentsOnboardingUseCase.checkOnboardingState
  • Go to POS > Settings > Hardware > Card readers > Tap Connect card reader
  • Observe the existing onboarding flow appears, and tapping dismiss, refresh, resolve now, or contact us works normally.
  • Tapping outside the modal also dismisses the onboarding flow
  • Events are logged with the pos_ decorator:
🔵 Tracked pos_card_reader_connection_tapped
🔵 Tracked pos_payments_onboarding_shown
🔵 Tracked pos_card_present_onboarding_not_completed

Not necessary to test the full flow, but just for completeness sake: Testing the onboarding is a bit annoying, as is called multiple times through the app lifecycle, the "easier way I found to sort of test from incomplete onboarding to success connection is to add a flag to CardPresentPaymentsOnboardingUseCase and wrap checkOnboardingState():

final class CardPresentPaymentsOnboardingUseCase: CardPresentPaymentsOnboardingUseCaseProtocol, ObservableObject {
+    private var foo: Bool = true

func checkOnboardingState() -> CardPresentPaymentOnboardingState {
+        if foo {
+            return .stripeAccountOverdueRequirement(plugin: .wcPay)
+        }
}

Add a breakpoint before foo and disable it, navigate to POS Settings, re-enable the breakpoint and once triggers update the value via expression foo = false which would bypass the it and continue the normal onboarding flow.

Screenshots

Onboarding flow

Screen.Recording.2025-10-30.at.15.55.45.mov

From incomplete onboarding to card reader connection

_from.onboarding.to.connection.MP4

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 30, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16293-de39d34
Version23.5
Bundle IDcom.automattic.alpha.woocommerce
Commitde39d34
Installation URL37tbk2ikctj60
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@iamgabrielma iamgabrielma added type: task An internally driven task. feature: POS labels Oct 30, 2025
@iamgabrielma iamgabrielma added this to the 23.7 milestone Oct 30, 2025
@iamgabrielma iamgabrielma marked this pull request as ready for review October 30, 2025 10:23
@joshheald joshheald self-assigned this Oct 30, 2025
Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. Another one to put in that view modifier, if it works!

Comment on lines +114 to +128
func paymentsOnboardingView(from onboardingViewContainer: CardPresentPaymentOnboardingViewContainer) -> some View {
onboardingViewContainer.configuration.showSupport = {
posModel.cancelCardPaymentsOnboarding()
showSupport = true
}

return PointOfSaleCardPresentPaymentOnboardingView(
viewModel: .init(onboardingViewContainer: onboardingViewContainer,
onDismissTap: {
posModel.cancelCardPaymentsOnboarding()
}))
.onAppear {
posModel.trackCardPaymentsOnboardingShown()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is all duplicative as well, could you take a look at including it in the cardReaderConnecting modifier when you look at that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, tracking it on WOOMOB-1621 👯

@iamgabrielma iamgabrielma modified the milestones: 23.7, 23.6 Oct 31, 2025
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 23.6. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@iamgabrielma iamgabrielma merged commit 0839e2a into trunk Oct 31, 2025
26 of 27 checks passed
@iamgabrielma iamgabrielma deleted the task/WOOMOB-1610-pos-settings-card-reader-onboarding-flow branch October 31, 2025 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants