@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
package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
});
|