woocommerce-ios
woocommerce-ios copied to clipboard
[Mobile Payments] Onboarding can complete with `restricted` and `pending_requirements`
🕐 I'm still waiting to confirm the second part, I now have "has pending requirements" message with account cache contents:
'has_pending_requirements' => true, 'status' => 'restricted_soon',
I'll split this part out of this PR again – it's only one commit and Jirka's asked me to investigate further anyway.
_Originally posted by @joshheald in https://github.com/woocommerce/woocommerce-ios/
issues/13610#issuecomment-2288691959_
Split from #13610
We found that after the first payment, using progressive onboarding as an individual, we were put in restricted
status with has_pending_requirements
and has_future_requirements
. This is not expected, and WooPayments folks are working on a fix p1723640322815779-slack-C01BPL3ALGP
Repro
- Create a new Jurassic Ninja site – include WooCommerce, WooPayments, and WooPayments Dev Tools
- Link the site with your Jetpack user
- Add a US address in WooCommerce settings
- Activate WooPayments
- Go through the onboarding steps in WP-Admin > Payments > Activate
- Launch the app and switch to your new site
- Go to
Menu > Payments
- Tap the
Continue
button in the onboarding notice that shows - Skip the
Enable Pay in Person
alert that shows - Observe that you're not shown a generic
Unable to verify
onboarding error - Take a payment – observe that you can connect to the card reader and take payment as normal.
- Force quit the app and relaunch it, to clear the onboarding state
- Repeat steps 7-10 – Observe that you can skip an onboarding error about pending requirements, and you're then shown the generic onboarding error
Unable to verify In-Person Payments for this store
Investigation
Status restricted
with pendingRequirements: true
After verification is complete, accounts are put in to restricted
with pendingRequirements == true
. This should be flagged to the user as a skippable error, and it is... except the error isn't really skippable. When they get in this state, we're looking for restrictedSoon
to enable the payments, but blocking restricted
.
We could allow restricted
as long as the previous onboarding steps have been completed – i.e. they have skipped the pending requirements, and they don't have overdue requirements.
Onboarding code sort of handles it already...
On iOS, the existing code kinda handles it:
func isStripeAccountPendingRequirements(account: PaymentGatewayAccount) -> Bool {
account.wcpayStatus == .restricted
&& account.hasPendingRequirements
|| account.wcpayStatus == .restrictedSoon
func shouldShowPendingRequirements(account: PaymentGatewayAccount) -> Bool {
isStripeAccountPendingRequirements(account: account) && !pendingRequirementsStepSkipped
}
Which is used when deciding which onboarding step to show:
guard !isStripeAccountOverdueRequirements(account: account) else {
logMissingRequirements(for: account)
return .stripeAccountOverdueRequirement(plugin: plugin)
}
guard !shouldShowPendingRequirements(account: account) else {
logMissingRequirements(for: account)
return .stripeAccountPendingRequirement(plugin: plugin, deadline: account.currentDeadline)
}
On Android, the logic is similar except I can't see how the skip bit works, so I'm not sure whether the generic error will show or not.
Testing the restricted
with pendingRequirements: true
state
After taking a payment, check back on the web to see your account status. You can do this in WP-admin > WCPay Dev > Account cache contents
Once your account shows status: restricted
and has_pending_requirements: true
, repeat the testing. You will have to skip the Pending requirements
onboarding screen, and then should be able to take payments without being shown the generic error again.