@lookiero/checkout 8.14.0-beta.3 → 8.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/cypress/integration/checkout.spec.ts +259 -0
- package/cypress/support/e2e.ts +3 -0
- package/cypress/support/index.d.ts +8 -0
- package/cypress/support/interceptBlockCheckoutBooking.ts +4 -0
- package/cypress/support/interceptGiveCheckoutFeedback.ts +4 -0
- package/cypress/support/interceptKeepCheckoutItem.ts +4 -0
- package/cypress/support/interceptListCheckoutQuestionsByCheckoutId.ts +9 -0
- package/cypress/support/interceptListReturnQuestionsByCheckoutItemId.ts +9 -0
- package/cypress/support/interceptPayment.ts +23 -0
- package/cypress/support/interceptReplaceCheckoutItem.ts +4 -0
- package/cypress/support/interceptReturnCheckoutItem.ts +4 -0
- package/cypress/support/interceptSubmitCheckout.ts +4 -0
- package/cypress/support/interceptViewBookedProductsVariantsForCheckoutItem.ts +9 -0
- package/cypress/support/interceptViewCheckoutById.ts +6 -0
- package/cypress/support/interceptViewFirstAvailableCheckoutByCustomerId.ts +9 -0
- package/cypress/support/interceptViewFiveItemsDiscountByCustomerId.ts +6 -0
- package/cypress/support/interceptViewIsSizeChangeEnabledByCheckoutId.ts +6 -0
- package/cypress/support/interceptViewPaymentFlowPayloadByCheckoutId.ts +9 -0
- package/cypress/support/interceptViewPricingByCheckoutId.ts +6 -0
- package/cypress/tsconfig.json +8 -0
- package/cypress.config.ts +50 -0
- package/dist/src/ExpoRoot.js +2 -2
- package/dist/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
- package/dist/src/infrastructure/ui/Root.d.ts +1 -2
- package/dist/src/infrastructure/ui/Root.js +2 -4
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +2 -3
- package/dist/src/infrastructure/ui/test/render.js +1 -3
- package/dist/src/infrastructure/ui/views/App.js +7 -12
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +2 -3
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +1 -1
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +9 -2
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +5 -6
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.d.ts +1 -1
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.js +1 -1
- package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +2 -3
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -2
- package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +2 -2
- package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/jest.setup.js +0 -20
- package/package.json +10 -9
- package/src/ExpoRoot.tsx +2 -2
- package/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.test.ts +1 -1
- package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts +1 -1
- package/src/infrastructure/ui/Root.tsx +17 -21
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.ts +1 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +2 -3
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +2 -3
- package/src/infrastructure/ui/test/render.tsx +1 -4
- package/src/infrastructure/ui/views/App.tsx +16 -23
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +2 -3
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +10 -6
- package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +0 -1
- package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +26 -24
- package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
- package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +21 -10
- package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +15 -5
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +2 -4
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +10 -6
- package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +2 -2
- package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +78 -72
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +9 -3
- package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +4 -4
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +2 -2
- package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +2 -2
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +2 -2
- package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +30 -28
- package/dist/pact.config.d.ts +0 -13
- package/dist/pact.config.js +0 -9
- package/dist/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +0 -27
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -48
- package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +0 -19
- package/dist/src/infrastructure/projection/checkout/checkout.mock.js +0 -21
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -109
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -49
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -44
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -44
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -44
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +0 -10
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +0 -17
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +0 -6
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -49
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +0 -15
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +0 -43
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -50
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +0 -103
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -48
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -109
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +0 -6
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +0 -183
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -48
- package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +0 -9
- package/dist/src/infrastructure/projection/pricing/pricing.mock.js +0 -42
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -48
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -3
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +0 -400
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +0 -21
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +0 -1
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +0 -6
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +0 -6
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -5
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +0 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +0 -19
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -3
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +0 -18
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +0 -12
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +0 -13
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +0 -6
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +0 -11
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +0 -8
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +0 -11
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +0 -11
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +0 -49
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +0 -9
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +0 -9
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +0 -19
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +0 -21
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -9
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +0 -21
- package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
- package/dist/src/infrastructure/ui/views/App.style.js +0 -7
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +0 -7
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +0 -10
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -11
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -40
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -12
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +0 -15
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -40
- package/dist/src/infrastructure/ui/views/return/Return.style.js +0 -43
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -13
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +0 -9
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +0 -7
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +0 -10
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +0 -17
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +0 -13
- package/dist/src/projection/shared/country.d.ts +0 -14
- package/dist/src/projection/shared/country.js +0 -15
- package/dist/src/projection/shared/customer.d.ts +0 -8
- package/dist/src/projection/shared/customer.js +0 -1
- package/dist/src/projection/shared/locale.d.ts +0 -12
- package/dist/src/projection/shared/locale.js +0 -13
- package/dist/src/projection/shared/order.d.ts +0 -6
- package/dist/src/projection/shared/order.js +0 -1
- package/dist/src/projection/shared/price.d.ts +0 -10
- package/dist/src/projection/shared/price.js +0 -1
- package/dist/src/projection/shared/size.d.ts +0 -20
- package/dist/src/projection/shared/size.js +0 -3
- package/dist/src/projection/shared/subscription.d.ts +0 -2
- package/dist/src/projection/shared/subscription.js +0 -1
- package/dist/src/shared/ui/components/atoms/error/Error.d.ts +0 -10
- package/dist/src/shared/ui/components/atoms/error/Error.js +0 -4
- package/pact.config.ts +0 -31
- package/pact.publish.js +0 -32
- package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +0 -62
- package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +0 -128
- package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +0 -63
- package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +0 -57
- package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +0 -57
- package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +0 -57
- package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +0 -63
- package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +0 -64
- package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +0 -62
- package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +0 -136
- package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +0 -62
- package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +0 -62
- package/src/infrastructure/ui/views/App.style.ts +0 -9
|
@@ -181,14 +181,14 @@ exports[`ProductVariant component matches the snapshot for a non-unique size: no
|
|
|
181
181
|
</View>
|
|
182
182
|
</View>
|
|
183
183
|
<Image
|
|
184
|
-
|
|
184
|
+
collapsable={false}
|
|
185
|
+
jestAnimatedStyle={
|
|
185
186
|
{
|
|
186
187
|
"value": {
|
|
187
188
|
"opacity": 0,
|
|
188
189
|
},
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
|
-
collapsable={false}
|
|
192
192
|
onLoad={[Function]}
|
|
193
193
|
resizeMode="contain"
|
|
194
194
|
source={
|
|
@@ -531,14 +531,14 @@ exports[`ProductVariant component matches the snapshot for an unique size: uniqu
|
|
|
531
531
|
</View>
|
|
532
532
|
</View>
|
|
533
533
|
<Image
|
|
534
|
-
|
|
534
|
+
collapsable={false}
|
|
535
|
+
jestAnimatedStyle={
|
|
535
536
|
{
|
|
536
537
|
"value": {
|
|
537
538
|
"opacity": 0,
|
|
538
539
|
},
|
|
539
540
|
}
|
|
540
541
|
}
|
|
541
|
-
collapsable={false}
|
|
542
542
|
onLoad={[Function]}
|
|
543
543
|
resizeMode="contain"
|
|
544
544
|
source={
|
package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx
CHANGED
|
@@ -60,7 +60,7 @@ const CollapsiblePricing: FC<CollapsiblePricingProps> = ({
|
|
|
60
60
|
</View>
|
|
61
61
|
|
|
62
62
|
<View style={style.collapsedContent}>
|
|
63
|
-
<Button testID="
|
|
63
|
+
<Button testID="submit-checkout-collpased-button" small onPress={onSubmit}>
|
|
64
64
|
{submitButtonText}
|
|
65
65
|
</Button>
|
|
66
66
|
</View>
|
|
@@ -69,7 +69,7 @@ const CollapsiblePricing: FC<CollapsiblePricingProps> = ({
|
|
|
69
69
|
<animated.View style={{ opacity: notCollapsedStyle.opacitiy }}>
|
|
70
70
|
<Pricing pricing={pricing} totalCheckoutItemsKept={totalCheckoutItemsKept} />
|
|
71
71
|
|
|
72
|
-
<Button testID="
|
|
72
|
+
<Button testID="submit-checkout-button" onPress={onSubmit}>
|
|
73
73
|
{submitButtonText}
|
|
74
74
|
</Button>
|
|
75
75
|
</animated.View>
|
|
@@ -243,7 +243,7 @@ exports[`Pricing component matches the snapshot for collaped pricing: collapsed
|
|
|
243
243
|
},
|
|
244
244
|
]
|
|
245
245
|
}
|
|
246
|
-
testID="
|
|
246
|
+
testID="submit-checkout-collpased-button"
|
|
247
247
|
>
|
|
248
248
|
<View
|
|
249
249
|
collapsable={false}
|
|
@@ -543,7 +543,7 @@ exports[`Pricing component matches the snapshot for non-collaped pricing: non-co
|
|
|
543
543
|
},
|
|
544
544
|
]
|
|
545
545
|
}
|
|
546
|
-
testID="
|
|
546
|
+
testID="submit-checkout-collpased-button"
|
|
547
547
|
>
|
|
548
548
|
<View
|
|
549
549
|
collapsable={false}
|
package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx
CHANGED
|
@@ -73,8 +73,8 @@ const CheckoutItemsTabs: FC<CheckoutItemsTabsProps> = ({
|
|
|
73
73
|
|
|
74
74
|
const handleOnPressItem = useCallback((checkoutItemId: string) => onPressItem(checkoutItemId), [onPressItem]);
|
|
75
75
|
|
|
76
|
-
const data = useMemo(() => [0,
|
|
77
|
-
const renderItem: RenderItemFunction<
|
|
76
|
+
const data = useMemo(() => [{ id: "0" }, { id: "1" }], []);
|
|
77
|
+
const renderItem: RenderItemFunction<{ readonly id?: string }> = useCallback(
|
|
78
78
|
({ index }) =>
|
|
79
79
|
index === 0 ? (
|
|
80
80
|
checkoutItemsKept.length === 0 ? (
|
|
@@ -270,7 +270,8 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
270
270
|
style={{}}
|
|
271
271
|
>
|
|
272
272
|
<View
|
|
273
|
-
|
|
273
|
+
collapsable={false}
|
|
274
|
+
jestAnimatedStyle={
|
|
274
275
|
{
|
|
275
276
|
"value": {
|
|
276
277
|
"transform": [
|
|
@@ -281,7 +282,6 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
281
282
|
},
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
|
-
collapsable={false}
|
|
285
285
|
style={
|
|
286
286
|
{
|
|
287
287
|
"flex": 1,
|
|
@@ -298,16 +298,17 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
298
298
|
testID="carousel-track"
|
|
299
299
|
>
|
|
300
300
|
<View
|
|
301
|
+
collapsable={false}
|
|
302
|
+
jestAnimatedStyle={
|
|
303
|
+
{
|
|
304
|
+
"value": {},
|
|
305
|
+
}
|
|
306
|
+
}
|
|
301
307
|
style={
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
false,
|
|
307
|
-
{
|
|
308
|
-
"width": 300,
|
|
309
|
-
},
|
|
310
|
-
]
|
|
308
|
+
{
|
|
309
|
+
"flex": 1,
|
|
310
|
+
"width": 300,
|
|
311
|
+
}
|
|
311
312
|
}
|
|
312
313
|
testID="carousel-item"
|
|
313
314
|
>
|
|
@@ -466,14 +467,14 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
466
467
|
</View>
|
|
467
468
|
</View>
|
|
468
469
|
<Image
|
|
469
|
-
|
|
470
|
+
collapsable={false}
|
|
471
|
+
jestAnimatedStyle={
|
|
470
472
|
{
|
|
471
473
|
"value": {
|
|
472
474
|
"opacity": 0,
|
|
473
475
|
},
|
|
474
476
|
}
|
|
475
477
|
}
|
|
476
|
-
collapsable={false}
|
|
477
478
|
onLoad={[Function]}
|
|
478
479
|
resizeMode="contain"
|
|
479
480
|
source={
|
|
@@ -788,14 +789,14 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
788
789
|
</View>
|
|
789
790
|
</View>
|
|
790
791
|
<Image
|
|
791
|
-
|
|
792
|
+
collapsable={false}
|
|
793
|
+
jestAnimatedStyle={
|
|
792
794
|
{
|
|
793
795
|
"value": {
|
|
794
796
|
"opacity": 0,
|
|
795
797
|
},
|
|
796
798
|
}
|
|
797
799
|
}
|
|
798
|
-
collapsable={false}
|
|
799
800
|
onLoad={[Function]}
|
|
800
801
|
resizeMode="contain"
|
|
801
802
|
source={
|
|
@@ -991,16 +992,17 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
991
992
|
</View>
|
|
992
993
|
</View>
|
|
993
994
|
<View
|
|
995
|
+
collapsable={false}
|
|
996
|
+
jestAnimatedStyle={
|
|
997
|
+
{
|
|
998
|
+
"value": {},
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
994
1001
|
style={
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
false,
|
|
1000
|
-
{
|
|
1001
|
-
"width": 300,
|
|
1002
|
-
},
|
|
1003
|
-
]
|
|
1002
|
+
{
|
|
1003
|
+
"flex": 1,
|
|
1004
|
+
"width": 300,
|
|
1005
|
+
}
|
|
1004
1006
|
}
|
|
1005
1007
|
testID="carousel-item"
|
|
1006
1008
|
>
|
|
@@ -1159,14 +1161,14 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
1159
1161
|
</View>
|
|
1160
1162
|
</View>
|
|
1161
1163
|
<Image
|
|
1162
|
-
|
|
1164
|
+
collapsable={false}
|
|
1165
|
+
jestAnimatedStyle={
|
|
1163
1166
|
{
|
|
1164
1167
|
"value": {
|
|
1165
1168
|
"opacity": 0,
|
|
1166
1169
|
},
|
|
1167
1170
|
}
|
|
1168
1171
|
}
|
|
1169
|
-
collapsable={false}
|
|
1170
1172
|
onLoad={[Function]}
|
|
1171
1173
|
resizeMode="contain"
|
|
1172
1174
|
source={
|
|
@@ -1481,14 +1483,14 @@ exports[`CheckoutItemTabs component matches the snapshot 1`] = `
|
|
|
1481
1483
|
</View>
|
|
1482
1484
|
</View>
|
|
1483
1485
|
<Image
|
|
1484
|
-
|
|
1486
|
+
collapsable={false}
|
|
1487
|
+
jestAnimatedStyle={
|
|
1485
1488
|
{
|
|
1486
1489
|
"value": {
|
|
1487
1490
|
"opacity": 0,
|
|
1488
1491
|
},
|
|
1489
1492
|
}
|
|
1490
1493
|
}
|
|
1491
|
-
collapsable={false}
|
|
1492
1494
|
onLoad={[Function]}
|
|
1493
1495
|
resizeMode="contain"
|
|
1494
1496
|
source={
|
package/dist/pact.config.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { V3MockServer } from "@pact-foundation/pact";
|
|
2
|
-
interface StringObject {
|
|
3
|
-
readonly [k: string]: string;
|
|
4
|
-
}
|
|
5
|
-
declare const DEFAULT_PACT_OPTIONS: StringObject;
|
|
6
|
-
declare const AUTH_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
|
|
7
|
-
declare const DEFAULT_REQUEST_HEADERS: StringObject;
|
|
8
|
-
declare const DEFAULT_RESPONSE_HEADERS: StringObject;
|
|
9
|
-
interface FromMockServerUrlToApiUrlFunction {
|
|
10
|
-
(mockServer: V3MockServer): string;
|
|
11
|
-
}
|
|
12
|
-
declare const fromMockServerUrlToApiUrl: FromMockServerUrlToApiUrlFunction;
|
|
13
|
-
export { fromMockServerUrlToApiUrl, AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, };
|
package/dist/pact.config.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const DEFAULT_PACT_OPTIONS = { dir: ".contracts", logDir: ".pact/logs" };
|
|
2
|
-
const AUTH_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
|
|
3
|
-
const DEFAULT_REQUEST_HEADERS = {
|
|
4
|
-
Authorization: `Bearer ${AUTH_TOKEN}`,
|
|
5
|
-
["Content-Type"]: "application/json",
|
|
6
|
-
};
|
|
7
|
-
const DEFAULT_RESPONSE_HEADERS = { ["Content-Type"]: "application/json" };
|
|
8
|
-
const fromMockServerUrlToApiUrl = (mockServer) => mockServer.url.concat("/api");
|
|
9
|
-
export { fromMockServerUrlToApiUrl, AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const bookedProductsVariants = {
|
|
2
|
-
productVariants: [
|
|
3
|
-
{
|
|
4
|
-
id: "383fab95-56eb-4639-bb18-530ab792b4d3",
|
|
5
|
-
size: {
|
|
6
|
-
id: "4f8a26b8-8d2d-4012-b49a-7d2820095598",
|
|
7
|
-
europe: "S",
|
|
8
|
-
lookiero: "S",
|
|
9
|
-
uk: "S",
|
|
10
|
-
it: "S",
|
|
11
|
-
unique: false,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: "a5422445-0e62-4b11-8a3f-1bb5469ee154",
|
|
16
|
-
size: {
|
|
17
|
-
id: "a5422445-0e62-4b11-8a3f-1bb5469ee154",
|
|
18
|
-
europe: "M",
|
|
19
|
-
lookiero: "M",
|
|
20
|
-
uk: "M",
|
|
21
|
-
it: "M",
|
|
22
|
-
unique: false,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
};
|
|
27
|
-
export { bookedProductsVariants };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
-
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
4
|
-
import { bookedProductsVariants } from "./bookedProductsVariants.mock";
|
|
5
|
-
import { httpBookedProductsVariantsForCheckoutItemView } from "./httpBookedProductsVariantsForCheckoutItemView";
|
|
6
|
-
const provider = new PactV3({
|
|
7
|
-
...DEFAULT_PACT_OPTIONS,
|
|
8
|
-
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
9
|
-
provider: "STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem",
|
|
10
|
-
});
|
|
11
|
-
const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
|
|
12
|
-
const bookedProductsVariantsResponse = {
|
|
13
|
-
result: bookedProductsVariants,
|
|
14
|
-
};
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
const EXPECTED_BODY = MatchersV3.like(bookedProductsVariantsResponse);
|
|
18
|
-
describe("STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem API", () => {
|
|
19
|
-
it("returns a valid booked size change product variants for the given checkout item", () => {
|
|
20
|
-
provider
|
|
21
|
-
.given("a valid booked size change product variants for the given checkout item")
|
|
22
|
-
.uponReceiving("booked size change product variants projection")
|
|
23
|
-
.withRequest({
|
|
24
|
-
method: "POST",
|
|
25
|
-
path: "/api/view-booked-product-variants-for-checkout-item",
|
|
26
|
-
headers: DEFAULT_REQUEST_HEADERS,
|
|
27
|
-
body: { checkoutItemId },
|
|
28
|
-
})
|
|
29
|
-
.willRespondWith({
|
|
30
|
-
status: 200,
|
|
31
|
-
headers: DEFAULT_RESPONSE_HEADERS,
|
|
32
|
-
body: EXPECTED_BODY,
|
|
33
|
-
});
|
|
34
|
-
return provider.executeTest(async (mockserver) => {
|
|
35
|
-
const httpPost = fetchHttpPost({
|
|
36
|
-
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
37
|
-
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
38
|
-
device: "web",
|
|
39
|
-
version: "1.0.0",
|
|
40
|
-
});
|
|
41
|
-
const response = await httpBookedProductsVariantsForCheckoutItemView({ httpPost })({
|
|
42
|
-
checkoutItemId,
|
|
43
|
-
signal: undefined,
|
|
44
|
-
});
|
|
45
|
-
expect(response).toStrictEqual(bookedProductsVariantsResponse.result);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
2
|
-
import { CheckoutProjection } from "../../../projection/checkout/checkout";
|
|
3
|
-
import { CheckoutItemFunctionArgs } from "../checkoutItem/checkoutItem.mock";
|
|
4
|
-
import { CheckoutDto } from "./checkout";
|
|
5
|
-
interface CheckoutDtoFunctionArgs {
|
|
6
|
-
readonly status?: CheckoutStatus;
|
|
7
|
-
readonly items: CheckoutItemFunctionArgs[];
|
|
8
|
-
}
|
|
9
|
-
interface CheckoutDtoFunction {
|
|
10
|
-
(args: CheckoutDtoFunctionArgs): CheckoutDto;
|
|
11
|
-
}
|
|
12
|
-
declare const checkoutDto: CheckoutDtoFunction;
|
|
13
|
-
interface CheckoutFunctionArgs extends CheckoutDtoFunctionArgs {
|
|
14
|
-
}
|
|
15
|
-
interface CheckoutFunction {
|
|
16
|
-
(args: CheckoutFunctionArgs): CheckoutProjection;
|
|
17
|
-
}
|
|
18
|
-
declare const checkout: CheckoutFunction;
|
|
19
|
-
export { checkout, checkoutDto };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
2
|
-
import { checkoutItem } from "../checkoutItem/checkoutItem.mock";
|
|
3
|
-
import { toCheckoutProjection } from "./checkout";
|
|
4
|
-
const itemIds = [
|
|
5
|
-
"a5422445-0e62-4b11-8a3f-1bb5469ee154",
|
|
6
|
-
"cfc76463-621a-485a-b152-c5a9c4dc43d9",
|
|
7
|
-
"a9a4fa26-fcc2-4efa-a6a8-fa29ea07b128",
|
|
8
|
-
"8af02b73-0b0a-46a0-a3a8-d9710815c739",
|
|
9
|
-
"8890e00b-d4ed-4220-ae13-52cd88ae8ed5",
|
|
10
|
-
];
|
|
11
|
-
const checkoutDto = ({ status = CheckoutStatus.STARTED, items }) => ({
|
|
12
|
-
id: "9c450400-0cd7-44a4-b0e3-e0002a9bf8df",
|
|
13
|
-
status,
|
|
14
|
-
customerId: "0df61ca7-7e4d-462b-a422-a57de0d116b4",
|
|
15
|
-
boxId: "9c406e57-100a-4aa6-83c5-016e7c2970e7",
|
|
16
|
-
checkoutBookingId: "07c996bb-a0b4-45f9-ae21-6bb9c784d12b",
|
|
17
|
-
expiresOn: "2022-09-20",
|
|
18
|
-
items: items.map(({ id, status, feedbacks, replacedFor }, index) => checkoutItem({ id: id || itemIds[index], status, feedbacks, replacedFor })),
|
|
19
|
-
});
|
|
20
|
-
const checkout = ({ status, items }) => toCheckoutProjection(checkoutDto({ status, items }));
|
|
21
|
-
export { checkout, checkoutDto };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
-
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
4
|
-
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
5
|
-
import { MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
|
|
6
|
-
import { checkout } from "./checkout.mock";
|
|
7
|
-
import { httpCheckoutByIdView } from "./httpCheckoutByIdView";
|
|
8
|
-
const provider = new PactV3({
|
|
9
|
-
...DEFAULT_PACT_OPTIONS,
|
|
10
|
-
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
11
|
-
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutById",
|
|
12
|
-
});
|
|
13
|
-
const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
|
|
14
|
-
const replacedFor = {
|
|
15
|
-
id: "2bf7fb8f-a283-4f53-bc27-0e7fc9466a33",
|
|
16
|
-
media: [
|
|
17
|
-
{
|
|
18
|
-
id: "d7ec731b-4123-4394-829b-297b952e73e5",
|
|
19
|
-
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
|
|
20
|
-
perspective: MediaPerspective.MAIN,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
|
|
24
|
-
url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
|
|
25
|
-
perspective: MediaPerspective.DETAIL,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
brand: "CKS",
|
|
29
|
-
name: "Sari Tshirt lines",
|
|
30
|
-
size: {
|
|
31
|
-
id: "b3a76aea-ce7a-4ecb-82a4-6637d0ac2afd",
|
|
32
|
-
lookiero: "S",
|
|
33
|
-
uk: "S",
|
|
34
|
-
it: "S",
|
|
35
|
-
europe: "S",
|
|
36
|
-
unique: false,
|
|
37
|
-
},
|
|
38
|
-
color: {
|
|
39
|
-
id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
|
|
40
|
-
label: "black_C2",
|
|
41
|
-
name: "black",
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
const checkoutResponseWithReplacedFor = {
|
|
45
|
-
result: checkout({ items: [{ status: CheckoutItemStatus.KEPT, replacedFor }] }),
|
|
46
|
-
};
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
const EXPECTED_BODY_WITH_REPLACED_FOR = MatchersV3.like(checkoutResponseWithReplacedFor);
|
|
50
|
-
const checkoutResponseWithoutReplacedFor = {
|
|
51
|
-
result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
|
|
52
|
-
};
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
const EXPECTED_BODY_WITHOUT_REPLACED_FOR = MatchersV3.like(checkoutResponseWithoutReplacedFor);
|
|
56
|
-
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutById API", () => {
|
|
57
|
-
it("returns a valid checkout with replacedFor for the given id", () => {
|
|
58
|
-
provider
|
|
59
|
-
.given("a valid checkout with replacedFor for the given id")
|
|
60
|
-
.uponReceiving("checkout projection")
|
|
61
|
-
.withRequest({
|
|
62
|
-
method: "POST",
|
|
63
|
-
path: "/api/view-checkout-by-id",
|
|
64
|
-
headers: DEFAULT_REQUEST_HEADERS,
|
|
65
|
-
body: { checkoutId },
|
|
66
|
-
})
|
|
67
|
-
.willRespondWith({
|
|
68
|
-
status: 200,
|
|
69
|
-
headers: DEFAULT_RESPONSE_HEADERS,
|
|
70
|
-
body: EXPECTED_BODY_WITH_REPLACED_FOR,
|
|
71
|
-
});
|
|
72
|
-
return provider.executeTest(async (mockserver) => {
|
|
73
|
-
const httpPost = fetchHttpPost({
|
|
74
|
-
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
75
|
-
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
76
|
-
device: "web",
|
|
77
|
-
version: "1.0.0",
|
|
78
|
-
});
|
|
79
|
-
const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
80
|
-
expect(response).toStrictEqual(checkoutResponseWithReplacedFor.result);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
it("returns a valid checkout without replacedFor for the given id", () => {
|
|
84
|
-
provider
|
|
85
|
-
.given("a valid checkout without replacedFor for the given id")
|
|
86
|
-
.uponReceiving("checkout projection")
|
|
87
|
-
.withRequest({
|
|
88
|
-
method: "POST",
|
|
89
|
-
path: "/api/view-checkout-by-id",
|
|
90
|
-
headers: DEFAULT_REQUEST_HEADERS,
|
|
91
|
-
body: { checkoutId },
|
|
92
|
-
})
|
|
93
|
-
.willRespondWith({
|
|
94
|
-
status: 200,
|
|
95
|
-
headers: DEFAULT_RESPONSE_HEADERS,
|
|
96
|
-
body: EXPECTED_BODY_WITHOUT_REPLACED_FOR,
|
|
97
|
-
});
|
|
98
|
-
return provider.executeTest(async (mockserver) => {
|
|
99
|
-
const httpPost = fetchHttpPost({
|
|
100
|
-
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
101
|
-
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
102
|
-
device: "web",
|
|
103
|
-
version: "1.0.0",
|
|
104
|
-
});
|
|
105
|
-
const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
106
|
-
expect(response).toStrictEqual(checkoutResponseWithoutReplacedFor.result);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
-
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
4
|
-
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
5
|
-
import { checkout } from "./checkout.mock";
|
|
6
|
-
import { httpFirstAvailableCheckoutByCustomerIdView } from "./httpFirstAvailableCheckoutByCustomerIdView";
|
|
7
|
-
const provider = new PactV3({
|
|
8
|
-
...DEFAULT_PACT_OPTIONS,
|
|
9
|
-
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
10
|
-
provider: "STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId",
|
|
11
|
-
});
|
|
12
|
-
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
13
|
-
const checkoutResponse = {
|
|
14
|
-
result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
|
|
15
|
-
};
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
const EXPECTED_BODY = MatchersV3.like(checkoutResponse);
|
|
19
|
-
describe("STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId API", () => {
|
|
20
|
-
it("returns a first available checkout for the given customer id", () => {
|
|
21
|
-
provider
|
|
22
|
-
.given("a first available checkout for the given customer id")
|
|
23
|
-
.uponReceiving("checkout projection")
|
|
24
|
-
.withRequest({
|
|
25
|
-
method: "POST",
|
|
26
|
-
path: "/api/view-first-available-checkout-by-customer-id",
|
|
27
|
-
headers: DEFAULT_REQUEST_HEADERS,
|
|
28
|
-
body: { customerId },
|
|
29
|
-
})
|
|
30
|
-
.willRespondWith({
|
|
31
|
-
status: 200,
|
|
32
|
-
headers: DEFAULT_RESPONSE_HEADERS,
|
|
33
|
-
body: EXPECTED_BODY,
|
|
34
|
-
});
|
|
35
|
-
return provider.executeTest(async (mockserver) => {
|
|
36
|
-
const httpPost = fetchHttpPost({
|
|
37
|
-
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
38
|
-
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
39
|
-
device: "web",
|
|
40
|
-
version: "1.0.0",
|
|
41
|
-
});
|
|
42
|
-
const response = await httpFirstAvailableCheckoutByCustomerIdView({ httpPost })({
|
|
43
|
-
customerId,
|
|
44
|
-
signal: undefined,
|
|
45
|
-
});
|
|
46
|
-
expect(response).toStrictEqual(checkoutResponse.result);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
-
import { fetchHttpGet } from "@lookiero/sty-psp-http";
|
|
3
|
-
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
4
|
-
import { httpFiveItemsDiscountByCustomerIdView } from "./httpFiveItemsDiscountByCustomerIdView";
|
|
5
|
-
const provider = new PactV3({
|
|
6
|
-
...DEFAULT_PACT_OPTIONS,
|
|
7
|
-
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
8
|
-
provider: "STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId",
|
|
9
|
-
});
|
|
10
|
-
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
11
|
-
const fiveItemsDiscountResponse = 25;
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
const EXPECTED_BODY = MatchersV3.number(fiveItemsDiscountResponse);
|
|
15
|
-
describe("STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId API", () => {
|
|
16
|
-
it("returns a five items discount for the given customer id", () => {
|
|
17
|
-
provider
|
|
18
|
-
.given("a five items discount for the given customer id")
|
|
19
|
-
.uponReceiving("five items discount")
|
|
20
|
-
.withRequest({
|
|
21
|
-
method: "GET",
|
|
22
|
-
path: `/api/view-five-items-discount-by-customer-id/${customerId}`,
|
|
23
|
-
headers: DEFAULT_REQUEST_HEADERS,
|
|
24
|
-
})
|
|
25
|
-
.willRespondWith({
|
|
26
|
-
status: 200,
|
|
27
|
-
headers: DEFAULT_RESPONSE_HEADERS,
|
|
28
|
-
body: EXPECTED_BODY,
|
|
29
|
-
});
|
|
30
|
-
return provider.executeTest(async (mockserver) => {
|
|
31
|
-
const httpGet = fetchHttpGet({
|
|
32
|
-
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
33
|
-
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
34
|
-
device: "web",
|
|
35
|
-
version: "1.0.0",
|
|
36
|
-
});
|
|
37
|
-
const response = await httpFiveItemsDiscountByCustomerIdView({ httpGet })({
|
|
38
|
-
customerId,
|
|
39
|
-
signal: undefined,
|
|
40
|
-
});
|
|
41
|
-
expect(response).toStrictEqual(fiveItemsDiscountResponse);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
|
-
import { fetchHttpGet } from "@lookiero/sty-psp-http";
|
|
3
|
-
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
4
|
-
import { httpIsCheckoutEnabledByCustomerIdView } from "./httpIsCheckoutEnabledByCustomerIdView";
|
|
5
|
-
const provider = new PactV3({
|
|
6
|
-
...DEFAULT_PACT_OPTIONS,
|
|
7
|
-
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
8
|
-
provider: "STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId",
|
|
9
|
-
});
|
|
10
|
-
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
11
|
-
const isCheckoutEnabledResponse = true;
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
const EXPECTED_BODY = MatchersV3.boolean(isCheckoutEnabledResponse);
|
|
15
|
-
describe("STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId API", () => {
|
|
16
|
-
it("returns is new checkout enabled for the given customer id", () => {
|
|
17
|
-
provider
|
|
18
|
-
.given("is new checkout enabled for the given customer id")
|
|
19
|
-
.uponReceiving("is new checkout enabled")
|
|
20
|
-
.withRequest({
|
|
21
|
-
method: "GET",
|
|
22
|
-
path: `/api/is-new-checkout-enabled/${customerId}`,
|
|
23
|
-
headers: DEFAULT_REQUEST_HEADERS,
|
|
24
|
-
})
|
|
25
|
-
.willRespondWith({
|
|
26
|
-
status: 200,
|
|
27
|
-
headers: DEFAULT_RESPONSE_HEADERS,
|
|
28
|
-
body: EXPECTED_BODY,
|
|
29
|
-
});
|
|
30
|
-
return provider.executeTest(async (mockserver) => {
|
|
31
|
-
const httpGet = fetchHttpGet({
|
|
32
|
-
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
33
|
-
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
34
|
-
device: "web",
|
|
35
|
-
version: "1.0.0",
|
|
36
|
-
});
|
|
37
|
-
const response = await httpIsCheckoutEnabledByCustomerIdView({ httpGet })({
|
|
38
|
-
customerId,
|
|
39
|
-
signal: undefined,
|
|
40
|
-
});
|
|
41
|
-
expect(response).toStrictEqual(isCheckoutEnabledResponse);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|