@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.
Files changed (194) hide show
  1. package/.eslintrc.js +1 -1
  2. package/cypress/integration/checkout.spec.ts +259 -0
  3. package/cypress/support/e2e.ts +3 -0
  4. package/cypress/support/index.d.ts +8 -0
  5. package/cypress/support/interceptBlockCheckoutBooking.ts +4 -0
  6. package/cypress/support/interceptGiveCheckoutFeedback.ts +4 -0
  7. package/cypress/support/interceptKeepCheckoutItem.ts +4 -0
  8. package/cypress/support/interceptListCheckoutQuestionsByCheckoutId.ts +9 -0
  9. package/cypress/support/interceptListReturnQuestionsByCheckoutItemId.ts +9 -0
  10. package/cypress/support/interceptPayment.ts +23 -0
  11. package/cypress/support/interceptReplaceCheckoutItem.ts +4 -0
  12. package/cypress/support/interceptReturnCheckoutItem.ts +4 -0
  13. package/cypress/support/interceptSubmitCheckout.ts +4 -0
  14. package/cypress/support/interceptViewBookedProductsVariantsForCheckoutItem.ts +9 -0
  15. package/cypress/support/interceptViewCheckoutById.ts +6 -0
  16. package/cypress/support/interceptViewFirstAvailableCheckoutByCustomerId.ts +9 -0
  17. package/cypress/support/interceptViewFiveItemsDiscountByCustomerId.ts +6 -0
  18. package/cypress/support/interceptViewIsSizeChangeEnabledByCheckoutId.ts +6 -0
  19. package/cypress/support/interceptViewPaymentFlowPayloadByCheckoutId.ts +9 -0
  20. package/cypress/support/interceptViewPricingByCheckoutId.ts +6 -0
  21. package/cypress/tsconfig.json +8 -0
  22. package/cypress.config.ts +50 -0
  23. package/dist/src/ExpoRoot.js +2 -2
  24. package/dist/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
  25. package/dist/src/infrastructure/ui/Root.d.ts +1 -2
  26. package/dist/src/infrastructure/ui/Root.js +2 -4
  27. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -3
  28. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -1
  29. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -1
  30. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.js +2 -3
  31. package/dist/src/infrastructure/ui/test/render.js +1 -3
  32. package/dist/src/infrastructure/ui/views/App.js +7 -12
  33. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +2 -3
  34. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +1 -1
  35. package/dist/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +1 -1
  36. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.d.ts +9 -2
  37. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.js +5 -6
  38. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.d.ts +1 -1
  39. package/dist/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.js +1 -1
  40. package/dist/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +2 -3
  41. package/dist/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -2
  42. package/dist/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.js +2 -2
  43. package/dist/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.js +1 -1
  44. package/dist/src/version.d.ts +1 -1
  45. package/dist/src/version.js +1 -1
  46. package/jest.setup.js +0 -20
  47. package/package.json +10 -9
  48. package/src/ExpoRoot.tsx +2 -2
  49. package/src/infrastructure/domain/uiSetting/react/useUpdateUiSetting.test.ts +1 -1
  50. package/src/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.ts +1 -1
  51. package/src/infrastructure/ui/Root.tsx +17 -21
  52. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.ts +1 -1
  53. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +2 -3
  54. package/src/infrastructure/ui/components/organisms/returnQuestions/components/modalOptionReturnQuestionItems/ModalOptionReturnQuestionItems.tsx +2 -3
  55. package/src/infrastructure/ui/test/render.tsx +1 -4
  56. package/src/infrastructure/ui/views/App.tsx +16 -23
  57. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.ts +1 -1
  58. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.tsx +2 -3
  59. package/src/infrastructure/ui/views/item/components/getOutOfCheckoutModal/__snapshots__/GetOutOfCheckoutModal.test.tsx.snap +10 -6
  60. package/src/infrastructure/ui/views/item/components/itemActions/ItemActions.tsx +0 -1
  61. package/src/infrastructure/ui/views/item/components/productVariantSlider/__snapshots__/ProductVariantSlider.test.tsx.snap +26 -24
  62. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.style.ts +1 -1
  63. package/src/infrastructure/ui/views/item/components/selectModal/SelectModal.tsx +21 -10
  64. package/src/infrastructure/ui/views/item/components/selectModal/__snapshots__/SelecModal.test.tsx.snap +15 -5
  65. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.tsx +2 -4
  66. package/src/infrastructure/ui/views/item/components/sizeWithoutStockModal/__snapshots__/SizeWithoutStockModal.test.tsx.snap +10 -6
  67. package/src/infrastructure/ui/views/item/views/itemWithoutCustomerDecission/ItemWithoutCustomerDecission.tsx +2 -2
  68. package/src/infrastructure/ui/views/item/views/productVariant/__snapshots__/ProductVariant.test.tsx.snap +78 -72
  69. package/src/infrastructure/ui/views/return/components/returnQuestionsForm/ReturnQuestionsForm.tsx +9 -3
  70. package/src/infrastructure/ui/views/shared/components/productVariant/__snapshots__/ProductVariant.test.tsx.snap +4 -4
  71. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/CollapsiblePricing.tsx +2 -2
  72. package/src/infrastructure/ui/views/summary/components/collapsiblePricing/__snapshots__/CollapsiblePricing.test.tsx.snap +2 -2
  73. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/CheckoutItemsTabs.tsx +2 -2
  74. package/src/infrastructure/ui/views/summaryTabs/components/checkoutItemsTabs/__snapshots__/CheckoutItemsTabs.test.tsx.snap +30 -28
  75. package/dist/pact.config.d.ts +0 -13
  76. package/dist/pact.config.js +0 -9
  77. package/dist/public/public/assets/adaptive-icon.png +0 -0
  78. package/dist/public/public/assets/favicon.png +0 -0
  79. package/dist/public/public/assets/icon.png +0 -0
  80. package/dist/public/public/assets/splash.png +0 -0
  81. package/dist/public/public/images/not-found.png +0 -0
  82. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.d.ts +0 -3
  83. package/dist/src/infrastructure/projection/bookedProductsVariants/bookedProductsVariants.mock.js +0 -27
  84. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +0 -1
  85. package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +0 -48
  86. package/dist/src/infrastructure/projection/checkout/checkout.mock.d.ts +0 -19
  87. package/dist/src/infrastructure/projection/checkout/checkout.mock.js +0 -21
  88. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +0 -1
  89. package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +0 -109
  90. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +0 -1
  91. package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +0 -49
  92. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +0 -1
  93. package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +0 -44
  94. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +0 -1
  95. package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +0 -44
  96. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +0 -1
  97. package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +0 -44
  98. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +0 -10
  99. package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +0 -17
  100. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.d.ts +0 -3
  101. package/dist/src/infrastructure/projection/checkoutBooking/checkoutBooking.mock.js +0 -6
  102. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +0 -1
  103. package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +0 -49
  104. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.d.ts +0 -15
  105. package/dist/src/infrastructure/projection/checkoutItem/checkoutItem.mock.js +0 -43
  106. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +0 -1
  107. package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +0 -50
  108. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.d.ts +0 -3
  109. package/dist/src/infrastructure/projection/checkoutQuestion/checkoutQuestions.mock.js +0 -103
  110. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +0 -1
  111. package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +0 -48
  112. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +0 -1
  113. package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +0 -109
  114. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.d.ts +0 -6
  115. package/dist/src/infrastructure/projection/payment/paymentFlowPayload.mock.js +0 -183
  116. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +0 -1
  117. package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +0 -48
  118. package/dist/src/infrastructure/projection/pricing/pricing.mock.d.ts +0 -9
  119. package/dist/src/infrastructure/projection/pricing/pricing.mock.js +0 -42
  120. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +0 -1
  121. package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +0 -48
  122. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.d.ts +0 -3
  123. package/dist/src/infrastructure/projection/returnQuestion/returnQuestions.mock.js +0 -400
  124. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +0 -21
  125. package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +0 -1
  126. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +0 -6
  127. package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +0 -4
  128. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +0 -6
  129. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +0 -5
  130. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +0 -4
  131. package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +0 -19
  132. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +0 -3
  133. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +0 -18
  134. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +0 -12
  135. package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +0 -13
  136. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +0 -6
  137. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +0 -11
  138. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +0 -8
  139. package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +0 -11
  140. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +0 -11
  141. package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +0 -49
  142. package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +0 -9
  143. package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +0 -9
  144. package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +0 -19
  145. package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +0 -21
  146. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +0 -9
  147. package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +0 -21
  148. package/dist/src/infrastructure/ui/views/App.style.d.ts +0 -6
  149. package/dist/src/infrastructure/ui/views/App.style.js +0 -7
  150. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +0 -7
  151. package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +0 -10
  152. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +0 -11
  153. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +0 -40
  154. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +0 -12
  155. package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +0 -15
  156. package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +0 -40
  157. package/dist/src/infrastructure/ui/views/return/Return.style.js +0 -43
  158. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +0 -13
  159. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +0 -9
  160. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +0 -7
  161. package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +0 -10
  162. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +0 -17
  163. package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +0 -13
  164. package/dist/src/projection/shared/country.d.ts +0 -14
  165. package/dist/src/projection/shared/country.js +0 -15
  166. package/dist/src/projection/shared/customer.d.ts +0 -8
  167. package/dist/src/projection/shared/customer.js +0 -1
  168. package/dist/src/projection/shared/locale.d.ts +0 -12
  169. package/dist/src/projection/shared/locale.js +0 -13
  170. package/dist/src/projection/shared/order.d.ts +0 -6
  171. package/dist/src/projection/shared/order.js +0 -1
  172. package/dist/src/projection/shared/price.d.ts +0 -10
  173. package/dist/src/projection/shared/price.js +0 -1
  174. package/dist/src/projection/shared/size.d.ts +0 -20
  175. package/dist/src/projection/shared/size.js +0 -3
  176. package/dist/src/projection/shared/subscription.d.ts +0 -2
  177. package/dist/src/projection/shared/subscription.js +0 -1
  178. package/dist/src/shared/ui/components/atoms/error/Error.d.ts +0 -10
  179. package/dist/src/shared/ui/components/atoms/error/Error.js +0 -4
  180. package/pact.config.ts +0 -31
  181. package/pact.publish.js +0 -32
  182. package/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.ts +0 -62
  183. package/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.ts +0 -128
  184. package/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.ts +0 -63
  185. package/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.ts +0 -57
  186. package/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.ts +0 -57
  187. package/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.ts +0 -57
  188. package/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.ts +0 -63
  189. package/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.ts +0 -64
  190. package/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.ts +0 -62
  191. package/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.ts +0 -136
  192. package/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.ts +0 -62
  193. package/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.ts +0 -62
  194. package/src/infrastructure/ui/views/App.style.ts +0 -9
