Skip to content

Commit b622d7b

Browse files
authored
Merge pull request #5958 from woocommerce/issue/5593-generic-account-warnings
[Mobile Payments] Update logic, strings on account related onboarding views
2 parents 4fa21ed + a1a4baf commit b622d7b

File tree

12 files changed

+58
-68
lines changed

12 files changed

+58
-68
lines changed

Networking/Networking/Mapper/WCPayAccountMapper.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ struct WCPayAccountMapper: Mapper {
1414
/// can cross that bridge when we need those decoded.
1515
decoder.dateDecodingStrategy = .secondsSince1970
1616

17-
/// Detect the exceptional case where we got a response of data:[] indicating
18-
/// that the plugin is active but the merchant has not on-boarded (and therefore
19-
/// has no account.)
17+
/// Prior to WooCommerce Payments plugin version 2.9.0 (Aug 2021) `data` could contain an empty array []
18+
/// indicating that the plugin was active but the merchant had not on-boarded (and therefore has no account.)
2019
if let _ = try? decoder.decode(WCPayNullAccountEnvelope.self, from: response) {
2120
return WCPayAccount.noAccount
2221
}

Networking/Networking/Model/StripeAccount.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,6 @@ public struct StripeAccount: Decodable {
9191
}
9292
}
9393

