@@ -100,6 +100,53 @@ final class OrderCardPresentPaymentEligibilityStoreTests: XCTestCase {
100100 XCTAssertTrue ( eligibility)
101101 }
102102
103+ func test_orderIsEligibleForCardPresentPayment_returns_true_for_eligible_order_and_none_stored_site( ) throws {
104+ // Given
105+ let orderItem = OrderItem . fake ( ) . copy ( itemID: 1234 ,
106+ name: " Chocolate cake " ,
107+ productID: 678 ,
108+ quantity: 1.0 )
109+ let cppEligibleOrder = Order . fake ( ) . copy ( siteID: sampleSiteID,
110+ orderID: 111 ,
111+ status: . pending,
112+ currency: " USD " ,
113+ datePaid: nil ,
114+ total: " 5.00 " ,
115+ paymentMethodID: " woocommerce_payments " ,
116+ items: [ orderItem] )
117+ let nonSubscriptionProduct = Product . fake ( ) . copy ( siteID: sampleSiteID,
118+ productID: 678 ,
119+ name: " Chocolate cake " ,
120+ productTypeKey: " simple " )
121+
122+ let regularSite = Site . fake ( ) . copy (
123+ siteID: sampleSiteID,
124+ isGarden: false ,
125+ gardenName: nil
126+ )
127+ self . currentSite = regularSite
128+
129+ storageManager. insertSampleProduct ( readOnlyProduct: nonSubscriptionProduct)
130+ storageManager. insertSampleOrder ( readOnlyOrder: cppEligibleOrder)
131+
132+ let configuration = CardPresentPaymentsConfiguration ( country: . US)
133+
134+ // When
135+ let result = waitFor { promise in
136+ let action = OrderCardPresentPaymentEligibilityAction
137+ . orderIsEligibleForCardPresentPayment ( orderID: 111 ,
138+ siteID: self . sampleSiteID,
139+ cardPresentPaymentsConfiguration: configuration) { result in
140+ promise ( result)
141+ }
142+ self . store. onAction ( action)
143+ }
144+
145+ // Then
146+ let eligibility = try XCTUnwrap ( result. get ( ) )
147+ XCTAssertTrue ( eligibility)
148+ }
149+
103150 func test_orderIsEligibleForCardPresentPayment_returns_failure_for_CIAB_sites( ) throws {
104151 // Given
105152 let orderItem = OrderItem . fake ( ) . copy ( itemID: 1234 ,
0 commit comments