@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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { httpFiveItemsDiscountByCustomerIdView } from "./httpFiveItemsDiscountByCustomerIdView";
|
|
11
|
+
|
|
12
|
+
const provider = new PactV3({
|
|
13
|
+
...DEFAULT_PACT_OPTIONS,
|
|
14
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
15
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
19
|
+
const fiveItemsDiscountResponse = 25;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const EXPECTED_BODY = MatchersV3.number(fiveItemsDiscountResponse);
|
|
24
|
+
|
|
25
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewFiveItemsDiscountByCustomerId API", () => {
|
|
26
|
+
it("returns a five items discount for the given customer id", () => {
|
|
27
|
+
provider
|
|
28
|
+
.given("a five items discount for the given customer id")
|
|
29
|
+
.uponReceiving("five items discount")
|
|
30
|
+
.withRequest({
|
|
31
|
+
method: "GET",
|
|
32
|
+
path: `/api/view-five-items-discount-by-customer-id/${customerId}`,
|
|
33
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
34
|
+
})
|
|
35
|
+
.willRespondWith({
|
|
36
|
+
status: 200,
|
|
37
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
38
|
+
body: EXPECTED_BODY,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return provider.executeTest(async (mockserver) => {
|
|
42
|
+
const httpGet = fetchHttpGet({
|
|
43
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
44
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
45
|
+
device: "web",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const response = await httpFiveItemsDiscountByCustomerIdView({ httpGet })({
|
|
50
|
+
customerId,
|
|
51
|
+
signal: undefined,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
expect(response).toStrictEqual(fiveItemsDiscountResponse);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { httpIsCheckoutEnabledByCustomerIdView } from "./httpIsCheckoutEnabledByCustomerIdView";
|
|
11
|
+
|
|
12
|
+
const provider = new PactV3({
|
|
13
|
+
...DEFAULT_PACT_OPTIONS,
|
|
14
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
15
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
19
|
+
const isCheckoutEnabledResponse = true;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const EXPECTED_BODY = MatchersV3.boolean(isCheckoutEnabledResponse);
|
|
24
|
+
|
|
25
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewIsCheckoutEnabledByCustomerId API", () => {
|
|
26
|
+
it("returns is new checkout enabled for the given customer id", () => {
|
|
27
|
+
provider
|
|
28
|
+
.given("is new checkout enabled for the given customer id")
|
|
29
|
+
.uponReceiving("is new checkout enabled")
|
|
30
|
+
.withRequest({
|
|
31
|
+
method: "GET",
|
|
32
|
+
path: `/api/is-new-checkout-enabled/${customerId}`,
|
|
33
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
34
|
+
})
|
|
35
|
+
.willRespondWith({
|
|
36
|
+
status: 200,
|
|
37
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
38
|
+
body: EXPECTED_BODY,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return provider.executeTest(async (mockserver) => {
|
|
42
|
+
const httpGet = fetchHttpGet({
|
|
43
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
44
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
45
|
+
device: "web",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const response = await httpIsCheckoutEnabledByCustomerIdView({ httpGet })({
|
|
50
|
+
customerId,
|
|
51
|
+
signal: undefined,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
expect(response).toStrictEqual(isCheckoutEnabledResponse);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { httpIsSizeChangeEnabledByCheckoutIdView } from "./httpIsSizeChangeEnabledByCheckoutIdView";
|
|
11
|
+
|
|
12
|
+
const provider = new PactV3({
|
|
13
|
+
...DEFAULT_PACT_OPTIONS,
|
|
14
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
15
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewIsSizeChangeEnabledByCheckoutId",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const checkoutId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
|
|
19
|
+
const isSizeChangeEnabledResponse = true;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const EXPECTED_BODY = MatchersV3.like(isSizeChangeEnabledResponse);
|
|
24
|
+
|
|
25
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewIsSizeChangeEnabledByCheckoutId API", () => {
|
|
26
|
+
it("returns is size-change enabled for the given checkout id", () => {
|
|
27
|
+
provider
|
|
28
|
+
.given("is size-change enabled for the given checkout id")
|
|
29
|
+
.uponReceiving("is size-change enabled")
|
|
30
|
+
.withRequest({
|
|
31
|
+
method: "GET",
|
|
32
|
+
path: `/api/is-size-change-enabled-by-checkout-id/${checkoutId}`,
|
|
33
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
34
|
+
})
|
|
35
|
+
.willRespondWith({
|
|
36
|
+
status: 200,
|
|
37
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
38
|
+
body: EXPECTED_BODY,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return provider.executeTest(async (mockserver) => {
|
|
42
|
+
const httpGet = fetchHttpGet({
|
|
43
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
44
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
45
|
+
device: "web",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const response = await httpIsSizeChangeEnabledByCheckoutIdView({ httpGet })({
|
|
50
|
+
checkoutId,
|
|
51
|
+
signal: undefined,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
expect(response).toStrictEqual(isSizeChangeEnabledResponse);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
|
|
11
|
+
import { checkoutBooking as checkoutBookingMock } from "./checkoutBooking.mock";
|
|
12
|
+
import { httpCheckoutBookingByIdView } from "./httpCheckoutBookingByIdView";
|
|
13
|
+
|
|
14
|
+
const provider = new PactV3({
|
|
15
|
+
...DEFAULT_PACT_OPTIONS,
|
|
16
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
17
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutBookingById",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const checkoutBookingProjection = checkoutBookingMock;
|
|
21
|
+
const checkoutBookingId = checkoutBookingProjection.id;
|
|
22
|
+
|
|
23
|
+
const checkoutBookingResponse: { result: CheckoutBookingProjection } = {
|
|
24
|
+
result: checkoutBookingProjection,
|
|
25
|
+
};
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
const EXPECTED_BODY = MatchersV3.like(checkoutBookingResponse);
|
|
29
|
+
|
|
30
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutBookingById API", () => {
|
|
31
|
+
it("returns a valid checkout booking for the given id", () => {
|
|
32
|
+
provider
|
|
33
|
+
.given("a valid checkout booking for the given id")
|
|
34
|
+
.uponReceiving("checkout booking projection")
|
|
35
|
+
.withRequest({
|
|
36
|
+
method: "POST",
|
|
37
|
+
path: "/api/view-checkout-booking-by-id",
|
|
38
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
39
|
+
body: { checkoutBookingId },
|
|
40
|
+
})
|
|
41
|
+
.willRespondWith({
|
|
42
|
+
status: 200,
|
|
43
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
44
|
+
body: EXPECTED_BODY,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return provider.executeTest(async (mockserver) => {
|
|
48
|
+
const httpPost = fetchHttpPost({
|
|
49
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
50
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
51
|
+
device: "web",
|
|
52
|
+
version: "1.0.0",
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const response = await httpCheckoutBookingByIdView({ httpPost })({
|
|
56
|
+
checkoutBookingId,
|
|
57
|
+
signal: undefined,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(response).toStrictEqual(checkoutBookingResponse.result);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
|
|
11
|
+
import { CheckoutItemProjection } from "../../../projection/checkoutItem/checkoutItem";
|
|
12
|
+
import { checkoutItem } from "./checkoutItem.mock";
|
|
13
|
+
import { httpCheckoutItemByIdView } from "./httpCheckoutItemByIdView";
|
|
14
|
+
|
|
15
|
+
const provider = new PactV3({
|
|
16
|
+
...DEFAULT_PACT_OPTIONS,
|
|
17
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
18
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutItemById",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const checkoutItemProjection = checkoutItem({ status: CheckoutItemStatus.INITIAL });
|
|
22
|
+
const checkoutItemId = checkoutItemProjection.id;
|
|
23
|
+
|
|
24
|
+
const checkoutItemResponse: { result: CheckoutItemProjection } = {
|
|
25
|
+
result: checkoutItemProjection,
|
|
26
|
+
};
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
const EXPECTED_BODY = MatchersV3.like(checkoutItemResponse);
|
|
30
|
+
|
|
31
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutItemById API", () => {
|
|
32
|
+
it("returns a valid checkout item for the given id", () => {
|
|
33
|
+
provider
|
|
34
|
+
.given("a valid checkout item for the given id")
|
|
35
|
+
.uponReceiving("checkout item projection")
|
|
36
|
+
.withRequest({
|
|
37
|
+
method: "POST",
|
|
38
|
+
path: "/api/view-checkout-item-by-id",
|
|
39
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
40
|
+
body: { checkoutItemId },
|
|
41
|
+
})
|
|
42
|
+
.willRespondWith({
|
|
43
|
+
status: 200,
|
|
44
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
45
|
+
body: EXPECTED_BODY,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return provider.executeTest(async (mockserver) => {
|
|
49
|
+
const httpPost = fetchHttpPost({
|
|
50
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
51
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
52
|
+
device: "web",
|
|
53
|
+
version: "1.0.0",
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const response = await httpCheckoutItemByIdView({ httpPost })({
|
|
57
|
+
checkoutItemId,
|
|
58
|
+
signal: undefined,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
expect(response).toStrictEqual(checkoutItemResponse.result);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { CheckoutQuestionProjection } from "../../../projection/checkoutQuestion/checkoutQuestion";
|
|
11
|
+
import { checkoutQuestions } from "./checkoutQuestions.mock";
|
|
12
|
+
import { httpCheckoutQuestionsByCheckoutIdView } from "./httpCheckoutQuestionsByCheckoutIdView";
|
|
13
|
+
|
|
14
|
+
const provider = new PactV3({
|
|
15
|
+
...DEFAULT_PACT_OPTIONS,
|
|
16
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
17
|
+
provider: "STY-BOX_CHECKOUT-BACK_ListCheckoutQuestionsByCheckoutId",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const checkoutId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
|
|
21
|
+
|
|
22
|
+
const checkoutQuestionsResponse: { result: CheckoutQuestionProjection[] } = {
|
|
23
|
+
result: checkoutQuestions,
|
|
24
|
+
};
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
const EXPECTED_BODY = MatchersV3.like(checkoutQuestionsResponse);
|
|
28
|
+
|
|
29
|
+
describe("STY-BOX_CHECKOUT-BACK_ListCheckoutQuestionsByCheckoutId API", () => {
|
|
30
|
+
it("returns a valid checkout questions for the given checkout id", () => {
|
|
31
|
+
provider
|
|
32
|
+
.given("a valid checkout questions for the given checkout id")
|
|
33
|
+
.uponReceiving("checkout questions projection")
|
|
34
|
+
.withRequest({
|
|
35
|
+
method: "POST",
|
|
36
|
+
path: "/api/list-checkout-questions-by-checkout-id",
|
|
37
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
38
|
+
body: { checkoutId },
|
|
39
|
+
})
|
|
40
|
+
.willRespondWith({
|
|
41
|
+
status: 200,
|
|
42
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
43
|
+
body: EXPECTED_BODY,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return provider.executeTest(async (mockserver) => {
|
|
47
|
+
const httpPost = fetchHttpPost({
|
|
48
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
49
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
50
|
+
device: "web",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const response = await httpCheckoutQuestionsByCheckoutIdView({ httpPost })({
|
|
55
|
+
checkoutId,
|
|
56
|
+
signal: undefined,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(response).toStrictEqual(checkoutQuestionsResponse.result);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
|
|
11
|
+
import { httpPaymentFlowPayloadByCheckoutIdView } from "./httpPaymentFlowPayloadByCheckoutIdView";
|
|
12
|
+
import {
|
|
13
|
+
paymentFlowPayloadForKeptItems,
|
|
14
|
+
paymentFlowPayloadForReturnedItems,
|
|
15
|
+
paymentFlowPayloadForReplacedItems,
|
|
16
|
+
} from "./paymentFlowPayload.mock";
|
|
17
|
+
|
|
18
|
+
const provider = new PactV3({
|
|
19
|
+
...DEFAULT_PACT_OPTIONS,
|
|
20
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
21
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewPaymentFlowPayloadByCheckoutId",
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
|
|
25
|
+
|
|
26
|
+
const paymentFlowPayloadForKeptItemsResponse: { result: PaymentFlowPayloadProjection } = {
|
|
27
|
+
result: paymentFlowPayloadForKeptItems,
|
|
28
|
+
};
|
|
29
|
+
const paymentFlowPayloadForReturnedItemsResponse: { result: PaymentFlowPayloadProjection } = {
|
|
30
|
+
result: paymentFlowPayloadForReturnedItems,
|
|
31
|
+
};
|
|
32
|
+
const paymentFlowPayloadForReplacedItemsResponse: { result: PaymentFlowPayloadProjection } = {
|
|
33
|
+
result: paymentFlowPayloadForReplacedItems,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
const EXPECTED_BODY_FOR_KEPT_ITEMS = MatchersV3.like(paymentFlowPayloadForKeptItemsResponse);
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
const EXPECTED_BODY_FOR_RETURNED_ITEMS = MatchersV3.like(paymentFlowPayloadForReturnedItemsResponse);
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
const EXPECTED_BODY_FOR_REPLACED_ITEMS = MatchersV3.like(paymentFlowPayloadForReplacedItemsResponse);
|
|
45
|
+
|
|
46
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewPaymentFlowPayloadByCheckoutId API", () => {
|
|
47
|
+
it("returns a valid payment-flow payload for the given checkout id [KEPT items] ", () => {
|
|
48
|
+
provider
|
|
49
|
+
.given("a valid payment-flow payload for the given checkout id [KEPT items] ")
|
|
50
|
+
.uponReceiving("payment-flow payload projection")
|
|
51
|
+
.withRequest({
|
|
52
|
+
method: "POST",
|
|
53
|
+
path: "/api/view-payment-flow-payload-by-checkout-id",
|
|
54
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
55
|
+
body: { checkoutId },
|
|
56
|
+
})
|
|
57
|
+
.willRespondWith({
|
|
58
|
+
status: 200,
|
|
59
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
60
|
+
body: EXPECTED_BODY_FOR_KEPT_ITEMS,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return provider.executeTest(async (mockserver) => {
|
|
64
|
+
const httpPost = fetchHttpPost({
|
|
65
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
66
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
67
|
+
device: "web",
|
|
68
|
+
version: "1.0.0",
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
72
|
+
|
|
73
|
+
expect(response).toStrictEqual(paymentFlowPayloadForKeptItemsResponse.result);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("returns a valid payment-flow payload for the given checkout id [RETURNED items] ", () => {
|
|
78
|
+
provider
|
|
79
|
+
.given("a valid payment-flow payload for the given checkout id [RETURNED items] ")
|
|
80
|
+
.uponReceiving("payment-flow payload projection")
|
|
81
|
+
.withRequest({
|
|
82
|
+
method: "POST",
|
|
83
|
+
path: "/api/view-payment-flow-payload-by-checkout-id",
|
|
84
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
85
|
+
body: { checkoutId },
|
|
86
|
+
})
|
|
87
|
+
.willRespondWith({
|
|
88
|
+
status: 200,
|
|
89
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
90
|
+
body: EXPECTED_BODY_FOR_RETURNED_ITEMS,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return provider.executeTest(async (mockserver) => {
|
|
94
|
+
const httpPost = fetchHttpPost({
|
|
95
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
96
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
97
|
+
device: "web",
|
|
98
|
+
version: "1.0.0",
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
102
|
+
|
|
103
|
+
expect(response).toStrictEqual(paymentFlowPayloadForReturnedItemsResponse.result);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("returns a valid payment-flow payload for the given checkout id [REPLACED items] ", () => {
|
|
108
|
+
provider
|
|
109
|
+
.given("a valid payment-flow payload for the given checkout id [REPLACED items] ")
|
|
110
|
+
.uponReceiving("payment-flow payload projection")
|
|
111
|
+
.withRequest({
|
|
112
|
+
method: "POST",
|
|
113
|
+
path: "/api/view-payment-flow-payload-by-checkout-id",
|
|
114
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
115
|
+
body: { checkoutId },
|
|
116
|
+
})
|
|
117
|
+
.willRespondWith({
|
|
118
|
+
status: 200,
|
|
119
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
120
|
+
body: EXPECTED_BODY_FOR_REPLACED_ITEMS,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return provider.executeTest(async (mockserver) => {
|
|
124
|
+
const httpPost = fetchHttpPost({
|
|
125
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
126
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
127
|
+
device: "web",
|
|
128
|
+
version: "1.0.0",
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const response = await httpPaymentFlowPayloadByCheckoutIdView({ httpPost })({ checkoutId, signal: undefined });
|
|
132
|
+
|
|
133
|
+
expect(response).toStrictEqual(paymentFlowPayloadForReplacedItemsResponse.result);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts
CHANGED
|
@@ -27,7 +27,7 @@ const useViewPaymentFlowPayloadByCheckoutId: UseViewPaymentFlowPayloadByCheckout
|
|
|
27
27
|
query: viewPaymentFlowPayloadByCheckoutId({ checkoutId: checkoutId as string }),
|
|
28
28
|
contextId: MESSAGING_CONTEXT_ID,
|
|
29
29
|
invalidation: shouldInvalidate,
|
|
30
|
-
options: { refetchOnMount: "always", enabled: Boolean(checkoutId), cacheTime: 0
|
|
30
|
+
options: { refetchOnMount: "always", enabled: Boolean(checkoutId), cacheTime: 0 },
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
export { useViewPaymentFlowPayloadByCheckoutId };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { PricingProjection } from "../../../projection/pricing/pricing";
|
|
11
|
+
import { httpPricingByCheckoutIdView } from "./httpPricingByCheckoutIdView";
|
|
12
|
+
import { pricing } from "./pricing.mock";
|
|
13
|
+
|
|
14
|
+
const provider = new PactV3({
|
|
15
|
+
...DEFAULT_PACT_OPTIONS,
|
|
16
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
17
|
+
provider: "STY-BOX_CHECKOUT-BACK_ViewPricingByCheckoutId",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const checkoutId = "6f720954-8039-4bed-9596-34fc5a02131b";
|
|
21
|
+
|
|
22
|
+
const pricingResponse: { result: PricingProjection } = {
|
|
23
|
+
result: pricing(),
|
|
24
|
+
};
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
const EXPECTED_BODY = MatchersV3.like(pricingResponse);
|
|
28
|
+
|
|
29
|
+
describe("STY-BOX_CHECKOUT-BACK_ViewPricingByCheckoutId API", () => {
|
|
30
|
+
it("returns a valid pricing for the given checkout", () => {
|
|
31
|
+
provider
|
|
32
|
+
.given("a valid pricing for the given checkout")
|
|
33
|
+
.uponReceiving("pricing projection")
|
|
34
|
+
.withRequest({
|
|
35
|
+
method: "POST",
|
|
36
|
+
path: "/api/view-pricing-by-checkout-id",
|
|
37
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
38
|
+
body: { checkoutId },
|
|
39
|
+
})
|
|
40
|
+
.willRespondWith({
|
|
41
|
+
status: 200,
|
|
42
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
43
|
+
body: EXPECTED_BODY,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return provider.executeTest(async (mockserver) => {
|
|
47
|
+
const httpPost = fetchHttpPost({
|
|
48
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
49
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
50
|
+
device: "web",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const response = await httpPricingByCheckoutIdView({ httpPost })({
|
|
55
|
+
checkoutId,
|
|
56
|
+
signal: undefined,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(response).toStrictEqual(pricingResponse.result);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { MatchersV3, PactV3 } from "@pact-foundation/pact";
|
|
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";
|
|
10
|
+
import { ReturnQuestionProjection } from "../../../projection/returnQuestion/returnQuestion";
|
|
11
|
+
import { httpReturnQuestionsByCheckoutItemIdView } from "./httpReturnQuestionsByCheckoutItemIdView";
|
|
12
|
+
import { returnQuestions } from "./returnQuestions.mock";
|
|
13
|
+
|
|
14
|
+
const provider = new PactV3({
|
|
15
|
+
...DEFAULT_PACT_OPTIONS,
|
|
16
|
+
consumer: "STY-BOX_CHECKOUT-FRONT",
|
|
17
|
+
provider: "STY-BOX_CHECKOUT-BACK_ListReturnQuestionsByCheckoutItemId",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
|
|
21
|
+
|
|
22
|
+
const returnQuestionsResponse: { result: ReturnQuestionProjection[] } = {
|
|
23
|
+
result: returnQuestions,
|
|
24
|
+
};
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
const EXPECTED_BODY = MatchersV3.like(returnQuestionsResponse);
|
|
28
|
+
|
|
29
|
+
describe("STY-BOX_CHECKOUT-BACK_ListReturnQuestionsByCheckoutItemId API", () => {
|
|
30
|
+
it("returns a valid return questions for the given checkout item id", () => {
|
|
31
|
+
provider
|
|
32
|
+
.given("a valid return questions for the given checkout item id")
|
|
33
|
+
.uponReceiving("return questions projection")
|
|
34
|
+
.withRequest({
|
|
35
|
+
method: "POST",
|
|
36
|
+
path: "/api/list-return-questions-by-checkout-item-id",
|
|
37
|
+
headers: DEFAULT_REQUEST_HEADERS,
|
|
38
|
+
body: { checkoutItemId },
|
|
39
|
+
})
|
|
40
|
+
.willRespondWith({
|
|
41
|
+
status: 200,
|
|
42
|
+
headers: DEFAULT_RESPONSE_HEADERS,
|
|
43
|
+
body: EXPECTED_BODY,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return provider.executeTest(async (mockserver) => {
|
|
47
|
+
const httpPost = fetchHttpPost({
|
|
48
|
+
apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
|
|
49
|
+
getAuthToken: () => Promise.resolve(AUTH_TOKEN),
|
|
50
|
+
device: "web",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const response = await httpReturnQuestionsByCheckoutItemIdView({ httpPost })({
|
|
55
|
+
checkoutItemId,
|
|
56
|
+
signal: undefined,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(response).toStrictEqual(returnQuestionsResponse.result);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -11,7 +11,7 @@ import { Customer } from "../../projection/customer/customer";
|
|
|
11
11
|
import { Order } from "../../projection/order/order";
|
|
12
12
|
import { Subscription } from "../../projection/subscription/subscription";
|
|
13
13
|
import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
|
|
14
|
-
import { Routing } from "./routing/Routing";
|
|
14
|
+
import { Routing, RoutingStyle } from "./routing/Routing";
|
|
15
15
|
|
|
16
16
|
interface RootFunctionArgs {
|
|
17
17
|
readonly Messaging: MessagingRoot;
|
|
@@ -33,6 +33,7 @@ interface RootProps {
|
|
|
33
33
|
readonly order: Order | undefined;
|
|
34
34
|
readonly subscription: Subscription | undefined;
|
|
35
35
|
readonly layout: Layout;
|
|
36
|
+
readonly style?: Partial<RoutingStyle>;
|
|
36
37
|
readonly onNotAccessible: () => void;
|
|
37
38
|
readonly onCheckoutSubmitted?: () => void;
|
|
38
39
|
readonly useRedirect: () => Record<string, string>;
|
|
@@ -51,6 +52,7 @@ const root: RootFunction = ({ Messaging, I18n, getAuthToken, development, sentry
|
|
|
51
52
|
order,
|
|
52
53
|
subscription,
|
|
53
54
|
layout,
|
|
55
|
+
style: customStyle,
|
|
54
56
|
onNotAccessible,
|
|
55
57
|
onCheckoutSubmitted,
|
|
56
58
|
useRedirect,
|
|
@@ -69,6 +71,7 @@ const root: RootFunction = ({ Messaging, I18n, getAuthToken, development, sentry
|
|
|
69
71
|
layout={layout}
|
|
70
72
|
locale={locale}
|
|
71
73
|
order={order}
|
|
74
|
+
style={customStyle}
|
|
72
75
|
subscription={subscription}
|
|
73
76
|
useRedirect={useRedirect}
|
|
74
77
|
useRoutes={useRoutes}
|