Skip to content

Commit ba4e365

Browse files
authored
Merge pull request #6954 from woocommerce/issue/6952-remove-ipp-ca-feature-flag
[Mobile Payments] Enable Moose on the Loose for all merchants
2 parents 204b3fa + e8c2329 commit ba4e365

25 files changed

+25
-265
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
1919
return true
2020
case .productSKUInputScanner:
2121
return true
22-
case .canadaInPersonPayments:
23-
return buildConfig == .localDeveloper || buildConfig == .alpha
2422
case .inbox:
2523
return buildConfig == .localDeveloper || buildConfig == .alpha
2624
case .bulkEditProductVariations:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ public enum FeatureFlag: Int {
3838
///
3939
case productSKUInputScanner
4040

41-
/// Support for In-Person Payments in Canada
42-
///
43-
case canadaInPersonPayments
44-
4541
/// Displays the Inbox option under the Hub Menu.
4642
///
4743
case inbox

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
9.3
44
-----
5+
- [***] In-Person Payments is now available for merchants using WooCommerce Payments in Canada. [https://github.com/woocommerce/woocommerce-ios/pull/6954]
56
- [*] In-Person Payments: Accessibility improvement [https://github.com/woocommerce/woocommerce-ios/pull/6869, https://github.com/woocommerce/woocommerce-ios/pull/6886, https://github.com/woocommerce/woocommerce-ios/pull/6906]
67
- [*] Orders: Now it's possible to select and copy text from the notes on an order. [https://github.com/woocommerce/woocommerce-ios/pull/6894]
78
- [*] Support Arabic numerals on amount fields. [https://github.com/woocommerce/woocommerce-ios/pull/6891]

Storage/Storage/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ extension GeneralAppSettings {
99
installationDate: NullableCopiableProp<Date> = .copy,
1010
feedbacks: CopiableProp<[FeedbackType: FeedbackSettings]> = .copy,
1111
isViewAddOnsSwitchEnabled: CopiableProp<Bool> = .copy,
12-
isCanadaInPersonPaymentsSwitchEnabled: CopiableProp<Bool> = .copy,
1312
isProductSKUInputScannerSwitchEnabled: CopiableProp<Bool> = .copy,
1413
isCouponManagementSwitchEnabled: CopiableProp<Bool> = .copy,
1514
knownCardReaders: CopiableProp<[String]> = .copy,
@@ -19,7 +18,6 @@ extension GeneralAppSettings {
1918
let installationDate = installationDate ?? self.installationDate
2019
let feedbacks = feedbacks ?? self.feedbacks
2120
let isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled ?? self.isViewAddOnsSwitchEnabled
22-
let isCanadaInPersonPaymentsSwitchEnabled = isCanadaInPersonPaymentsSwitchEnabled ?? self.isCanadaInPersonPaymentsSwitchEnabled
2321
let isProductSKUInputScannerSwitchEnabled = isProductSKUInputScannerSwitchEnabled ?? self.isProductSKUInputScannerSwitchEnabled
2422
let isCouponManagementSwitchEnabled = isCouponManagementSwitchEnabled ?? self.isCouponManagementSwitchEnabled
2523
let knownCardReaders = knownCardReaders ?? self.knownCardReaders
@@ -30,7 +28,6 @@ extension GeneralAppSettings {
3028
installationDate: installationDate,
3129
feedbacks: feedbacks,
3230
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
33-
isCanadaInPersonPaymentsSwitchEnabled: isCanadaInPersonPaymentsSwitchEnabled,
3431
isProductSKUInputScannerSwitchEnabled: isProductSKUInputScannerSwitchEnabled,
3532
isCouponManagementSwitchEnabled: isCouponManagementSwitchEnabled,
3633
knownCardReaders: knownCardReaders,

Storage/Storage/Model/GeneralAppSettings.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
2424
///
2525
public let isViewAddOnsSwitchEnabled: Bool
2626

27-
/// The state for the In-Person Payments in Canada feature switch
28-
///
29-
public let isCanadaInPersonPaymentsSwitchEnabled: Bool
30-
3127
/// The state(`true` or `false`) for the Product SKU Input Scanner feature switch.
3228
///
3329
public let isProductSKUInputScannerSwitchEnabled: Bool
@@ -51,7 +47,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
5147
public init(installationDate: Date?,
5248
feedbacks: [FeedbackType: FeedbackSettings],
5349
isViewAddOnsSwitchEnabled: Bool,
54-
isCanadaInPersonPaymentsSwitchEnabled: Bool,
5550
isProductSKUInputScannerSwitchEnabled: Bool,
5651
isCouponManagementSwitchEnabled: Bool,
5752
knownCardReaders: [String],
@@ -60,7 +55,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
6055
self.installationDate = installationDate
6156
self.feedbacks = feedbacks
6257
self.isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled
63-
self.isCanadaInPersonPaymentsSwitchEnabled = isCanadaInPersonPaymentsSwitchEnabled
6458
self.isProductSKUInputScannerSwitchEnabled = isProductSKUInputScannerSwitchEnabled
6559
self.isCouponManagementSwitchEnabled = isCouponManagementSwitchEnabled
6660
self.knownCardReaders = knownCardReaders
@@ -89,7 +83,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
8983
installationDate: installationDate,
9084
feedbacks: updatedFeedbacks,
9185
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
92-
isCanadaInPersonPaymentsSwitchEnabled: isCanadaInPersonPaymentsSwitchEnabled,
9386
isProductSKUInputScannerSwitchEnabled: isProductSKUInputScannerSwitchEnabled,
9487
isCouponManagementSwitchEnabled: isCouponManagementSwitchEnabled,
9588
knownCardReaders: knownCardReaders,
@@ -108,7 +101,6 @@ extension GeneralAppSettings {
108101
self.installationDate = try container.decodeIfPresent(Date.self, forKey: .installationDate)
109102
self.feedbacks = try container.decodeIfPresent([FeedbackType: FeedbackSettings].self, forKey: .feedbacks) ?? [:]
110103
self.isViewAddOnsSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isViewAddOnsSwitchEnabled) ?? false
111-
self.isCanadaInPersonPaymentsSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isCanadaInPersonPaymentsSwitchEnabled) ?? false
112104
self.isProductSKUInputScannerSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isProductSKUInputScannerSwitchEnabled) ?? false
113105
self.isCouponManagementSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isCouponManagementSwitchEnabled) ?? false
114106
self.knownCardReaders = try container.decodeIfPresent([String].self, forKey: .knownCardReaders) ?? []

Storage/StorageTests/Model/AppSettings/GeneralAppSettingsTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ final class GeneralAppSettingsTests: XCTestCase {
6161
let previousSettings = GeneralAppSettings(installationDate: installationDate,
6262
feedbacks: feedbackSettings,
6363
isViewAddOnsSwitchEnabled: true,
64-
isCanadaInPersonPaymentsSwitchEnabled: true,
6564
isProductSKUInputScannerSwitchEnabled: true,
6665
isCouponManagementSwitchEnabled: true,
6766
knownCardReaders: readers,
@@ -82,7 +81,6 @@ final class GeneralAppSettingsTests: XCTestCase {
8281
assertEqual(newSettings.knownCardReaders, readers)
8382
assertEqual(newSettings.lastEligibilityErrorInfo, eligibilityInfo)
8483
assertEqual(newSettings.isViewAddOnsSwitchEnabled, false)
85-
assertEqual(newSettings.isCanadaInPersonPaymentsSwitchEnabled, true)
8684
assertEqual(newSettings.isProductSKUInputScannerSwitchEnabled, true)
8785
assertEqual(newSettings.isCouponManagementSwitchEnabled, true)
8886
assertEqual(newSettings.lastJetpackBenefitsBannerDismissedTime, jetpackBannerDismissedDate)
@@ -93,7 +91,6 @@ private extension GeneralAppSettingsTests {
9391
func createGeneralAppSettings(installationDate: Date? = nil,
9492
feedbacks: [FeedbackType: FeedbackSettings] = [:],
9593
isViewAddOnsSwitchEnabled: Bool = false,
96-
isCanadaInPersonPaymentsSwitchEnabled: Bool = false,
9794
isProductSKUInputScannerSwitchEnabled: Bool = false,
9895
isCouponManagementSwitchEnabled: Bool = false,
9996
knownCardReaders: [String] = [],
@@ -102,7 +99,6 @@ private extension GeneralAppSettingsTests {
10299
GeneralAppSettings(installationDate: installationDate,
103100
feedbacks: feedbacks,
104101
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
105-
isCanadaInPersonPaymentsSwitchEnabled: isCanadaInPersonPaymentsSwitchEnabled,
106102
isProductSKUInputScannerSwitchEnabled: isProductSKUInputScannerSwitchEnabled,
107103
isCouponManagementSwitchEnabled: isCouponManagementSwitchEnabled,
108104
knownCardReaders: knownCardReaders,

WooCommerce/Classes/Tools/In-Person Payments/CardPresentConfigurationLoader.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,15 @@ import Foundation
22
import Yosemite
33

44
final class CardPresentConfigurationLoader {
5-
private var canadaIPPEnabled: Bool = false
6-
75
init(stores: StoresManager = ServiceLocator.stores) {
8-
let canadaAction = AppSettingsAction.loadCanadaInPersonPaymentsSwitchState(onCompletion: { [weak self] result in
9-
if case .success(let canadaIPPEnabled) = result {
10-
self?.canadaIPPEnabled = canadaIPPEnabled
11-
}
12-
})
13-
stores.dispatch(canadaAction)
6+
// This initializer is kept since this is where we'd check for
7+
// feature flags while developing support for a new country
8+
// See https://github.com/woocommerce/woocommerce-ios/pull/6954
149
}
1510

1611
var configuration: CardPresentPaymentsConfiguration {
1712
.init(
18-
country: SiteAddress().countryCode,
19-
canadaEnabled: canadaIPPEnabled
13+
country: SiteAddress().countryCode
2014
)
2115
}
2216
}

WooCommerce/Classes/ViewRelated/Dashboard/Settings/Beta features/BetaFeaturesViewController.swift

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ private extension BetaFeaturesViewController {
7474
func configureSections() {
7575
self.sections = [
7676
productsSection(),
77-
inPersonPaymentsSection(),
7877
productSKUInputScannerSection(),
7978
couponManagementSection()
8079
].compactMap { $0 }
@@ -85,20 +84,6 @@ private extension BetaFeaturesViewController {
8584
.orderAddOnsDescription])
8685
}
8786

88-
func inPersonPaymentsSection() -> Section? {
89-
var rows: [Row] = []
90-
91-
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.canadaInPersonPayments) {
92-
rows += [.canadaInPersonPayments, .canadaInPersonPaymentsDescription]
93-
}
94-
95-
guard rows.isNotEmpty else {
96-
return nil
97-
}
98-
99-
return Section(rows: rows)
100-
}
101-
10287
func productSKUInputScannerSection() -> Section? {
10388
guard ServiceLocator.featureFlagService.isFeatureFlagEnabled(.productSKUInputScanner), UIImagePickerController.isSourceTypeAvailable(.camera) else {
10489
return nil
@@ -138,11 +123,6 @@ private extension BetaFeaturesViewController {
138123
configureOrderAddOnsSwitch(cell: cell)
139124
case let cell as BasicTableViewCell where row == .orderAddOnsDescription:
140125
configureOrderAddOnsDescription(cell: cell)
141-
// In-Person Payments in Canada
142-
case let cell as SwitchTableViewCell where row == .canadaInPersonPayments:
143-
configureCanadaInPersonPaymentsSwitch(cell: cell)
144-
case let cell as BasicTableViewCell where row == .canadaInPersonPaymentsDescription:
145-
configureCanadaInPersonPaymentsDescription(cell: cell)
146126
// Product SKU Input Scanner
147127
case let cell as SwitchTableViewCell where row == .productSKUInputScanner:
148128
configureProductSKUInputScannerSwitch(cell: cell)
@@ -192,37 +172,6 @@ private extension BetaFeaturesViewController {
192172
cell.textLabel?.text = Localization.orderAddOnsDescription
193173
}
194174

195-
func configureCanadaInPersonPaymentsSwitch(cell: SwitchTableViewCell) {
196-
configureCommonStylesForSwitchCell(cell)
197-
cell.title = Localization.canadaExtensionInPersonPaymentsTitle
198-
199-
// Fetch switch's state stored value.
200-
let action = AppSettingsAction.loadCanadaInPersonPaymentsSwitchState { result in
201-
guard let isEnabled = try? result.get() else {
202-
return cell.isOn = false
203-
}
204-
cell.isOn = isEnabled
205-
}
206-
ServiceLocator.stores.dispatch(action)
207-
208-
// Change switch's state stored value
209-
cell.onChange = { isSwitchOn in
210-
let action = AppSettingsAction.setCanadaInPersonPaymentsSwitchState(isEnabled: isSwitchOn, onCompletion: { result in
211-
// Roll back toggle if an error occurred
212-
if result.isFailure {
213-
cell.isOn.toggle()
214-
}
215-
})
216-
ServiceLocator.stores.dispatch(action)
217-
}
218-
cell.accessibilityIdentifier = "beta-features-canada-in-person-payments-cell"
219-
}
220-
221-
func configureCanadaInPersonPaymentsDescription(cell: BasicTableViewCell) {
222-
configureCommonStylesForDescriptionCell(cell)
223-
cell.textLabel?.text = Localization.canadaExtensionInPersonPaymentsDescription
224-
}
225-
226175
func configureProductSKUInputScannerSwitch(cell: SwitchTableViewCell) {
227176
configureCommonStylesForSwitchCell(cell)
228177
cell.title = Localization.productSKUInputScannerTitle
@@ -348,10 +297,6 @@ private enum Row: CaseIterable {
348297
case orderAddOns
349298
case orderAddOnsDescription
350299

351-
// In-Person Payments in Canada
352-
case canadaInPersonPayments
353-
case canadaInPersonPaymentsDescription
354-
355300
// Product SKU Input Scanner
356301
case productSKUInputScanner
357302
case productSKUInputScannerDescription
@@ -362,10 +307,9 @@ private enum Row: CaseIterable {
362307

363308
var type: UITableViewCell.Type {
364309
switch self {
365-
case .orderAddOns, .canadaInPersonPayments, .productSKUInputScanner, .couponManagement:
310+
case .orderAddOns, .productSKUInputScanner, .couponManagement:
366311
return SwitchTableViewCell.self
367-
case .orderAddOnsDescription, .canadaInPersonPaymentsDescription,
368-
.productSKUInputScannerDescription, .couponManagementDescription:
312+
case .orderAddOnsDescription, .productSKUInputScannerDescription, .couponManagementDescription:
369313
return BasicTableViewCell.self
370314
}
371315
}
@@ -384,13 +328,6 @@ private extension BetaFeaturesViewController {
384328
"Test out viewing Order Add-Ons as we get ready to launch",
385329
comment: "Cell description on the beta features screen to enable the order add-ons feature")
386330

387-
static let canadaExtensionInPersonPaymentsTitle = NSLocalizedString(
388-
"In-Person Payments in Canada",
389-
comment: "Cell title on beta features screen to enable accepting in-person payments for stores in Canada ")
390-
static let canadaExtensionInPersonPaymentsDescription = NSLocalizedString(
391-
"Test out In-Person Payments in Canada",
392-
comment: "Cell description on beta features screen to enable accepting in-person payments for stores in Canada")
393-
394331
static let productSKUInputScannerTitle = NSLocalizedString(
395332
"Product SKU Scanner",
396333
comment: "Cell title on beta features screen to enable product SKU input scanner in inventory settings.")

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ final class CardPresentPaymentsOnboardingUseCase: CardPresentPaymentsOnboardingU
4848
self.configurationLoader = .init(stores: stores)
4949
self.cardPresentPluginsDataProvider = .init(storageManager: storageManager, stores: stores, configuration: configurationLoader.configuration)
5050

51-
52-
// At the time of writing, actions are dispatched and processed synchronously, so the completion blocks for
53-
// loadStripeInPersonPaymentsSwitchState and loadCanadaInPersonPaymentsSwitchState should have been called already.
54-
// We defer updating the state until all settings are read to prevent unnecessary checks.
5551
updateState()
5652
}
5753

WooCommerce/WooCommerceTests/Extensions/Order+CardPresentPaymentTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import XCTest
77

88
final class Order_CardPresentPaymentTests: XCTestCase {
99
private static let currency = "US"
10-
private let configuration = CardPresentPaymentsConfiguration(country: Order_CardPresentPaymentTests.currency, canadaEnabled: true)
10+
private let configuration = CardPresentPaymentsConfiguration(country: Order_CardPresentPaymentTests.currency)
1111
private let eligibleOrder = Order.fake().copy(status: .pending,
1212
currency: Order_CardPresentPaymentTests.currency,
1313
datePaid: nil,

0 commit comments

Comments
 (0)