@lookiero/checkout 9.8.5 → 9.9.0-beta.1
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/index.js +1 -1
- package/dist/pact.config.d.ts +21 -0
- package/dist/pact.config.js +16 -0
- 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/ExpoRoot.js +6 -4
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/bookedProductsVariants/httpBookedProductsVariantsForCheckoutItemView.pact.js +55 -0
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpCheckoutByIdView.pact.js +116 -0
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpFirstAvailableCheckoutByCustomerIdView.pact.js +56 -0
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpFiveItemsDiscountByCustomerIdView.pact.js +51 -0
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpIsCheckoutEnabledByCustomerIdView.pact.js +51 -0
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkout/httpIsSizeChangeEnabledByCheckoutIdView.pact.js +51 -0
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +13 -0
- package/dist/src/infrastructure/projection/checkout/react/useViewIsCheckoutAccessibleByCustomerId.js +19 -0
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkoutBooking/httpCheckoutBookingByIdView.pact.js +56 -0
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkoutItem/httpCheckoutItemByIdView.pact.js +57 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/checkoutQuestion/httpCheckoutQuestionsByCheckoutIdView.pact.js +55 -0
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/payment/httpPaymentFlowPayloadByCheckoutIdView.pact.js +120 -0
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/pricing/httpPricingByCheckoutIdView.pact.js +55 -0
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.d.ts +1 -0
- package/dist/src/infrastructure/projection/returnQuestion/httpReturnQuestionsByCheckoutItemIdView.pact.js +55 -0
- package/dist/src/infrastructure/ui/Root.d.ts +0 -2
- package/dist/src/infrastructure/ui/Root.js +2 -4
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.d.ts +22 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/Layout.js +1 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.d.ts +7 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/footer/Footer.js +5 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.d.ts +7 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.js +6 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.d.ts +4 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/components/header/Header.style.js +20 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.d.ts +4 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +43 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.style.js +14 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +1 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +1 -1
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +1 -0
- package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +1 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.d.ts +7 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.js +21 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.d.ts +8 -0
- package/dist/src/infrastructure/ui/components/templates/header/defaultHeader/DefaultHeader.style.js +12 -0
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.d.ts +12 -0
- package/dist/src/infrastructure/ui/hooks/useNewFeedbackExperiment.js +64 -0
- package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.d.ts +3 -2
- package/dist/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.js +17 -26
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.d.ts +1 -1
- package/dist/src/infrastructure/ui/hooks/useSubmitCheckout.js +22 -55
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.d.ts +10 -0
- package/dist/src/infrastructure/ui/i18n/fetchTranslations.js +17 -0
- package/dist/src/infrastructure/ui/i18n/i18n.d.ts +1 -0
- package/dist/src/infrastructure/ui/i18n/i18n.js +1 -0
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.d.ts +20 -0
- package/dist/src/infrastructure/ui/i18n/translationEndpoint.js +27 -0
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +10 -0
- package/dist/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +27 -0
- package/dist/src/infrastructure/ui/views/App.style.d.ts +6 -0
- package/dist/src/infrastructure/ui/views/App.style.js +8 -0
- package/dist/src/infrastructure/ui/views/checkout/Checkout.js +5 -2
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.d.ts +3 -0
- package/dist/src/infrastructure/ui/views/checkout/Checkout.style.js +3 -0
- package/dist/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.js +2 -2
- package/dist/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.js +7 -7
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.d.ts +7 -0
- package/dist/src/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.style.js +11 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.d.ts +12 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +64 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +12 -0
- package/dist/src/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +16 -0
- package/dist/src/infrastructure/ui/views/return/Return.style.d.ts +40 -0
- package/dist/src/infrastructure/ui/views/return/Return.style.js +44 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.d.ts +14 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.js +28 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.d.ts +7 -0
- package/dist/src/infrastructure/ui/views/summary/components/stickyPricing/StickyPricing.style.js +11 -0
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +26 -0
- package/dist/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +21 -0
- package/dist/src/projection/customer/customer.d.ts +2 -0
- package/dist/src/projection/shared/country.d.ts +14 -0
- package/dist/src/projection/shared/country.js +15 -0
- package/dist/src/projection/shared/customer.d.ts +9 -0
- package/dist/src/projection/shared/customer.js +1 -0
- package/dist/src/projection/shared/locale.d.ts +12 -0
- package/dist/src/projection/shared/locale.js +13 -0
- package/dist/src/projection/shared/order.d.ts +6 -0
- package/dist/src/projection/shared/order.js +1 -0
- package/dist/src/projection/shared/price.d.ts +11 -0
- package/dist/src/projection/shared/price.js +1 -0
- package/dist/src/projection/shared/size.d.ts +21 -0
- package/dist/src/projection/shared/size.js +4 -0
- package/dist/src/projection/shared/subscription.d.ts +2 -0
- package/dist/src/projection/shared/subscription.js +1 -0
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.d.ts +15 -0
- package/dist/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.js +16 -0
- package/dist/src/shared/ui/components/atoms/error/Error.d.ts +11 -0
- package/dist/src/shared/ui/components/atoms/error/Error.js +6 -0
- package/dist/src/shared/ui/components/atoms/field/Field.d.ts +14 -0
- package/dist/src/shared/ui/components/atoms/field/Field.js +29 -0
- package/dist/src/shared/ui/components/atoms/field/Field.style.d.ts +16 -0
- package/dist/src/shared/ui/components/atoms/field/Field.style.js +19 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.d.ts +24 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.js +28 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.d.ts +29 -0
- package/dist/src/shared/ui/components/molecules/inputField/InputField.style.js +37 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/index.ts +1 -1
- package/package.json +3 -3
- package/src/ExpoRoot.tsx +6 -4
- package/src/infrastructure/ui/Root.tsx +17 -30
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +1 -0
- package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +0 -1
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +1 -0
- package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +0 -1
- package/src/infrastructure/ui/hooks/usePaymentInstrumentEvents.ts +18 -60
- package/src/infrastructure/ui/hooks/useSubmitCheckout.test.ts +0 -58
- package/src/infrastructure/ui/hooks/useSubmitCheckout.ts +33 -77
- package/src/infrastructure/ui/i18n/i18n.ts +1 -0
- package/src/infrastructure/ui/views/checkout/Checkout.style.ts +3 -0
- package/src/infrastructure/ui/views/checkout/Checkout.tsx +12 -3
- package/src/infrastructure/ui/views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal.tsx +2 -2
- package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx +8 -8
- package/src/projection/customer/customer.ts +2 -0
- package/dist/src/infrastructure/ui/hooks/useQueryBus.d.ts +0 -9
- package/dist/src/infrastructure/ui/hooks/useQueryBus.js +0 -10
- package/src/infrastructure/ui/hooks/useQueryBus.test.tsx +0 -23
- package/src/infrastructure/ui/hooks/useQueryBus.tsx +0 -27
package/src/ExpoRoot.tsx
CHANGED
|
@@ -32,9 +32,11 @@ const order: Order = {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const customer: Customer = {
|
|
35
|
-
customerId: "
|
|
35
|
+
customerId: "9413fe3a-09fc-4264-905e-040bb7b4ca75",
|
|
36
36
|
country: Country.ES,
|
|
37
37
|
segment: Segment.WOMEN,
|
|
38
|
+
email: "email@example.com",
|
|
39
|
+
name: "Adèle Léonce Émilie",
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
const sentryConfig: SentryEnvironment = {
|
|
@@ -51,7 +53,7 @@ const apiUrl =
|
|
|
51
53
|
? "/local-to-dev"
|
|
52
54
|
: "/checkout/api";
|
|
53
55
|
const authToken =
|
|
54
|
-
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
|
|
56
|
+
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NTIwMjgsImV4cCI6MTczOTQ0MTYwMSwiZGlzcGxheU5hbWUiOiJNaWtlbCIsImNvdW50cnlfY29kZSI6IkVTIiwiYWNjZXNzVmlhIjoiZW1haWwiLCJzdWJzY3JpcHRpb25TdGFydGluZ0RhdGUiOiIyMDI0LTExLTE4IiwiaW1wZXJzb25hdGVkIjpmYWxzZSwidXVpZCI6Ijk0MTNmZTNhLTA5ZmMtNDI2NC05MDVlLTA0MGJiN2I0Y2E3NSIsImlhdCI6MTczNjc2MzIwMn0.ZaFu4743f9XR0aK3LgMMhbmRHNloHtC1Sm0FDUtj8B8";
|
|
55
57
|
const getAuthToken = () => Promise.resolve(authToken);
|
|
56
58
|
|
|
57
59
|
const externalTranslationsUrl =
|
|
@@ -92,6 +94,7 @@ setPaymentsBridge({
|
|
|
92
94
|
useFeatureFlags: () => ({}),
|
|
93
95
|
locale: () => Promise.resolve("es-ES"),
|
|
94
96
|
scrollView: ScrollView,
|
|
97
|
+
hostUrl: "",
|
|
95
98
|
});
|
|
96
99
|
|
|
97
100
|
const kameleoonConfig: KameleoonEnvironment = {
|
|
@@ -99,7 +102,7 @@ const kameleoonConfig: KameleoonEnvironment = {
|
|
|
99
102
|
experiments: {},
|
|
100
103
|
};
|
|
101
104
|
|
|
102
|
-
const { Component: Messaging
|
|
105
|
+
const { Component: Messaging } =
|
|
103
106
|
process.env.EXPO_PUBLIC_APP_VARIANT === "test"
|
|
104
107
|
? checkoutMockBootstrap()
|
|
105
108
|
: checkoutBootstrap({ apiUrl: () => apiUrl, getAuthToken });
|
|
@@ -110,7 +113,6 @@ const I18n = i18n({
|
|
|
110
113
|
const Root = root({
|
|
111
114
|
Messaging,
|
|
112
115
|
I18n,
|
|
113
|
-
queryBus,
|
|
114
116
|
getAuthToken,
|
|
115
117
|
development: false,
|
|
116
118
|
sentry: () => (process.env.EXPO_PUBLIC_APP_VARIANT === "test" ? ({} as SentryEnvironment) : sentryConfig),
|
|
@@ -3,7 +3,6 @@ import React, { ComponentType, useCallback } from "react";
|
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
4
|
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
5
5
|
import { I18n } from "@lookiero/i18n-react";
|
|
6
|
-
import { QueryBus } from "@lookiero/messaging";
|
|
7
6
|
import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
|
|
8
7
|
import { Locale } from "@lookiero/sty-psp-locale";
|
|
9
8
|
import { SentryEnvironment, SentryLoggerFunctionArgs, sentryLogger, sentryLoggerHOC } from "@lookiero/sty-psp-logging";
|
|
@@ -12,13 +11,11 @@ import { Customer } from "../../projection/customer/customer";
|
|
|
12
11
|
import { Order } from "../../projection/order/order";
|
|
13
12
|
import { Subscription } from "../../projection/subscription/subscription";
|
|
14
13
|
import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
|
|
15
|
-
import { QueryBusProvider } from "./hooks/useQueryBus";
|
|
16
14
|
import { Routing } from "./routing/Routing";
|
|
17
15
|
|
|
18
16
|
interface RootFunctionArgs {
|
|
19
17
|
readonly Messaging: MessagingRoot;
|
|
20
18
|
readonly I18n: I18n;
|
|
21
|
-
readonly queryBus: QueryBus;
|
|
22
19
|
readonly development?: boolean;
|
|
23
20
|
readonly sentry: () => SentryEnvironment;
|
|
24
21
|
readonly getAuthToken: () => Promise<string>;
|
|
@@ -42,15 +39,7 @@ interface RootProps {
|
|
|
42
39
|
readonly useRoutes?: typeof reactRouterUseRoutes;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
const root: RootFunction = ({
|
|
46
|
-
Messaging,
|
|
47
|
-
I18n,
|
|
48
|
-
queryBus,
|
|
49
|
-
getAuthToken,
|
|
50
|
-
development,
|
|
51
|
-
sentry,
|
|
52
|
-
kameleoon: kameleoonConfig,
|
|
53
|
-
}) => {
|
|
42
|
+
const root: RootFunction = ({ Messaging, I18n, getAuthToken, development, sentry, kameleoon: kameleoonConfig }) => {
|
|
54
43
|
const logger = sentryLogger(sentry);
|
|
55
44
|
const kameleoon = kameleoonConfig();
|
|
56
45
|
|
|
@@ -71,24 +60,22 @@ const root: RootFunction = ({
|
|
|
71
60
|
|
|
72
61
|
return (
|
|
73
62
|
<Messaging includeReactQueryDevTools={Platform.OS === "web"}>
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/>
|
|
91
|
-
</QueryBusProvider>
|
|
63
|
+
<Routing
|
|
64
|
+
I18n={I18n}
|
|
65
|
+
basePath={basePath}
|
|
66
|
+
customer={customer}
|
|
67
|
+
getAuthToken={getAuthToken}
|
|
68
|
+
kameleoon={kameleoon}
|
|
69
|
+
layout={layout}
|
|
70
|
+
locale={locale}
|
|
71
|
+
order={order}
|
|
72
|
+
subscription={subscription}
|
|
73
|
+
useRedirect={useRedirect}
|
|
74
|
+
useRoutes={useRoutes}
|
|
75
|
+
onCheckoutSubmitted={onCheckoutSubmitted}
|
|
76
|
+
onI18nError={development ? undefined : handleOnI18nError}
|
|
77
|
+
onNotAccessible={onNotAccessible}
|
|
78
|
+
/>
|
|
92
79
|
</Messaging>
|
|
93
80
|
);
|
|
94
81
|
};
|
|
@@ -1,75 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Logger } from "@lookiero/sty-psp-logging";
|
|
4
|
-
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
5
|
-
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
6
|
-
import { I18nMessages } from "../i18n/i18n";
|
|
7
|
-
|
|
8
|
-
const PAYMENT_ERROR = "ERROR";
|
|
9
|
-
const PAYMENT_SUCCESS = "PAYMENT_INSTRUMENT_UPDATED";
|
|
10
|
-
|
|
11
|
-
interface Message {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
}
|
|
14
|
-
interface OnSuccessFunctionArgs {
|
|
15
|
-
readonly message: Message;
|
|
16
|
-
}
|
|
17
|
-
interface OnSuccessFunction {
|
|
18
|
-
(args: OnSuccessFunctionArgs): void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Toaster {
|
|
22
|
-
readonly id: string;
|
|
23
|
-
}
|
|
24
|
-
interface Error {
|
|
25
|
-
readonly toaster?: Toaster;
|
|
26
|
-
}
|
|
27
|
-
interface OnErrorFunctionArgs {
|
|
28
|
-
readonly error: Error;
|
|
29
|
-
}
|
|
30
|
-
interface OnErrorFunction {
|
|
31
|
-
(args: OnErrorFunctionArgs): void;
|
|
32
|
-
}
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { PaymentPayload, Section, usePaymentStatusManager } from "@lookiero/payments-front";
|
|
33
3
|
|
|
34
4
|
interface UsePaymentInstrumentEventsFunctionArgs {
|
|
35
|
-
readonly
|
|
5
|
+
readonly onSuccess: (payload: PaymentPayload) => void;
|
|
6
|
+
readonly onError: (payload: PaymentPayload) => void;
|
|
36
7
|
}
|
|
37
8
|
|
|
38
9
|
interface UsePaymentInstrumentEventsFunction {
|
|
39
10
|
(args: UsePaymentInstrumentEventsFunctionArgs): void;
|
|
40
11
|
}
|
|
41
12
|
|
|
42
|
-
const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction = ({
|
|
43
|
-
const
|
|
13
|
+
const usePaymentInstrumentEvents: UsePaymentInstrumentEventsFunction = ({ onSuccess, onError }) => {
|
|
14
|
+
const refreshStatus = usePaymentStatusManager(Section.BOX_CHECKOUT);
|
|
44
15
|
|
|
45
|
-
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const { isLoading, consumePayload } = refreshStatus;
|
|
46
18
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
19
|
+
if (isLoading) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
51
22
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
level: NotificationLevel.ERROR,
|
|
58
|
-
});
|
|
23
|
+
consumePayload((payload) => {
|
|
24
|
+
if (payload.success) {
|
|
25
|
+
onSuccess(payload);
|
|
26
|
+
} else {
|
|
27
|
+
onError(payload);
|
|
59
28
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
subscribe({ event: PAYMENT_ERROR }, onError);
|
|
66
|
-
subscribe({ event: PAYMENT_SUCCESS }, onSuccess);
|
|
67
|
-
|
|
68
|
-
return () => {
|
|
69
|
-
unsubscribe({ event: PAYMENT_ERROR }, onError);
|
|
70
|
-
unsubscribe({ event: PAYMENT_SUCCESS }, onSuccess);
|
|
71
|
-
};
|
|
72
|
-
}, [subscribe, unsubscribe, createNotification, onError, onSuccess]);
|
|
29
|
+
});
|
|
30
|
+
}, [onError, onSuccess, refreshStatus]);
|
|
73
31
|
};
|
|
74
32
|
|
|
75
33
|
export { usePaymentInstrumentEvents };
|
|
@@ -6,11 +6,9 @@ import { PaymentFlowRef } from "@lookiero/payments-front";
|
|
|
6
6
|
import { ChargeStatus } from "@lookiero/payments-front/build/infrastructure/CheckoutAPI";
|
|
7
7
|
import { Logger } from "@lookiero/sty-psp-logging";
|
|
8
8
|
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
9
|
-
import { CheckoutBookingProjection } from "../../../projection/checkoutBooking/checkoutBooking";
|
|
10
9
|
import { useSubmitCheckout } from "../../domain/checkout/react/useSubmitCheckout";
|
|
11
10
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
12
11
|
import { paymentFlowPayload as mockPaymentFlowPayload } from "../../projection/payment/paymentFlowPayload.mock";
|
|
13
|
-
import { useQueryBus } from "./useQueryBus";
|
|
14
12
|
import { useSubmitCheckout as sut } from "./useSubmitCheckout";
|
|
15
13
|
|
|
16
14
|
const checkoutId = "9c450400-0cd7-44a4-b0e3-e0002a9bf8df";
|
|
@@ -20,7 +18,6 @@ const errorChargeStatuses = Object.values(ChargeStatus).filter((status) => statu
|
|
|
20
18
|
const logger = mock<Logger>();
|
|
21
19
|
|
|
22
20
|
jest.mock("@lookiero/sty-psp-notifications");
|
|
23
|
-
jest.mock("./useQueryBus");
|
|
24
21
|
jest.mock("../../domain/checkout/react/useSubmitCheckout");
|
|
25
22
|
jest.mock("../../domain/checkoutBooking/react/useBlockCheckoutBooking");
|
|
26
23
|
|
|
@@ -41,7 +38,6 @@ describe("useSubmitCheckout custom hook", () => {
|
|
|
41
38
|
},
|
|
42
39
|
};
|
|
43
40
|
|
|
44
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
45
41
|
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
46
42
|
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
47
43
|
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.SUCCESS]);
|
|
@@ -90,7 +86,6 @@ describe("useSubmitCheckout custom hook", () => {
|
|
|
90
86
|
},
|
|
91
87
|
};
|
|
92
88
|
|
|
93
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
94
89
|
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
95
90
|
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
96
91
|
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.SUCCESS]);
|
|
@@ -131,7 +126,6 @@ describe("useSubmitCheckout custom hook", () => {
|
|
|
131
126
|
},
|
|
132
127
|
};
|
|
133
128
|
|
|
134
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
135
129
|
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.ERROR]);
|
|
136
130
|
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.IDLE]);
|
|
137
131
|
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.IDLE]);
|
|
@@ -172,7 +166,6 @@ describe("useSubmitCheckout custom hook", () => {
|
|
|
172
166
|
},
|
|
173
167
|
};
|
|
174
168
|
|
|
175
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
176
169
|
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
177
170
|
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
178
171
|
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.IDLE]);
|
|
@@ -219,7 +212,6 @@ describe("useSubmitCheckout custom hook", () => {
|
|
|
219
212
|
},
|
|
220
213
|
};
|
|
221
214
|
|
|
222
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: false }) as CheckoutBookingProjection);
|
|
223
215
|
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
224
216
|
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.ERROR]);
|
|
225
217
|
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
@@ -244,54 +236,4 @@ describe("useSubmitCheckout custom hook", () => {
|
|
|
244
236
|
expect(mockOnError).toHaveBeenCalled();
|
|
245
237
|
});
|
|
246
238
|
});
|
|
247
|
-
|
|
248
|
-
test("returns submitCheckout error as the status right after calling 'submitCheckout' if CheckoutBooking isExpired", async () => {
|
|
249
|
-
const mockBlockCheckoutBooking = jest.fn();
|
|
250
|
-
const mockSubmitCheckout = jest.fn();
|
|
251
|
-
const mockCreateToastNotification = jest.fn();
|
|
252
|
-
const mockOnError = jest.fn();
|
|
253
|
-
const mockOnSuccess = jest.fn();
|
|
254
|
-
const mockPaymentFlowRef: RefObject<PaymentFlowRef> = {
|
|
255
|
-
current: {
|
|
256
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
257
|
-
startLegacyBoxCheckout: jest.fn().mockImplementation((_payload, callback) => {
|
|
258
|
-
callback({ status: ChargeStatus.EXECUTED, final: true });
|
|
259
|
-
}),
|
|
260
|
-
startCheckout: jest.fn(),
|
|
261
|
-
},
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
(useQueryBus as jest.Mock).mockReturnValue(() => ({ isExpired: true }) as CheckoutBookingProjection);
|
|
265
|
-
(useBlockCheckoutBooking as jest.Mock).mockReturnValue([mockBlockCheckoutBooking, CommandStatus.SUCCESS]);
|
|
266
|
-
(useCreateToastNotification as jest.Mock).mockReturnValue([mockCreateToastNotification, CommandStatus.SUCCESS]);
|
|
267
|
-
(useSubmitCheckout as jest.Mock).mockReturnValue([mockSubmitCheckout, CommandStatus.SUCCESS]);
|
|
268
|
-
|
|
269
|
-
const { result } = renderHook(() =>
|
|
270
|
-
sut({
|
|
271
|
-
checkoutId,
|
|
272
|
-
checkoutBookingId,
|
|
273
|
-
paymentFlowRef: mockPaymentFlowRef,
|
|
274
|
-
onError: mockOnError,
|
|
275
|
-
onSuccess: mockOnSuccess,
|
|
276
|
-
logger,
|
|
277
|
-
}),
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
await act(async () => {
|
|
281
|
-
const [submitCheckout] = result.current;
|
|
282
|
-
await submitCheckout({ paymentFlowPayload: mockPaymentFlowPayload, sizeChangeEnabled: true });
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
await waitFor(() => {
|
|
286
|
-
const [, status] = result.current;
|
|
287
|
-
|
|
288
|
-
expect(mockBlockCheckoutBooking).toHaveBeenCalled();
|
|
289
|
-
expect(mockCreateToastNotification).not.toHaveBeenCalled();
|
|
290
|
-
expect(mockSubmitCheckout).not.toHaveBeenCalled();
|
|
291
|
-
|
|
292
|
-
expect(status).toBe("error");
|
|
293
|
-
expect(mockOnSuccess).not.toHaveBeenCalled();
|
|
294
|
-
expect(mockOnError).toHaveBeenCalled();
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
239
|
});
|
|
@@ -1,39 +1,14 @@
|
|
|
1
1
|
import { RefObject, useCallback, useMemo, useState } from "react";
|
|
2
2
|
import { CommandStatus } from "@lookiero/messaging-react";
|
|
3
|
-
import { PaymentFlowRef } from "@lookiero/payments-front";
|
|
3
|
+
import { PaymentFlowRef, PaymentPayload } from "@lookiero/payments-front";
|
|
4
4
|
import { Logger } from "@lookiero/sty-psp-logging";
|
|
5
5
|
import { NotificationLevel, useCreateToastNotification } from "@lookiero/sty-psp-notifications";
|
|
6
|
-
import {
|
|
7
|
-
ViewCheckoutBookingById,
|
|
8
|
-
viewCheckoutBookingById,
|
|
9
|
-
ViewCheckoutBookingByIdResult,
|
|
10
|
-
} from "../../../projection/checkoutBooking/viewCheckoutBookingById";
|
|
11
6
|
import { PaymentFlowPayloadProjection } from "../../../projection/payment/paymentFlowPayload";
|
|
12
7
|
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
13
8
|
import { useSubmitCheckout as useSubmitCheckoutCommand } from "../../domain/checkout/react/useSubmitCheckout";
|
|
14
9
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
15
10
|
import { I18nMessages } from "../i18n/i18n";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
enum ChargeStatus {
|
|
19
|
-
EXECUTED = "EXECUTED",
|
|
20
|
-
REQUIRES_ACTION = "REQUIRES_ACTION",
|
|
21
|
-
REQUIRED_ACTION_CANCELLED = "REQUIRED_ACTION_CANCELLED",
|
|
22
|
-
REJECTED = "REJECTED",
|
|
23
|
-
CANCELLED = "CANCELLED",
|
|
24
|
-
TO_CONFIRM = "TO_CONFIRM",
|
|
25
|
-
ERROR = "ERROR",
|
|
26
|
-
UNKNOWN = "UNKNOWN",
|
|
27
|
-
}
|
|
28
|
-
interface LegacyBoxCheckout {
|
|
29
|
-
readonly status: ChargeStatus;
|
|
30
|
-
readonly toaster: {
|
|
31
|
-
id: string;
|
|
32
|
-
} | null;
|
|
33
|
-
readonly final: boolean;
|
|
34
|
-
readonly id?: string;
|
|
35
|
-
readonly translation?: string;
|
|
36
|
-
}
|
|
11
|
+
import { usePaymentInstrumentEvents } from "./usePaymentInstrumentEvents";
|
|
37
12
|
|
|
38
13
|
type Status = "idle" | "loading" | "success" | "error";
|
|
39
14
|
|
|
@@ -53,7 +28,7 @@ interface UseSubmitCheckoutFunctionArgs {
|
|
|
53
28
|
readonly checkoutBookingId: string;
|
|
54
29
|
readonly paymentFlowRef: RefObject<PaymentFlowRef>;
|
|
55
30
|
readonly onError: () => void;
|
|
56
|
-
readonly onSuccess
|
|
31
|
+
readonly onSuccess: () => void;
|
|
57
32
|
readonly logger: Logger;
|
|
58
33
|
}
|
|
59
34
|
|
|
@@ -69,11 +44,9 @@ const useSubmitCheckout: UseSubmitCheckoutFunction = ({
|
|
|
69
44
|
onSuccess,
|
|
70
45
|
logger,
|
|
71
46
|
}) => {
|
|
72
|
-
const queryBus = useQueryBus();
|
|
73
47
|
const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId, logger });
|
|
74
48
|
const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId, logger });
|
|
75
49
|
const [createNotification] = useCreateToastNotification({ contextId: MESSAGING_CONTEXT_ID, logger });
|
|
76
|
-
const [checkoutBookingExpired, setCheckoutBookingExpired] = useState(false);
|
|
77
50
|
|
|
78
51
|
const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState<Status>("idle");
|
|
79
52
|
|
|
@@ -85,48 +58,37 @@ const useSubmitCheckout: UseSubmitCheckoutFunction = ({
|
|
|
85
58
|
return;
|
|
86
59
|
}
|
|
87
60
|
|
|
88
|
-
|
|
89
|
-
viewCheckoutBookingById({ checkoutBookingId }),
|
|
90
|
-
);
|
|
61
|
+
setStartLegacyBoxCheckoutStatus("loading");
|
|
91
62
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
paymentFlowRef.current?.startLegacyBoxCheckout(paymentFlowPayload);
|
|
66
|
+
},
|
|
67
|
+
[paymentFlowRef, blockCheckoutBooking],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const onPaymentSuccess = useCallback(async () => {
|
|
71
|
+
setStartLegacyBoxCheckoutStatus("success");
|
|
72
|
+
|
|
73
|
+
await submitCheckoutCommand();
|
|
74
|
+
|
|
75
|
+
createNotification({
|
|
76
|
+
bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
|
|
77
|
+
level: NotificationLevel.SUCCESS,
|
|
78
|
+
});
|
|
79
|
+
}, [createNotification, submitCheckoutCommand]);
|
|
80
|
+
const onPaymentError = useCallback(
|
|
81
|
+
(payload: PaymentPayload) => {
|
|
82
|
+
setStartLegacyBoxCheckoutStatus("error");
|
|
96
83
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
async ({ status, toaster, final }: LegacyBoxCheckout) => {
|
|
102
|
-
setStartLegacyBoxCheckoutStatus("loading");
|
|
103
|
-
|
|
104
|
-
if (final) {
|
|
105
|
-
if (status === ChargeStatus.EXECUTED) {
|
|
106
|
-
setStartLegacyBoxCheckoutStatus("success");
|
|
107
|
-
await submitCheckoutCommand();
|
|
108
|
-
onSuccess?.();
|
|
109
|
-
} else {
|
|
110
|
-
createNotification({
|
|
111
|
-
level: NotificationLevel.ERROR,
|
|
112
|
-
bodyI18nKey: toaster?.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
|
|
113
|
-
});
|
|
114
|
-
setStartLegacyBoxCheckoutStatus("error");
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
);
|
|
84
|
+
createNotification({
|
|
85
|
+
bodyI18nKey: payload.metadata?.toaster?.id || I18nMessages.CHECKOUT_TOAST_PAYMENT_ERROR,
|
|
86
|
+
level: NotificationLevel.ERROR,
|
|
87
|
+
});
|
|
119
88
|
},
|
|
120
|
-
[
|
|
121
|
-
queryBus,
|
|
122
|
-
checkoutBookingId,
|
|
123
|
-
paymentFlowRef,
|
|
124
|
-
blockCheckoutBooking,
|
|
125
|
-
submitCheckoutCommand,
|
|
126
|
-
onSuccess,
|
|
127
|
-
createNotification,
|
|
128
|
-
],
|
|
89
|
+
[createNotification],
|
|
129
90
|
);
|
|
91
|
+
usePaymentInstrumentEvents({ onSuccess: onPaymentSuccess, onError: onPaymentError });
|
|
130
92
|
|
|
131
93
|
const status: Status = useMemo(() => {
|
|
132
94
|
if (
|
|
@@ -141,26 +103,20 @@ const useSubmitCheckout: UseSubmitCheckoutFunction = ({
|
|
|
141
103
|
startLegacyBoxCheckoutStatus === "success" &&
|
|
142
104
|
submitCheckoutCommandStatus === CommandStatus.SUCCESS
|
|
143
105
|
) {
|
|
106
|
+
onSuccess();
|
|
144
107
|
return "success";
|
|
145
108
|
}
|
|
146
109
|
if (
|
|
147
110
|
blockCheckoutBookingStatus === CommandStatus.ERROR ||
|
|
148
111
|
startLegacyBoxCheckoutStatus === "error" ||
|
|
149
|
-
submitCheckoutCommandStatus === CommandStatus.ERROR
|
|
150
|
-
checkoutBookingExpired
|
|
112
|
+
submitCheckoutCommandStatus === CommandStatus.ERROR
|
|
151
113
|
) {
|
|
152
114
|
onError();
|
|
153
115
|
return "error";
|
|
154
116
|
}
|
|
155
117
|
|
|
156
118
|
return "idle";
|
|
157
|
-
}, [
|
|
158
|
-
blockCheckoutBookingStatus,
|
|
159
|
-
startLegacyBoxCheckoutStatus,
|
|
160
|
-
submitCheckoutCommandStatus,
|
|
161
|
-
checkoutBookingExpired,
|
|
162
|
-
onError,
|
|
163
|
-
]);
|
|
119
|
+
}, [blockCheckoutBookingStatus, startLegacyBoxCheckoutStatus, submitCheckoutCommandStatus, onSuccess, onError]);
|
|
164
120
|
|
|
165
121
|
return [submitCheckout, status];
|
|
166
122
|
};
|
|
@@ -48,6 +48,7 @@ enum I18nMessages {
|
|
|
48
48
|
CHECKOUT_TITLE = "checkout.title",
|
|
49
49
|
CHECKOUT_PAY_BUTTON = "checkout.pay_button",
|
|
50
50
|
CHECKOUT_TOAST_PAYMENT_ERROR = "checkout.toast_payment_error",
|
|
51
|
+
CHECKOUT_TOAST_PAYMENT_SUCCESS = "checkout.toast_payment_success",
|
|
51
52
|
CHECKOUT_SUCCESS_MODAL_TITLE = "checkout.success_modal_title",
|
|
52
53
|
CHECKOUT_SUCCESS_MODAL_DESCRIPTION = "checkout.success_modal_description",
|
|
53
54
|
CHECKOUT_SUCCESS_MODAL_BUTTON = "checkout.success_modal_button",
|
|
@@ -4,6 +4,7 @@ import { useNavigate } from "react-router-native";
|
|
|
4
4
|
import { Box, Button, Layout as AuroraLayout, Spinner, Text, useDevice } from "@lookiero/aurora";
|
|
5
5
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
6
6
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
7
|
+
import { Country } from "@lookiero/sty-psp-locale";
|
|
7
8
|
import { Layout as UiLayout, Sticky } from "@lookiero/sty-psp-ui";
|
|
8
9
|
import { CheckoutItemStatus } from "../../../../domain/checkoutItem/model/checkoutItem";
|
|
9
10
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
@@ -116,6 +117,12 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
116
117
|
>
|
|
117
118
|
<Box size={{ L: "2/3" }} style={screen.L && style.desktopListSpacing}>
|
|
118
119
|
<View style={[style.contentWrapper, screen.L && style.desktopContentWrapper]}>
|
|
120
|
+
{country === Country.NL && (
|
|
121
|
+
<View style={style.paymentSelectorNL}>
|
|
122
|
+
<PaymentInstrument useRedirect={useRedirect} />
|
|
123
|
+
</View>
|
|
124
|
+
)}
|
|
125
|
+
|
|
119
126
|
<Text level={3} style={style.title} heading>
|
|
120
127
|
{titleText}
|
|
121
128
|
</Text>
|
|
@@ -139,9 +146,11 @@ const Checkout: FC<CheckoutProps> = ({ children, layout: Layout, useRedirect })
|
|
|
139
146
|
</View>
|
|
140
147
|
))}
|
|
141
148
|
|
|
142
|
-
|
|
143
|
-
<
|
|
144
|
-
|
|
149
|
+
{country !== Country.NL && (
|
|
150
|
+
<View style={style.paymentSelector}>
|
|
151
|
+
<PaymentInstrument useRedirect={useRedirect} />
|
|
152
|
+
</View>
|
|
153
|
+
)}
|
|
145
154
|
</View>
|
|
146
155
|
</Box>
|
|
147
156
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC, useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import { useNavigate } from "react-router-native";
|
|
3
3
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
4
|
-
import { PaymentFlow, PaymentFlowRef } from "@lookiero/payments-front";
|
|
4
|
+
import { PaymentFlow, PaymentFlowRef, Section } from "@lookiero/payments-front";
|
|
5
5
|
import { useLogger } from "@lookiero/sty-psp-logging";
|
|
6
6
|
import { CheckoutItemStatus } from "../../../../../../domain/checkoutItem/model/checkoutItem";
|
|
7
7
|
import { Currency } from "../../../../../../domain/checkoutItem/model/currency";
|
|
@@ -119,7 +119,7 @@ const CheckoutPaymentModal: FC<CheckoutPaymentModalProps> = ({
|
|
|
119
119
|
|
|
120
120
|
if (!dependenciesLoaded) return null;
|
|
121
121
|
|
|
122
|
-
return <PaymentFlow ref={paymentFlowRef} token={authToken} />;
|
|
122
|
+
return <PaymentFlow ref={paymentFlowRef} section={Section.BOX_CHECKOUT} token={authToken} />;
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
export { CheckoutPaymentModal };
|
package/src/infrastructure/ui/views/checkout/components/paymentInstrument/PaymentInstrument.tsx
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import React, { FC
|
|
1
|
+
import React, { FC } from "react";
|
|
2
2
|
import { PaymentInstrumentSelect, Section } from "@lookiero/payments-front";
|
|
3
|
-
import {
|
|
4
|
-
import { usePaymentInstrumentEvents } from "../../../../hooks/usePaymentInstrumentEvents";
|
|
3
|
+
import { useStaticInfo } from "../../../../hooks/useStaticInfo";
|
|
5
4
|
|
|
6
5
|
interface PaymentInstrumentProps {
|
|
7
6
|
readonly useRedirect: () => Record<string, string>;
|
|
8
7
|
}
|
|
9
8
|
const PaymentInstrument: FC<PaymentInstrumentProps> = ({ useRedirect }) => {
|
|
10
|
-
const paymentInstrumentSelectRef = useRef(null);
|
|
11
9
|
const { returnUrl } = useRedirect();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
usePaymentInstrumentEvents({ logger });
|
|
10
|
+
const { customer } = useStaticInfo();
|
|
15
11
|
|
|
16
12
|
return (
|
|
17
13
|
<PaymentInstrumentSelect
|
|
18
|
-
ref={paymentInstrumentSelectRef}
|
|
19
14
|
beforeRedirect={returnUrl ? () => Promise.resolve(returnUrl) : undefined}
|
|
20
15
|
hasError={false}
|
|
21
16
|
section={Section.BOX_CHECKOUT}
|
|
17
|
+
userInformation={{
|
|
18
|
+
email: customer.email,
|
|
19
|
+
name: customer.name,
|
|
20
|
+
}}
|
|
21
|
+
showSingleUsePaymentMethods
|
|
22
22
|
/>
|
|
23
23
|
);
|
|
24
24
|
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from "react";
|
|
2
|
-
import { QueryBus } from "@lookiero/messaging";
|
|
3
|
-
interface QueryBusProviderProps {
|
|
4
|
-
readonly children: ReactNode;
|
|
5
|
-
readonly queryBus: QueryBus;
|
|
6
|
-
}
|
|
7
|
-
declare const QueryBusProvider: FC<QueryBusProviderProps>;
|
|
8
|
-
declare const useQueryBus: () => QueryBus;
|
|
9
|
-
export { useQueryBus, QueryBusProvider };
|