File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,27 @@ private extension OrderCardPresentPaymentEligibilityStore {
5353 cardPresentPaymentsConfiguration: CardPresentPaymentsConfiguration ,
5454 onCompletion: ( Result < Bool , Error > ) -> Void ) {
5555 let storage = storageManager. viewStorage
56+
57+ guard let site = storage. loadSite ( siteID: siteID) ? . toReadOnly ( ) else {
58+ return onCompletion (
59+ . failure(
60+ OrderIsEligibleForCardPresentPaymentError . siteNotFoundInStorage
61+ )
62+ )
63+ }
64+
65+ guard siteCIABEligibilityChecker. isFeatureSupported ( . cardReader, for: site) else {
66+ return onCompletion (
67+ . failure(
68+ OrderIsEligibleForCardPresentPaymentError . cardReaderPaymentOptionIsNotSupportedForCIABSites
69+ )
70+ )
71+ }
72+
5673 guard let order = storage. loadOrder ( siteID: siteID, orderID: orderID) ? . toReadOnly ( ) else {
5774 return onCompletion ( . failure( OrderIsEligibleForCardPresentPaymentError . orderNotFoundInStorage) )
5875 }
5976
60-
6177 let orderProductsIDs = order. items. map ( \. productID)
6278 let products = storage. loadProducts ( siteID: siteID, productsIDs: orderProductsIDs) . map { $0. toReadOnly ( ) }
6379
@@ -68,5 +84,7 @@ private extension OrderCardPresentPaymentEligibilityStore {
6884extension OrderCardPresentPaymentEligibilityStore {
6985 enum OrderIsEligibleForCardPresentPaymentError : Error {
7086 case orderNotFoundInStorage
87+ case siteNotFoundInStorage
88+ case cardReaderPaymentOptionIsNotSupportedForCIABSites
7189 }
7290}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ public enum CIABAffectedFeature: CaseIterable {
1010 case giftCardEditing
1111 case productsStockDashboardCard
1212 case pointOfSale
13+ case cardReader
1314}
1415
1516extension CIABAffectedFeature {
You can’t perform that action at this time.
0 commit comments