Skip to content

Commit 2875fda

Browse files
committed
Refine Action and Store
1 parent 9a83fe6 commit 2875fda

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Yosemite/Yosemite/Actions/OrderCardPresentPaymentEligibilityAction.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import Foundation
22

3+
// Defines the actions supported by the OrderCardPresentPaymentEligibilityStore
34
public enum OrderCardPresentPaymentEligibilityAction: Action {
4-
case orderIsEligibleForCardPresentPayment(orderID: Int64,
5+
case orderIsEligibleForCardPresentPayment(orderID: Int64,
56
siteID: Int64,
67
cardPresentPaymentsConfiguration: CardPresentPaymentsConfiguration,
78
onCompletion: (Result<Bool, Error>) -> Void)

Yosemite/Yosemite/Stores/OrderCardPresentPaymentEligibilityStore.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
import Foundation
33

4+
/// Determines whether an order is eligible for card present payment or not
5+
///
46
public final class OrderCardPresentPaymentEligibilityStore: Store {
57
/// Registers for supported Actions.
68
///
@@ -38,7 +40,7 @@ private extension OrderCardPresentPaymentEligibilityStore {
3840
}
3941

4042

41-
let orderProductsIDs = order.items.map(\.variationID)
43+
let orderProductsIDs = order.items.map(\.productID)
4244
let products = storage.loadProducts(siteID: siteID, productsIDs: orderProductsIDs).map { $0.toReadOnly() }
4345

4446
onCompletion(.success(order.isEligibleForCardPresentPayment(cardPresentPaymentsConfiguration: cardPresentPaymentsConfiguration, products: products)))

0 commit comments

Comments
 (0)