@lookiero/checkout 8.14.0-beta.102 → 8.14.0-beta.2
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/dist/pact.config.d.ts +4 -12
- package/dist/pact.config.js +4 -11
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +24 -24
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +6 -6
- package/dist/src/infrastructure/projection/checkout/checkout.mock.js +12 -15
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +82 -89
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +31 -38
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +31 -38
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +31 -38
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +3 -3
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +6 -10
- package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +38 -39
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +96 -97
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +83 -94
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +1 -7
- package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +173 -178
- package/dist/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +2 -3
- package/dist/src/infrastructure/projection/pricing/pricing.mock.js +34 -35
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +33 -40
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -1
- package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +377 -378
- package/dist/src/infrastructure/ui/Root.d.ts +2 -0
- package/dist/src/infrastructure/ui/Root.js +2 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.d.ts +5 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +3 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.d.ts +5 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +5 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -2
- 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/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.js +2 -2
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.d.ts +3 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +3 -3
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.js +4 -4
- package/dist/src/infrastructure/ui/routing/Routing.d.ts +7 -0
- package/dist/src/infrastructure/ui/routing/Routing.js +5 -5
- package/dist/src/infrastructure/ui/views/App.d.ts +8 -0
- package/dist/src/infrastructure/ui/views/App.js +4 -4
- package/dist/src/infrastructure/ui/views/App.style.d.ts +3 -3
- package/dist/src/infrastructure/ui/views/App.style.js +3 -4
- package/dist/src/infrastructure/ui/views/item/Item.d.ts +5 -0
- package/dist/src/infrastructure/ui/views/item/Item.js +3 -3
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.d.ts +2 -0
- package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +2 -2
- 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/itemActions/ItemActions.d.ts +5 -1
- package/dist/src/infrastructure/ui/views/item/components/itemActions/ItemActions.js +2 -2
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.d.ts +5 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.js +2 -2
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +3 -3
- package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +2 -2
- 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.d.ts +2 -0
- package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +2 -2
- package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.d.ts +5 -0
- package/dist/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.js +2 -2
- package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.d.ts +5 -0
- package/dist/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.js +2 -2
- package/dist/src/infrastructure/ui/views/return/Return.d.ts +5 -0
- package/dist/src/infrastructure/ui/views/return/Return.js +2 -2
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +5 -0
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +12 -14
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +2 -6
- package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.js +2 -6
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/jest.setup.js +20 -0
- package/package.json +5 -4
- package/pact.config.ts +31 -0
- package/pact.publish.js +32 -0
- package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +62 -0
- package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +128 -0
- package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +63 -0
- package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +57 -0
- package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +57 -0
- package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +57 -0
- package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +63 -0
- package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +64 -0
- package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +62 -0
- package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +136 -0
- package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts +1 -1
- package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +62 -0
- package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +62 -0
- package/src/infrastructure/ui/Root.tsx +4 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.tsx +14 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.tsx +8 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.ts +6 -0
- 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 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/form/HostStackReturnQuestionItem.tsx +2 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/modal/HostStackReturnQuestionItem.tsx +2 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +5 -2
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/radioReturnQuestionItem/RadioReturnQuestionItem.tsx +3 -2
- package/src/infrastructure/ui/routing/Routing.tsx +13 -5
- package/{dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js → src/infrastructure/ui/views/App.style.ts} +2 -7
- package/src/infrastructure/ui/views/App.tsx +14 -7
- package/src/infrastructure/ui/views/item/Item.tsx +8 -2
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
- package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +9 -3
- package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +8 -1
- package/src/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.tsx +12 -3
- package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
- package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +6 -6
- package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +4 -3
- package/src/infrastructure/ui/views/item/views/itemWithCustomerDecission/ItemWithCustomerDecission.tsx +12 -2
- package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +14 -4
- package/src/infrastructure/ui/views/return/Return.tsx +8 -1
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.style.ts +2 -6
- package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +33 -38
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +0 -13
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +0 -19
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +0 -22
- 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 -7
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -5
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -6
- 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 -20
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +0 -43
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +0 -12
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +0 -7
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +0 -21
- 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 -12
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +0 -12
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +0 -64
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +0 -10
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +0 -17
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +0 -20
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +0 -27
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -10
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +0 -27
- 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 -11
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -12
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -64
- 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 -16
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -40
- package/dist/src/infrastructure/ui/views/return/Return.style.js +0 -44
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -14
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +0 -28
- 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 -11
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +0 -26
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +0 -21
- 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 -9
- 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 -11
- package/dist/src/projection/shared/price.js +0 -1
- package/dist/src/projection/shared/size.d.ts +0 -21
- package/dist/src/projection/shared/size.js +0 -4
- 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 -11
- package/dist/src/shared/ui/components/atoms/error/Error.js +0 -6
package/dist/pact.config.d.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { V3MockServer } from "@pact-foundation/pact";
|
|
2
|
-
|
|
3
2
|
interface StringObject {
|
|
4
|
-
|
|
3
|
+
readonly [k: string]: string;
|
|
5
4
|
}
|
|
6
5
|
declare const DEFAULT_PACT_OPTIONS: StringObject;
|
|
7
|
-
declare const AUTH_TOKEN =
|
|
8
|
-
"eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
|
|
6
|
+
declare const AUTH_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
|
|
9
7
|
declare const DEFAULT_REQUEST_HEADERS: StringObject;
|
|
10
8
|
declare const DEFAULT_RESPONSE_HEADERS: StringObject;
|
|
11
9
|
interface FromMockServerUrlToApiUrlFunction {
|
|
12
|
-
|
|
10
|
+
(mockServer: V3MockServer): string;
|
|
13
11
|
}
|
|
14
12
|
declare const fromMockServerUrlToApiUrl: FromMockServerUrlToApiUrlFunction;
|
|
15
|
-
export {
|
|
16
|
-
fromMockServerUrlToApiUrl,
|
|
17
|
-
AUTH_TOKEN,
|
|
18
|
-
DEFAULT_PACT_OPTIONS,
|
|
19
|
-
DEFAULT_REQUEST_HEADERS,
|
|
20
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
21
|
-
};
|
|
13
|
+
export { fromMockServerUrlToApiUrl, AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, };
|
package/dist/pact.config.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
const DEFAULT_PACT_OPTIONS = { dir: ".contracts", logDir: ".pact/logs" };
|
|
2
|
-
const AUTH_TOKEN =
|
|
3
|
-
"eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
|
|
2
|
+
const AUTH_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6InBpY2tlcixwYWNrZXIiLCJzdWIiOiIxIiwiaWF0IjoxNjAyODQ4MzEyfQ.gCs2_vBcJsXt4EdreNSjDI8NWkOTQ5Cy4SwtrGnuJ44";
|
|
4
3
|
const DEFAULT_REQUEST_HEADERS = {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Authorization: `Bearer ${AUTH_TOKEN}`,
|
|
5
|
+
["Content-Type"]: "application/json",
|
|
7
6
|
};
|
|
8
7
|
const DEFAULT_RESPONSE_HEADERS = { ["Content-Type"]: "application/json" };
|
|
9
8
|
const fromMockServerUrlToApiUrl = (mockServer) => mockServer.url.concat("/api");
|
|
10
|
-
export {
|
|
11
|
-
fromMockServerUrlToApiUrl,
|
|
12
|
-
AUTH_TOKEN,
|
|
13
|
-
DEFAULT_PACT_OPTIONS,
|
|
14
|
-
DEFAULT_REQUEST_HEADERS,
|
|
15
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
16
|
-
};
|
|
9
|
+
export { fromMockServerUrlToApiUrl, AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, };
|
package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
const bookedProductsVariants = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
26
|
};
|
|
27
27
|
export { bookedProductsVariants };
|
|
@@ -1,55 +1,48 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { bookedProductsVariants } from "./bookedProductsVariants.mock";
|
|
11
5
|
import { httpBookedProductsVariantsForCheckoutItemView } from "./httpBookedProductsVariantsForCheckoutItemView";
|
|
12
|
-
|
|
13
6
|
const provider = new PactV3({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
...DEFAULT_PACT_OPTIONS,
|
|
8
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
9
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem",
|
|
17
10
|
});
|
|
18
11
|
const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
|
|
19
12
|
const bookedProductsVariantsResponse = {
|
|
20
|
-
|
|
13
|
+
result: bookedProductsVariants,
|
|
21
14
|
};
|
|
22
15
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
16
|
// @ts-ignore
|
|
24
17
|
const EXPECTED_BODY = MatchersV3.like(bookedProductsVariantsResponse);
|
|
25
18
|
describe("STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem API", () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
});
|
|
53
47
|
});
|
|
54
|
-
});
|
|
55
48
|
});
|
|
@@ -2,18 +2,18 @@ import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
|
2
2
|
import { CheckoutProjection } from "../../../projection/checkout/checkout";
|
|
3
3
|
import { CheckoutItemFunctionArgs } from "../checkoutItem/checkoutItem.mock";
|
|
4
4
|
import { CheckoutDto } from "./checkout";
|
|
5
|
-
|
|
6
5
|
interface CheckoutDtoFunctionArgs {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
readonly status?: CheckoutStatus;
|
|
7
|
+
readonly items: CheckoutItemFunctionArgs[];
|
|
9
8
|
}
|
|
10
9
|
interface CheckoutDtoFunction {
|
|
11
|
-
|
|
10
|
+
(args: CheckoutDtoFunctionArgs): CheckoutDto;
|
|
12
11
|
}
|
|
13
12
|
declare const checkoutDto: CheckoutDtoFunction;
|
|
14
|
-
interface CheckoutFunctionArgs extends CheckoutDtoFunctionArgs {
|
|
13
|
+
interface CheckoutFunctionArgs extends CheckoutDtoFunctionArgs {
|
|
14
|
+
}
|
|
15
15
|
interface CheckoutFunction {
|
|
16
|
-
|
|
16
|
+
(args: CheckoutFunctionArgs): CheckoutProjection;
|
|
17
17
|
}
|
|
18
18
|
declare const checkout: CheckoutFunction;
|
|
19
19
|
export { checkout, checkoutDto };
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { CheckoutStatus } from "../../../domain/checkout/model/checkout";
|
|
2
2
|
import { checkoutItem } from "../checkoutItem/checkoutItem.mock";
|
|
3
3
|
import { toCheckoutProjection } from "./checkout";
|
|
4
|
-
|
|
5
4
|
const itemIds = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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",
|
|
11
10
|
];
|
|
12
11
|
const checkoutDto = ({ status = CheckoutStatus.STARTED, items }) => ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
checkoutItem({ id: id || itemIds[index], status, feedbacks, replacedFor }),
|
|
21
|
-
),
|
|
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 })),
|
|
22
19
|
});
|
|
23
20
|
const checkout = ({ status, items }) => toCheckoutProjection(checkoutDto({ status, items }));
|
|
24
21
|
export { checkout, checkoutDto };
|
|
@@ -1,116 +1,109 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
11
5
|
import { MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
|
|
12
6
|
import { checkout } from "./checkout.mock";
|
|
13
7
|
import { httpCheckoutByIdView } from "./httpCheckoutByIdView";
|
|
14
|
-
|
|
15
8
|
const provider = new PactV3({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
...DEFAULT_PACT_OPTIONS,
|
|
10
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
11
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutById",
|
|
19
12
|
});
|
|
20
13
|
const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
|
|
21
14
|
const replacedFor = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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,
|
|
28
37
|
},
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
color: {
|
|
39
|
+
id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
|
|
40
|
+
label: "black_C2",
|
|
41
|
+
name: "black",
|
|
33
42
|
},
|
|
34
|
-
],
|
|
35
|
-
brand: "CKS",
|
|
36
|
-
name: "Sari Tshirt lines",
|
|
37
|
-
size: {
|
|
38
|
-
id: "b3a76aea-ce7a-4ecb-82a4-6637d0ac2afd",
|
|
39
|
-
lookiero: "S",
|
|
40
|
-
uk: "S",
|
|
41
|
-
it: "S",
|
|
42
|
-
europe: "S",
|
|
43
|
-
unique: false,
|
|
44
|
-
},
|
|
45
|
-
color: {
|
|
46
|
-
id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
|
|
47
|
-
label: "black_C2",
|
|
48
|
-
name: "black",
|
|
49
|
-
},
|
|
50
43
|
};
|
|
51
44
|
const checkoutResponseWithReplacedFor = {
|
|
52
|
-
|
|
45
|
+
result: checkout({ items: [{ status: CheckoutItemStatus.KEPT, replacedFor }] }),
|
|
53
46
|
};
|
|
54
47
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
55
48
|
// @ts-ignore
|
|
56
49
|
const EXPECTED_BODY_WITH_REPLACED_FOR = MatchersV3.like(checkoutResponseWithReplacedFor);
|
|
57
50
|
const checkoutResponseWithoutReplacedFor = {
|
|
58
|
-
|
|
51
|
+
result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
|
|
59
52
|
};
|
|
60
53
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
61
54
|
// @ts-ignore
|
|
62
55
|
const EXPECTED_BODY_WITHOUT_REPLACED_FOR = MatchersV3.like(checkoutResponseWithoutReplacedFor);
|
|
63
56
|
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutById API", () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
+
});
|
|
88
82
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
+
});
|
|
114
108
|
});
|
|
115
|
-
});
|
|
116
109
|
});
|
|
@@ -1,56 +1,49 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpPost } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
11
5
|
import { checkout } from "./checkout.mock";
|
|
12
6
|
import { httpFirstAvailableCheckoutByCustomerIdView } from "./httpFirstAvailableCheckoutByCustomerIdView";
|
|
13
|
-
|
|
14
7
|
const provider = new PactV3({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
...DEFAULT_PACT_OPTIONS,
|
|
9
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
10
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId",
|
|
18
11
|
});
|
|
19
12
|
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
20
13
|
const checkoutResponse = {
|
|
21
|
-
|
|
14
|
+
result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
|
|
22
15
|
};
|
|
23
16
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
17
|
// @ts-ignore
|
|
25
18
|
const EXPECTED_BODY = MatchersV3.like(checkoutResponse);
|
|
26
19
|
describe("STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId API", () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
});
|
|
54
48
|
});
|
|
55
|
-
});
|
|
56
49
|
});
|
package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
2
2
|
import { fetchHttpGet } from "@lookiero/sty-psp-http";
|
|
3
|
-
import {
|
|
4
|
-
AUTH_TOKEN,
|
|
5
|
-
DEFAULT_PACT_OPTIONS,
|
|
6
|
-
DEFAULT_REQUEST_HEADERS,
|
|
7
|
-
DEFAULT_RESPONSE_HEADERS,
|
|
8
|
-
fromMockServerUrlToApiUrl,
|
|
9
|
-
} from "../../../../pact.config";
|
|
3
|
+
import { AUTH_TOKEN, DEFAULT_PACT_OPTIONS, DEFAULT_REQUEST_HEADERS, DEFAULT_RESPONSE_HEADERS, fromMockServerUrlToApiUrl, } from "../../../../pact.config";
|
|
10
4
|
import { httpFiveItemsDiscountByCustomerIdView } from "./httpFiveItemsDiscountByCustomerIdView";
|
|
11
|
-
|
|
12
5
|
const provider = new PactV3({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
...DEFAULT_PACT_OPTIONS,
|
|
7
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
8
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId",
|
|
16
9
|
});
|
|
17
10
|
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
18
11
|
const fiveItemsDiscountResponse = 25;
|
|
@@ -20,32 +13,32 @@ const fiveItemsDiscountResponse = 25;
|
|
|
20
13
|
// @ts-ignore
|
|
21
14
|
const EXPECTED_BODY = MatchersV3.number(fiveItemsDiscountResponse);
|
|
22
15
|
describe("STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId API", () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
});
|
|
49
43
|
});
|
|
50
|
-
});
|
|
51
44
|
});
|