Skip to content

Commit a1abb8c

Browse files
committed
Update TapToPayCardReaderPaymentAlertsProvider
1 parent cffd18f commit a1abb8c

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import MessageUI
44
import enum Hardware.CardReaderServiceError
55
import enum Hardware.UnderlyingError
66

7-
final class BuiltInCardReaderPaymentAlertsProvider: CardReaderTransactionAlertsProviding {
7+
final class TapToPayCardReaderPaymentAlertsProvider: CardReaderTransactionAlertsProviding {
88
var name: String = ""
99
var amount: String = ""
1010

@@ -24,10 +24,10 @@ final class BuiltInCardReaderPaymentAlertsProvider: CardReaderTransactionAlertsP
2424
onCancel: @escaping () -> Void) -> CardPresentPaymentsModalViewModel {
2525
name = title
2626
self.amount = amount
27-
return CardPresentModalBuiltInFollowReaderInstructions(name: name,
28-
amount: amount,
29-
transactionType: .collectPayment,
30-
inputMethods: inputMethods)
27+
return CardPresentModalTapToPayFollowReaderInstructions(name: name,
28+
amount: amount,
29+
transactionType: .collectPayment,
30+
inputMethods: inputMethods)
3131
}
3232

3333
func displayReaderMessage(message: String) -> CardPresentPaymentsModalViewModel {
@@ -38,21 +38,21 @@ final class BuiltInCardReaderPaymentAlertsProvider: CardReaderTransactionAlertsP
3838

3939
func processingTransaction(title: String) -> CardPresentPaymentsModalViewModel {
4040
name = title
41-
return CardPresentModalBuiltInReaderProcessing(name: name, amount: amount)
41+
return CardPresentModalTapToPayReaderProcessing(name: name, amount: amount)
4242
}
4343

4444
func success(receiptState: CardReaderTransactionAlertReceiptState) -> CardPresentPaymentsModalViewModel {
4545
switch receiptState {
4646
case let .paymentSuccessEmailSent(email, printReceiptAction, noReceiptAction):
47-
return CardPresentModalBuiltInSuccessEmailSent(printReceipt: printReceiptAction,
48-
noReceiptAction: noReceiptAction,
49-
email: email)
47+
return CardPresentModalTapToPaySuccessEmailSent(printReceipt: printReceiptAction,
48+
noReceiptAction: noReceiptAction,
49+
email: email)
5050
case let .promptToSendEmailReceipt(printReceiptAction, emailReceiptAction, noReceiptAction):
51-
return CardPresentModalBuiltInSuccess(printReceipt: printReceiptAction,
52-
emailReceipt: emailReceiptAction,
53-
noReceiptAction: noReceiptAction)
51+
return CardPresentModalTapToPaySuccess(printReceipt: printReceiptAction,
52+
emailReceipt: emailReceiptAction,
53+
noReceiptAction: noReceiptAction)
5454
case let .emailSendingNotSupported(printReceiptAction, noReceiptAction):
55-
return CardPresentModalBuiltInSuccessWithoutEmail(printReceipt: printReceiptAction, noReceiptAction: noReceiptAction)
55+
return CardPresentModalTapToPaySuccessWithoutEmail(printReceipt: printReceiptAction, noReceiptAction: noReceiptAction)
5656
}
5757
}
5858

@@ -62,25 +62,25 @@ final class BuiltInCardReaderPaymentAlertsProvider: CardReaderTransactionAlertsP
6262
dismissCompletion: @escaping () -> Void) -> CardPresentPaymentsModalViewModel {
6363
switch receiptState {
6464
case let .paymentSuccessEmailSent(email):
65-
return CardPresentModalErrorEmailSent(errorDescription: builtInReaderDescription(for: error),
65+
return CardPresentModalErrorEmailSent(errorDescription: tapToPayReaderDescription(for: error),
6666
transactionType: .collectPayment,
67-
image: .builtInReaderError,
67+
image: .tapToPayReaderError,
6868
email: email,
6969
requiresFallbackPaymentMethod: errorRequiresFallbackPaymentMethod(error),
7070
tryAgainAction: tryAgain,
7171
dismissCompletion: dismissCompletion)
7272
case let .promptToSendEmailReceipt(emailReceiptAction):
73-
return CardPresentModalError(errorDescription: builtInReaderDescription(for: error),
73+
return CardPresentModalError(errorDescription: tapToPayReaderDescription(for: error),
7474
transactionType: .collectPayment,
75-
image: .builtInReaderError,
75+
image: .tapToPayReaderError,
7676
requiresFallbackPaymentMethod: errorRequiresFallbackPaymentMethod(error),
7777
tryAgainAction: tryAgain,
7878
emailReceiptAction: emailReceiptAction,
7979
dismissCompletion: dismissCompletion)
8080
case .noEmailReceipt:
81-
return CardPresentModalErrorWithoutEmail(errorDescription: builtInReaderDescription(for: error),
81+
return CardPresentModalErrorWithoutEmail(errorDescription: tapToPayReaderDescription(for: error),
8282
transactionType: .collectPayment,
83-
image: .builtInReaderError,
83+
image: .tapToPayReaderError,
8484
requiresFallbackPaymentMethod: errorRequiresFallbackPaymentMethod(error),
8585
tryAgainAction: tryAgain,
8686
dismissCompletion: dismissCompletion)
@@ -93,22 +93,22 @@ final class BuiltInCardReaderPaymentAlertsProvider: CardReaderTransactionAlertsP
9393
switch receiptState {
9494
case let .paymentSuccessEmailSent(email):
9595
CardPresentModalNonRetryableErrorEmailSent(amount: amount,
96-
errorDescription: builtInReaderDescription(for: error),
97-
image: .builtInReaderError,
96+
errorDescription: tapToPayReaderDescription(for: error),
97+
image: .tapToPayReaderError,
9898
email: email,
9999
requiresFallbackPaymentMethod: errorRequiresFallbackPaymentMethod(error),
100100
onDismiss: dismissCompletion)
101101
case let .promptToSendEmailReceipt(emailReceiptAction):
102102
CardPresentModalNonRetryableError(amount: amount,
103-
errorDescription: builtInReaderDescription(for: error),
104-
image: .builtInReaderError,
103+
errorDescription: tapToPayReaderDescription(for: error),
104+
image: .tapToPayReaderError,
105105
requiresFallbackPaymentMethod: errorRequiresFallbackPaymentMethod(error),
106106
onDismiss: dismissCompletion,
107107
emailReceiptAction: emailReceiptAction)
108108
case .noEmailReceipt:
109109
CardPresentModalNonRetryableErrorWithoutEmail(amount: amount,
110-
errorDescription: builtInReaderDescription(for: error),
111-
image: .builtInReaderError,
110+
errorDescription: tapToPayReaderDescription(for: error),
111+
image: .tapToPayReaderError,
112112
requiresFallbackPaymentMethod: errorRequiresFallbackPaymentMethod(error),
113113
onDismiss: dismissCompletion)
114114
}
@@ -119,8 +119,8 @@ final class BuiltInCardReaderPaymentAlertsProvider: CardReaderTransactionAlertsP
119119
}
120120
}
121121

122-
private extension BuiltInCardReaderPaymentAlertsProvider {
123-
func builtInReaderDescription(for error: Error) -> String? {
122+
private extension TapToPayCardReaderPaymentAlertsProvider {
123+
func tapToPayReaderDescription(for error: Error) -> String? {
124124
if let error = error as? CardReaderServiceError {
125125
switch error {
126126
case .connection(let underlyingError),

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
019630B42D01DB4800219D80 /* TapToPayAwarenessMomentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 019630B32D01DB4000219D80 /* TapToPayAwarenessMomentView.swift */; };
5555
019630B62D02018C00219D80 /* TapToPayAwarenessMomentDeterminer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 019630B52D02018400219D80 /* TapToPayAwarenessMomentDeterminer.swift */; };
5656
019630B82D0211F400219D80 /* TapToPayAwarenessMomentDeterminerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 019630B72D0211F400219D80 /* TapToPayAwarenessMomentDeterminerTests.swift */; };
57+
019A86842D89C13800ABBB71 /* TapToPayCardReaderPaymentAlertsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 019A86832D89C13800ABBB71 /* TapToPayCardReaderPaymentAlertsProvider.swift */; };
5758
01ADC1362C9AB4810036F7D2 /* PointOfSaleCardPresentPaymentIntentCreationErrorMessageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01ADC1352C9AB4810036F7D2 /* PointOfSaleCardPresentPaymentIntentCreationErrorMessageViewModel.swift */; };
5859
01ADC1382C9AB6050036F7D2 /* PointOfSaleCardPresentPaymentIntentCreationErrorMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01ADC1372C9AB6050036F7D2 /* PointOfSaleCardPresentPaymentIntentCreationErrorMessageView.swift */; };
5960
01B744E22D2FCA1400AEB3F4 /* PushNotificationBackgroundSynchronizerFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01B744E12D2FCA1300AEB3F4 /* PushNotificationBackgroundSynchronizerFactory.swift */; };
@@ -3277,6 +3278,7 @@
32773278
019630B32D01DB4000219D80 /* TapToPayAwarenessMomentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapToPayAwarenessMomentView.swift; sourceTree = "<group>"; };
32783279
019630B52D02018400219D80 /* TapToPayAwarenessMomentDeterminer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapToPayAwarenessMomentDeterminer.swift; sourceTree = "<group>"; };
32793280
019630B72D0211F400219D80 /* TapToPayAwarenessMomentDeterminerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapToPayAwarenessMomentDeterminerTests.swift; sourceTree = "<group>"; };
3281+
019A86832D89C13800ABBB71 /* TapToPayCardReaderPaymentAlertsProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapToPayCardReaderPaymentAlertsProvider.swift; sourceTree = "<group>"; };
32803282
01ADC1352C9AB4810036F7D2 /* PointOfSaleCardPresentPaymentIntentCreationErrorMessageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointOfSaleCardPresentPaymentIntentCreationErrorMessageViewModel.swift; sourceTree = "<group>"; };
32813283
01ADC1372C9AB6050036F7D2 /* PointOfSaleCardPresentPaymentIntentCreationErrorMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointOfSaleCardPresentPaymentIntentCreationErrorMessageView.swift; sourceTree = "<group>"; };
32823284
01B744E12D2FCA1300AEB3F4 /* PushNotificationBackgroundSynchronizerFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushNotificationBackgroundSynchronizerFactory.swift; sourceTree = "<group>"; };
@@ -8963,6 +8965,7 @@
89638965
318853352639FC9C00F66A9C /* PaymentSettingsFlowPresentingViewController.swift */,
89648966
20A3AFE22B10EF860033AF2D /* CardReaderSettingsFlowPresentingView.swift */,
89658967
20A3AFE42B10EF970033AF2D /* TapToPaySettingsFlowPresentingView.swift */,
8968+
019A86832D89C13800ABBB71 /* TapToPayCardReaderPaymentAlertsProvider.swift */,
89668969
31EF399B26430C6D0093C6F6 /* PaymentSettingsFlowPrioritizedViewModelsProvider.swift */,
89678970
31B19B66263B5E580099DAA6 /* CardReaderSettingsSearchingViewModel.swift */,
89688971
0365986829AFB0C100F297D3 /* SetUpTapToPayInformationViewModel.swift */,
@@ -15864,6 +15867,7 @@
1586415867
DEC51A9D274F8528009F3DF4 /* JCPJetpackInstallStepsViewModel.swift in Sources */,
1586515868
455DC3A327393C7E00D4644C /* OrderDatesFilterViewController.swift in Sources */,
1586615869
45B6F4EF27592A4000C18782 /* ReviewsView.swift in Sources */,
15870+
019A86842D89C13800ABBB71 /* TapToPayCardReaderPaymentAlertsProvider.swift in Sources */,
1586715871
86A4EBBD2B2F1306008011F5 /* ThemesPreviewViewModel.swift in Sources */,
1586815872
B6F37970293798ED00718561 /* AnalyticsHubTodayRangeData.swift in Sources */,
1586915873
CCFBBCF629C4B9A30081B595 /* ComponentsListViewModel.swift in Sources */,

0 commit comments

Comments
 (0)