Skip to content

Commit 7134b2b

Browse files
authored
Merge pull request #7504 from woocommerce/issue/7502-skip-button-on-pending-requirements-onboarding-step
[Mobile Payments] Skip button on pending requirements onboarding step
2 parents c4d14ef + 4150686 commit 7134b2b

File tree

5 files changed

+43
-18
lines changed

5 files changed

+43
-18
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [**] In-Person Payments and Simple Payments have been moved to a new Payments section [https://github.com/woocommerce/woocommerce-ios/pull/7473]
77
- [*] Login: on the WP.com password screen, the magic link login option is moved from below "Reset your password" to below the primary Continue button for higher visibility. [https://github.com/woocommerce/woocommerce-ios/pull/7469]
88
- [*] Login: some minor enhancements are made to the error screen after entering an invalid WP.com email - a new "What is WordPress.com?" link, hiding the "Log in with store address" button when it's from the store address login flow, and some copy changes. [https://github.com/woocommerce/woocommerce-ios/pull/7485]
9+
- [**] In-Person Payments: Accounts with pending requirements are no longer blocked from taking payments - we have added a skip button to the relevant screen. [https://github.com/woocommerce/woocommerce-ios/pull/7504]
910

1011
9.9
1112
-----

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/CardPresentPaymentsOnboardingUseCase.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ final class CardPresentPaymentsOnboardingUseCase: CardPresentPaymentsOnboardingU
3636
private let cardPresentPluginsDataProvider: CardPresentPluginsDataProvider
3737
private var preferredPluginLocal: CardPresentPaymentsPlugin?
3838
private var wasCodStepSkipped: Bool = false
39+
private var pendingRequirementsStepSkipped: Bool = false
3940

4041
@Published var state: CardPresentPaymentOnboardingState = .loading
4142

@@ -64,6 +65,11 @@ final class CardPresentPaymentsOnboardingUseCase: CardPresentPaymentsOnboardingU
6465
refreshOnboardingState()
6566
}
6667

68+
func skipPendingRequirements() {
69+
pendingRequirementsStepSkipped = true
70+
refresh()
71+
}
72+
6773
func forceRefresh() {
6874
state = .loading
6975
refreshOnboardingState()
@@ -298,7 +304,7 @@ private extension CardPresentPaymentsOnboardingUseCase {
298304
guard !isStripeAccountOverdueRequirements(account: account) else {
299305
return .stripeAccountOverdueRequirement(plugin: plugin)
300306
}
301-
guard !isStripeAccountPendingRequirements(account: account) else {
307+
guard !shouldShowPendingRequirements(account: account) else {
302308
return .stripeAccountPendingRequirement(plugin: plugin, deadline: account.currentDeadline)
303309
}
304310
guard !isStripeAccountRejected(account: account) else {
@@ -317,6 +323,8 @@ private extension CardPresentPaymentsOnboardingUseCase {
317323
let setAccount = CardPresentPaymentAction.use(paymentGatewayAccount: account)
318324
stores.dispatch(setAccount)
319325

326+
// Also reset the skipped pending requirements step, so that it can be shown again in the next flow
327+
pendingRequirementsStepSkipped = false
320328
return .completed(plugin: CardPresentPaymentsPluginState(plugin: plugin))
321329
}
322330

@@ -403,6 +411,10 @@ private extension CardPresentPaymentsOnboardingUseCase {
403411
|| account.wcpayStatus == .restrictedSoon
404412
}
405413

414+
func shouldShowPendingRequirements(account: PaymentGatewayAccount) -> Bool {
415+
isStripeAccountPendingRequirements(account: account) && !pendingRequirementsStepSkipped
416+
}
417+
406418
func isStripeAccountOverdueRequirements(account: PaymentGatewayAccount) -> Bool {
407419
account.wcpayStatus == .restricted && account.hasOverdueRequirements
408420
}

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/InPersonPaymentsViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct InPersonPaymentsView: View {
7171
case .stripeAccountOverdueRequirement:
7272
InPersonPaymentsStripeAccountOverdue()
7373
case .stripeAccountPendingRequirement(_, let deadline):
74-
InPersonPaymentsStripeAccountPending(deadline: deadline)
74+
InPersonPaymentsStripeAccountPending(deadline: deadline, onSkip: viewModel.skipPendingRequirements)
7575
case .stripeAccountUnderReview:
7676
InPersonPaymentsStripeAccountReview()
7777
case .stripeAccountRejected:

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/InPersonPaymentsViewModel.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ final class InPersonPaymentsViewModel: ObservableObject {
5858
useCase.refresh()
5959
}
6060

61+
/// Skips the Pending Requirements step when the user taps `Skip`
62+
///
63+
func skipPendingRequirements() {
64+
useCase.skipPendingRequirements()
65+
}
66+
6167
/// Selects the plugin to use as a payment gateway when there are multiple available
6268
///
6369
func selectPlugin(_ plugin: CardPresentPaymentsPlugin) {

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/Onboarding Errors/InPersonPaymentsStripeAccountPendingView.swift

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@ import SwiftUI
22

33
struct InPersonPaymentsStripeAccountPending: View {
44
let deadline: Date?
5+
let onSkip: () -> ()
56

67
var body: some View {
78
InPersonPaymentsOnboardingError(
89
title: Localization.title,
910
message: message,
1011
image: InPersonPaymentsOnboardingErrorMainContentView.ImageInfo(
1112
image: .paymentErrorImage,
12-
height: 180.0
13+
height: Constants.imageHeight
1314
),
1415
supportLink: true,
15-
learnMore: true
16+
learnMore: true,
17+
button: InPersonPaymentsOnboardingError.ButtonInfo(
18+
text: Localization.skipButton,
19+
action: onSkip
20+
)
1621
)
17-
}
22+
}
1823

1924
private var message: String {
2025
guard let deadline = deadline else {
@@ -28,31 +33,32 @@ struct InPersonPaymentsStripeAccountPending: View {
2833
private enum Localization {
2934
static let title = NSLocalizedString(
3035
"Your payments account has pending requirements",
31-
comment: "Title for the error screen when the merchant's In-Person Payments account is restricted because there are pending requirements"
36+
comment: "Title for the error screen when the merchant's In-Person Payments account has pending " +
37+
"requirements which will result in their account being restricted if not resolved by a deadline"
3238
)
3339

3440
static let messageDeadline = NSLocalizedString(
3541
"There are pending requirements for your account. Please complete those requirements by %1$@ to keep accepting In-Person Payments.",
36-
comment: "Error message when In-Person Payments is not supported because there are pending requirements in the merchant's payment account."
37-
+
38-
"%1$d will contain the localized deadline (e.g. August 11, 2021)"
42+
comment: "Error message when because there are pending requirements in the merchant's " +
43+
"In-Person Payments account. %1$d will contain the localized deadline (e.g. August 11, 2021)"
3944
)
4045

4146
static let messageUnknownDeadline = NSLocalizedString(
4247
"There are pending requirements for your account. Please complete those requirements to keep accepting In-Person Payments.",
43-
comment: "Error message when In-Person Payments is not supported"
44-
+
45-
"There are pending requirements in the merchant's payment account (without a known deadline)"
48+
comment: "Error message when there are pending requirements in the merchant's payment account (without a known deadline)"
4649
)
4750

48-
static let message = NSLocalizedString(
49-
"There are pending requirements for your account. Please complete those requirements by",
50-
comment: "Error message when the Stripe account is restricted because there are pending requirements"
51-
)
52-
}
51+
static let skipButton = NSLocalizedString(
52+
"Skip",
53+
comment: "Title for the button to skip the onboarding step informing the merchant of pending account requirements")
54+
}
5355

5456
struct InPersonPaymentsStripeAccountPending_Previews: PreviewProvider {
5557
static var previews: some View {
56-
InPersonPaymentsStripeAccountPending(deadline: Date())
58+
InPersonPaymentsStripeAccountPending(deadline: Date(), onSkip: {})
5759
}
5860
}
61+
62+
private enum Constants {
63+
static let imageHeight: CGFloat = 180.0
64+
}

0 commit comments

Comments
 (0)