94-
public extension StripeAccount {
95-
static let noAccount = StripeAccount(
96-
status: .noAccount,
97-
isLiveAccount: false,
98-
isInTestMode: false,
99-
hasPendingRequirements: false,
100-
hasOverdueRequirements: false,
101-
currentDeadline: nil,
102-
statementDescriptor: "",
103-
defaultCurrency: "",
104-
supportedCurrencies: [],
105-
country: "",
106-
isCardPresentEligible: false
107-
)
108-
}
109-
11094
private extension StripeAccount {
11195
enum CodingKeys: String, CodingKey {
11296
case status

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,11 @@ private extension CardPresentPaymentsOnboardingUseCase {
209209

210210
func accountChecks(plugin: CardPresentPaymentsPlugins) -> CardPresentPaymentOnboardingState {
211211
guard let account = getPaymentGatewayAccount() else {
212-
return .genericError
212+
/// Active plugin but unable to fetch an account? Prompt the merchant to finish setting it up.
213+
return .pluginSetupNotCompleted(plugin: plugin)
213214
}
214215
guard isPaymentGatewaySetupCompleted(account: account) else {
215-
return .pluginSetupNotCompleted
216+
return .pluginSetupNotCompleted(plugin: plugin)
216217
}
217218
guard !isPluginInTestModeWithLiveStripeAccount(account: account) else {
218219
return .pluginInTestModeWithLiveStripeAccount(plugin: plugin)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ struct InPersonPaymentsView: View {
4040
case .pluginInTestModeWithLiveStripeAccount(let plugin):
4141
InPersonPaymentsLiveSiteInTestMode(plugin: plugin, onRefresh:
4242
viewModel.refresh)
43-
case .pluginSetupNotCompleted:
44-
InPersonPaymentsWCPayNotSetup(onRefresh: viewModel.refresh)
43+
case .pluginSetupNotCompleted(let plugin):
44+
InPersonPaymentsPluginNotSetup(plugin: plugin, onRefresh: viewModel.refresh)
4545
case .stripeAccountOverdueRequirement:
4646
InPersonPaymentsStripeAccountOverdue()
4747
case .stripeAccountPendingRequirement(let deadline):

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ struct InPersonPaymentsCountryNotSupported: View {
2828
private enum Localization {
2929
static let title = NSLocalizedString(
3030
"We don’t support In-Person Payments in %1$@",
31-
comment: "Title for the error screen when WooCommerce Payments is not supported in a specific country"
31+
comment: "Title for the error screen when In-Person Payments is not supported in a specific country"
3232
)
3333

3434
static let titleUnknownCountry = NSLocalizedString(
3535
"We don’t support In-Person Payments in your country",
36-
comment: "Title for the error screen when WooCommerce Payments is not supported because we don't know the name of the country"
36+
comment: "Title for the error screen when In-Person Payments is not supported because we don't know the name of the country"
3737
)
3838

3939
static let message = NSLocalizedString(
4040
"You can still accept in-person cash payments by enabling the “Cash on Delivery” payment method on your store.",
41-
comment: "Error message when WooCommerce Payments is not supported in a specific country"
41+
comment: "Error message when In-Person Payments is not supported in a specific country"
4242
)
4343
}
4444

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/Onboarding Errors/InPersonPaymentsWCPayNotSetup.swift renamed to WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/Onboarding Errors/InPersonPaymentsPluginNotSetup.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import SwiftUI
2+
import Yosemite
23

3-
struct InPersonPaymentsWCPayNotSetup: View {
4+
struct InPersonPaymentsPluginNotSetup: View {
5+
let plugin: CardPresentPaymentsPlugins
46
let onRefresh: () -> Void
57
@State var presentedSetupURL: URL? = nil
68

@@ -9,10 +11,10 @@ struct InPersonPaymentsWCPayNotSetup: View {
911
Spacer()
1012

1113
InPersonPaymentsOnboardingError.MainContent(
12-
title: Localization.title,
13-
message: Localization.message,
14+
title: String(format: Localization.title, plugin.pluginName),
15+
message: String(format: Localization.message, plugin.pluginName),
1416
image: InPersonPaymentsOnboardingError.ImageInfo(
15-
image: .wcPayPlugin,
17+
image: plugin.image,
1618
height: 108.0
1719
),
1820
supportLink: false
@@ -47,22 +49,22 @@ struct InPersonPaymentsWCPayNotSetup: View {
4749

4850
private enum Localization {
4951
static let title = NSLocalizedString(
50-
"Finish setup WooCommerce Payments in your store admin",
51-
comment: "Title for the error screen when WooCommerce Payments is installed but not set up"
52+
"Finish setup for %1$@ in your store admin",
53+
comment: "Title for the error screen when an in-person payments plugin is active but not set up. %1$@ contains the plugin name."
5254
)
5355

5456
static let message = NSLocalizedString(
55-
"You’re almost there! Please finish setting up WooCommerce Payments to start accepting Card-Present Payments.",
56-
comment: "Error message when WooCommerce Payments is installed but not set up"
57+
"You’re almost there! Please finish setting up %1$@ to start accepting In-Person Payments.",
58+
comment: "Error message when an in-person payments plugin is activated but not set up. %1$@ contains the plugin name."
5759
)
5860

5961
static let primaryButton = NSLocalizedString(
6062
"Finish Setup in Store Admin",
61-
comment: "Button to set up the WooCommerce Payments plugin after installing it"
63+
comment: "Button to set up an in-person payments plugin after activating it"
6264
)
6365
}
64-
struct InPersonPaymentsWCPayNotSetup_Previews: PreviewProvider {
66+
struct InPersonPaymentsPluginNotSetup_Previews: PreviewProvider {
6567
static var previews: some View {
66-
InPersonPaymentsWCPayNotSetup(onRefresh: {})
68+
InPersonPaymentsPluginNotSetup(plugin: .wcPay, onRefresh: {})
6769
}
6870
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct InPersonPaymentsStripeAccountPending: View {
66
var body: some View {
77
InPersonPaymentsOnboardingError(
88
title: Localization.title,
9-
message: Localization.message,
9+
message: message,
1010
image: InPersonPaymentsOnboardingError.ImageInfo(
1111
image: .paymentErrorImage,
1212
height: 180.0
@@ -27,26 +27,26 @@ struct InPersonPaymentsStripeAccountPending: View {
2727

2828
private enum Localization {
2929
static let title = NSLocalizedString(
30-
"Your WooCommerce Payments account has pending requirements",
31-
comment: "Title for the error screen when the Stripe account is restricted because there are pending requirements"
30+
"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"
3232
)
3333

3434
static let messageDeadline = NSLocalizedString(
35-
"There are pending requirements in your account. Please complete those requirements by %1$@ to keep accepting in-Person Payments.",
36-
comment: "Error message when WooCommerce Payments is not supported because there are pending requirements in the Stripe account."
35+
"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."
3737
+
3838
"%1$d will contain the localized deadline (e.g. August 11, 2021)"
3939
)
4040

4141
static let messageUnknownDeadline = NSLocalizedString(
42-
"There are pending requirements in your account. Please complete those requirements to keep accepting in-Person Payments.",
43-
comment: "Error message when WooCommerce Payments is not supported"
42+
"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"
4444
+
45-
"There are pending requirements in the Stripe account (without a known deadline)"
45+
"There are pending requirements in the merchant's payment account (without a known deadline)"
4646
)
4747

4848
static let message = NSLocalizedString(
49-
"There are pending requirements in your account. Please complete those requirements by",
49+
"There are pending requirements for your account. Please complete those requirements by",
5050
comment: "Error message when the Stripe account is restricted because there are pending requirements"
5151
)
5252
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ struct InPersonPaymentsStripeAcountReview: View {
1818
private enum Localization {
1919
static let title = NSLocalizedString(
2020
"In-Person Payments is currently unavailable",
21-
comment: "Title for the error screen when the Stripe account is restricted because it's under reviw"
21+
comment: "Title for the error screen when the merchant's payment account is restricted because it's under reviw"
2222
)
2323

2424
static let message = NSLocalizedString(
2525
"You'll be able to accept In-Person Payments as soon as we finish reviewing your account.",
26-
comment: "Error message when WooCommerce Payments is not supported because the Stripe account is under review"
26+
comment: "Error message when the merchant's payment account is under review"
2727
)
2828
}
2929

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ struct InPersonPaymentsStripeRejected: View {
1818
private enum Localization {
1919
static let title = NSLocalizedString(
2020
"In-Person Payments isn't available for this store",
21-
comment: "Title for the error screen when the Stripe account rejected."
21+
comment: "Title for the error screen when the merchant's payment account has been rejected."
2222
)
2323

2424
static let message = NSLocalizedString(
2525
"We are sorry but we can't support In-Person Payments for this store.",
26-
comment: "Error message when WooCommerce Payments is not supported because the Stripe account has been rejected"
26+
comment: "Error message when the merchant's payment account has been rejected"
2727
)
2828
}
2929

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@
15351535
E1BAAEA026BBECEF00F2C037 /* ButtonStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1BAAE9F26BBECEF00F2C037 /* ButtonStyles.swift */; };
15361536
E1BE703A265E6F47006CA4D9 /* CardPresentModalScanningFailed.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1BE7039265E6F47006CA4D9 /* CardPresentModalScanningFailed.swift */; };
15371537
E1C47209267A1ECC00D06DA1 /* CrashLoggingStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C47208267A1ECC00D06DA1 /* CrashLoggingStack.swift */; };
1538-
E1C5E78226C2A971008D4C47 /* InPersonPaymentsWCPayNotSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C5E78126C2A971008D4C47 /* InPersonPaymentsWCPayNotSetup.swift */; };
1538+
E1C5E78226C2A971008D4C47 /* InPersonPaymentsPluginNotSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1C5E78126C2A971008D4C47 /* InPersonPaymentsPluginNotSetup.swift */; };
15391539
E1D4E84426776A6B00256B83 /* HeadlineTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D4E84326776A6A00256B83 /* HeadlineTableViewCell.swift */; };
15401540
E1D4E84526776AD900256B83 /* HeadlineTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E1D4E84226776A6A00256B83 /* HeadlineTableViewCell.xib */; };
15411541
E1E125AA26EB42530068A9B0 /* CardPresentModalUpdateProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1E125A926EB42530068A9B0 /* CardPresentModalUpdateProgress.swift */; };
@@ -3154,7 +3154,7 @@
31543154
E1BAAE9F26BBECEF00F2C037 /* ButtonStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonStyles.swift; sourceTree = "<group>"; };
31553155
E1BE7039265E6F47006CA4D9 /* CardPresentModalScanningFailed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPresentModalScanningFailed.swift; sourceTree = "<group>"; };
31563156
E1C47208267A1ECC00D06DA1 /* CrashLoggingStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashLoggingStack.swift; sourceTree = "<group>"; };
3157-
E1C5E78126C2A971008D4C47 /* InPersonPaymentsWCPayNotSetup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsWCPayNotSetup.swift; sourceTree = "<group>"; };
3157+
E1C5E78126C2A971008D4C47 /* InPersonPaymentsPluginNotSetup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsPluginNotSetup.swift; sourceTree = "<group>"; };
31583158
E1D4E84226776A6A00256B83 /* HeadlineTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HeadlineTableViewCell.xib; sourceTree = "<group>"; };
31593159
E1D4E84326776A6A00256B83 /* HeadlineTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineTableViewCell.swift; sourceTree = "<group>"; };
31603160
E1E125A926EB42530068A9B0 /* CardPresentModalUpdateProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPresentModalUpdateProgress.swift; sourceTree = "<group>"; };
@@ -7333,7 +7333,7 @@
73337333
D85A3C4F26C153A500C0E026 /* InPersonPaymentsPluginNotActivatedView.swift */,
73347334
D8B4D5F126C2CF5B00F34E94 /* InPersonPaymentsStripeAccountOverdueView.swift */,
73357335
D8B4D5EF26C2C7EC00F34E94 /* InPersonPaymentsStripeAccountPendingView.swift */,
7336-
E1C5E78126C2A971008D4C47 /* InPersonPaymentsWCPayNotSetup.swift */,
7336+
E1C5E78126C2A971008D4C47 /* InPersonPaymentsPluginNotSetup.swift */,
73377337
D8B4D5ED26C2C26C00F34E94 /* InPersonPaymentsStripeAcountReviewView.swift */,
73387338
D8B4D5F326C30E7C00F34E94 /* InPersonPaymentsStripeRejectedView.swift */,
73397339
E15F163026C5117300D3059B /* InPersonPaymentsNoConnectionView.swift */,
@@ -8833,7 +8833,7 @@
88338833
260C31602524ECA900157BC2 /* IssueRefundViewController.swift in Sources */,
88348834
2667BFEB2535FF09008099D4 /* RefundShippingCalculationUseCase.swift in Sources */,
88358835
E1E125AA26EB42530068A9B0 /* CardPresentModalUpdateProgress.swift in Sources */,
8836-
E1C5E78226C2A971008D4C47 /* InPersonPaymentsWCPayNotSetup.swift in Sources */,
8836+
E1C5E78226C2A971008D4C47 /* InPersonPaymentsPluginNotSetup.swift in Sources */,
88378837
022F941E257F8E820011CD94 /* BoldableTextParser.swift in Sources */,
88388838
26FE09DD24D9F3F600B9BDF5 /* LoadingView.swift in Sources */,
88398839
457151AB243B6E8000EB2DFA /* ProductSlugViewController.swift in Sources */,

0 commit comments

Comments
 (0)