@@ -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 { BookedProductsVariantsProjection } from "../../../projection/bookedProductsVariants/bookedProductsVariants";
11
- import { bookedProductsVariants } from "./bookedProductsVariants.mock";
12
- import { httpBookedProductsVariantsForCheckoutItemView } from "./httpBookedProductsVariantsForCheckoutItemView";
13
-
14
- const provider = new PactV3({
15
- ...DEFAULT_PACT_OPTIONS,
16
- consumer: "STY-BOX_CHECKOUT-FRONT",
17
- provider: "STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem",
18
- });
19
-
20
- const checkoutItemId = "52440ae5-7a4c-498b-8b35-08ecfde15776";
21
-
22
- const bookedProductsVariantsResponse: { result: BookedProductsVariantsProjection } = {
23
- result: bookedProductsVariants,
24
- };
25
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
- // @ts-ignore
27
- const EXPECTED_BODY = MatchersV3.like(bookedProductsVariantsResponse);
28
-
29
- describe("STY-BOX_CHECKOUT-BACK_ViewBookedProductVariantsForCheckoutItem API", () => {
30
- it("returns a valid booked size change product variants for the given checkout item", () => {
31
- provider
32
- .given("a valid booked size change product variants for the given checkout item")
33
- .uponReceiving("booked size change product variants projection")
34
- .withRequest({
35
- method: "POST",
36
- path: "/api/view-booked-product-variants-for-checkout-item",
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 httpBookedProductsVariantsForCheckoutItemView({ httpPost })({
55
- checkoutItemId,
56
- signal: undefined,
57
- });
58
-
59
- expect(response).toStrictEqual(bookedProductsVariantsResponse.result);
60
- });
61
- });
62
- });
@@ -1,128 +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 { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
11
- import { CheckoutProjection } from "../../../projection/checkout/checkout";
12
- import { CheckoutItemProductVariantProjection, MediaPerspective } from "../../../projection/checkoutItem/checkoutItem";
13
- import { checkout } from "./checkout.mock";
14
- import { httpCheckoutByIdView } from "./httpCheckoutByIdView";
15
-
16
- const provider = new PactV3({
17
- ...DEFAULT_PACT_OPTIONS,
18
- consumer: "STY-BOX_CHECKOUT-FRONT",
19
- provider: "STY-BOX_CHECKOUT-BACK_ViewCheckoutById",
20
- });
21
-
22
- const checkoutId = "e2490de5-5bd3-43d5-b7c4-526e33f71304";
23
- const replacedFor: CheckoutItemProductVariantProjection = {
24
- id: "2bf7fb8f-a283-4f53-bc27-0e7fc9466a33",
25
- media: [
26
- {
27
- id: "d7ec731b-4123-4394-829b-297b952e73e5",
28
- url: "https://cdn-catalog-back-prod.envs.lookiero.tech/1a/28/1a28f712-a76c-4172-8a11-f15002981dc0.jpg",
29
- perspective: MediaPerspective.MAIN,
30
- },
31
- {
32
- id: "8055e209-2fe9-44c5-b715-b09ad3ef741c",
33
- url: "https://cdn-catalog-back-prod.envs.lookiero.tech/15/ac/15aca112-4e71-4646-8db5-7f9723bc0130.jpg",
34
- perspective: MediaPerspective.DETAIL,
35
- },
36
- ],
37
- brand: "CKS",
38
- name: "Sari Tshirt lines",
39
- size: {
40
- id: "b3a76aea-ce7a-4ecb-82a4-6637d0ac2afd",
41
- lookiero: "S",
42
- uk: "S",
43
- it: "S",
44
- europe: "S",
45
- unique: false,
46
- },
47
- color: {
48
- id: "c228d1b0-d06d-4d5c-a7d5-953fd43af0d8",
49
- label: "black_C2",
50
- name: "black",
51
- },
52
- };
53
-
54
- const checkoutResponseWithReplacedFor: { result: CheckoutProjection } = {
55
- result: checkout({ items: [{ status: CheckoutItemStatus.KEPT, replacedFor }] }),
56
- };
57
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
58
- // @ts-ignore
59
- const EXPECTED_BODY_WITH_REPLACED_FOR = MatchersV3.like(checkoutResponseWithReplacedFor);
60
-
61
- const checkoutResponseWithoutReplacedFor: { result: CheckoutProjection } = {
62
- result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
63
- };
64
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
65
- // @ts-ignore
66
- const EXPECTED_BODY_WITHOUT_REPLACED_FOR = MatchersV3.like(checkoutResponseWithoutReplacedFor);
67
-
68
- describe("STY-BOX_CHECKOUT-BACK_ViewCheckoutById API", () => {
69
- it("returns a valid checkout with replacedFor for the given id", () => {
70
- provider
71
- .given("a valid checkout with replacedFor for the given id")
72
- .uponReceiving("checkout projection")
73
- .withRequest({
74
- method: "POST",
75
- path: "/api/view-checkout-by-id",
76
- headers: DEFAULT_REQUEST_HEADERS,
77
- body: { checkoutId },
78
- })
79
- .willRespondWith({
80
- status: 200,
81
- headers: DEFAULT_RESPONSE_HEADERS,
82
- body: EXPECTED_BODY_WITH_REPLACED_FOR,
83
- });
84
-
85
- return provider.executeTest(async (mockserver) => {
86
- const httpPost = fetchHttpPost({
87
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
88
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
89
- device: "web",
90
- version: "1.0.0",
91
- });
92
-
93
- const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
94
-
95
- expect(response).toStrictEqual(checkoutResponseWithReplacedFor.result);
96
- });
97
- });
98
-
99
- it("returns a valid checkout without replacedFor for the given id", () => {
100
- provider
101
- .given("a valid checkout without replacedFor for the given id")
102
- .uponReceiving("checkout projection")
103
- .withRequest({
104
- method: "POST",
105
- path: "/api/view-checkout-by-id",
106
- headers: DEFAULT_REQUEST_HEADERS,
107
- body: { checkoutId },
108
- })
109
- .willRespondWith({
110
- status: 200,
111
- headers: DEFAULT_RESPONSE_HEADERS,
112
- body: EXPECTED_BODY_WITHOUT_REPLACED_FOR,
113
- });
114
-
115
- return provider.executeTest(async (mockserver) => {
116
- const httpPost = fetchHttpPost({
117
- apiUrl: () => fromMockServerUrlToApiUrl(mockserver),
118
- getAuthToken: () => Promise.resolve(AUTH_TOKEN),
119
- device: "web",
120
- version: "1.0.0",
121
- });
122
-
123
- const response = await httpCheckoutByIdView({ httpPost })({ checkoutId, signal: undefined });
124
-
125
- expect(response).toStrictEqual(checkoutResponseWithoutReplacedFor.result);
126
- });
127
- });
128
- });
@@ -1,63 +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 { CheckoutItemStatus } from "../../../domain/checkoutItem/model/checkoutItem";
11
- import { CheckoutProjection } from "../../../projection/checkout/checkout";
12
- import { checkout } from "./checkout.mock";
13
- import { httpFirstAvailableCheckoutByCustomerIdView } from "./httpFirstAvailableCheckoutByCustomerIdView";
14
-
15
- const provider = new PactV3({
16
- ...DEFAULT_PACT_OPTIONS,
17
- consumer: "STY-BOX_CHECKOUT-FRONT",
18
- provider: "STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId",
19
- });
20
-
21
- const customerId = "fab61a4d-c94d-4e33-b098-1945294a5f75";
22
-
23
- const checkoutResponse: { result: CheckoutProjection } = {
24
- result: checkout({ items: [{ status: CheckoutItemStatus.KEPT }] }),
25
- };
26
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
27
- // @ts-ignore
28
- const EXPECTED_BODY = MatchersV3.like(checkoutResponse);
29
-
30
- describe("STY-BOX_CHECKOUT-BACK_ViewFirstAvailableCheckoutByCustomerId API", () => {
31
- it("returns a first available checkout for the given customer id", () => {
32
- provider
33
- .given("a first available checkout for the given customer id")
34
- .uponReceiving("checkout projection")
35
- .withRequest({
36
- method: "POST",
37
- path: "/api/view-first-available-checkout-by-customer-id",
38
- headers: DEFAULT_REQUEST_HEADERS,
39
- body: { customerId },
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 httpFirstAvailableCheckoutByCustomerIdView({ httpPost })({
56
- customerId,
57
- signal: undefined,
58
- });
59
-
60
- expect(response).toStrictEqual(checkoutResponse.result);
61
- });
62
- });
63
- });
@@ -1,57 +0,0 @@
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
- });
@@ -1,57 +0,0 @@
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
- });
@@ -1,57 +0,0 @@
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
- });
@@ -1,63 +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 { 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
- });
@@ -1,64 +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 { 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
- });
@@ -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 { 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
- });