@lookiero/checkout 0.4.6 → 0.4.7
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/domain/checkout/command/submitCheckout.d.ts +13 -0
- package/dist/domain/checkout/command/submitCheckout.js +4 -0
- package/dist/domain/checkout/model/checkout.d.ts +4 -4
- package/dist/domain/checkout/model/checkout.js +6 -6
- package/dist/domain/checkout/model/checkoutSubmitted.d.ts +13 -0
- package/dist/domain/checkout/model/checkoutSubmitted.js +4 -0
- package/dist/infrastructure/delivery/baseBootstrap.js +3 -3
- package/dist/infrastructure/domain/checkout/model/httpCheckouts.js +2 -2
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsSubmit.d.ts +5 -0
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsSubmit.js +13 -0
- package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.d.ts +13 -0
- package/dist/infrastructure/domain/checkout/react/{useMarkCheckoutAsPaid.js → useSubmitCheckout.js} +7 -7
- package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +3 -3
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +8 -8
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +2 -2
- package/package.json +1 -1
- package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
- package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
- package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
- package/dist/domain/checkout/model/checkoutPaid.js +0 -4
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
- package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
- package/dist/infrastructure/domain/checkout/react/useMarkCheckoutAsPaid.d.ts +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "@lookiero/messaging";
|
|
2
|
+
declare const SUBMIT_CHECKOUT = "submit_checkout";
|
|
3
|
+
interface SubmitCheckoutPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface SubmitCheckout extends Command<typeof SUBMIT_CHECKOUT>, SubmitCheckoutPayload {
|
|
7
|
+
}
|
|
8
|
+
interface SubmitCheckoutFunction {
|
|
9
|
+
(payload: SubmitCheckoutPayload): SubmitCheckout;
|
|
10
|
+
}
|
|
11
|
+
declare const submitCheckout: SubmitCheckoutFunction;
|
|
12
|
+
export type { SubmitCheckout };
|
|
13
|
+
export { SUBMIT_CHECKOUT, submitCheckout };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
|
|
2
|
-
import { MarkCheckoutAsPaid } from "../command/markCheckoutAsPaid";
|
|
3
2
|
import { StartCheckout } from "../command/startCheckout";
|
|
3
|
+
import { SubmitCheckout } from "../command/submitCheckout";
|
|
4
4
|
declare enum CheckoutStatus {
|
|
5
5
|
AVAILABLE = "AVAILABLE",
|
|
6
6
|
NOTIFIED = "NOTIFIED",
|
|
7
7
|
STARTED = "STARTED",
|
|
8
8
|
COMPLETED = "COMPLETED",
|
|
9
|
-
|
|
9
|
+
SUBMITTED = "SUBMITTED",
|
|
10
10
|
EXPIRED = "EXPIRED"
|
|
11
11
|
}
|
|
12
12
|
interface Checkout extends AggregateRoot {
|
|
@@ -17,6 +17,6 @@ interface Checkout extends AggregateRoot {
|
|
|
17
17
|
readonly expiresOn: Date;
|
|
18
18
|
}
|
|
19
19
|
declare const startCheckoutHandler: CommandHandlerFunction<StartCheckout, Checkout>;
|
|
20
|
-
declare const
|
|
20
|
+
declare const submitCheckoutHandler: CommandHandlerFunction<SubmitCheckout, Checkout>;
|
|
21
21
|
export type { Checkout };
|
|
22
|
-
export { CheckoutStatus, startCheckoutHandler,
|
|
22
|
+
export { CheckoutStatus, startCheckoutHandler, submitCheckoutHandler };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import invariant from "tiny-invariant";
|
|
2
|
-
import { checkoutPaid } from "./checkoutPaid";
|
|
3
2
|
import { checkoutStarted } from "./checkoutStarted";
|
|
3
|
+
import { checkoutSubmitted } from "./checkoutSubmitted";
|
|
4
4
|
var CheckoutStatus;
|
|
5
5
|
(function (CheckoutStatus) {
|
|
6
6
|
CheckoutStatus["AVAILABLE"] = "AVAILABLE";
|
|
7
7
|
CheckoutStatus["NOTIFIED"] = "NOTIFIED";
|
|
8
8
|
CheckoutStatus["STARTED"] = "STARTED";
|
|
9
9
|
CheckoutStatus["COMPLETED"] = "COMPLETED";
|
|
10
|
-
CheckoutStatus["
|
|
10
|
+
CheckoutStatus["SUBMITTED"] = "SUBMITTED";
|
|
11
11
|
CheckoutStatus["EXPIRED"] = "EXPIRED";
|
|
12
12
|
})(CheckoutStatus || (CheckoutStatus = {}));
|
|
13
13
|
const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
@@ -20,13 +20,13 @@ const startCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
|
20
20
|
domainEvents: [checkoutStarted({ aggregateId })],
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
const
|
|
23
|
+
const submitCheckoutHandler = () => async ({ aggregateRoot, command }) => {
|
|
24
24
|
const { aggregateId } = command;
|
|
25
25
|
invariant(aggregateRoot.status !== CheckoutStatus.COMPLETED, "Checkout is already completed");
|
|
26
26
|
return {
|
|
27
27
|
...aggregateRoot,
|
|
28
|
-
status: CheckoutStatus.
|
|
29
|
-
domainEvents: [
|
|
28
|
+
status: CheckoutStatus.SUBMITTED,
|
|
29
|
+
domainEvents: [checkoutSubmitted({ aggregateId })],
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
export { CheckoutStatus, startCheckoutHandler,
|
|
32
|
+
export { CheckoutStatus, startCheckoutHandler, submitCheckoutHandler };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
+
declare const CHECKOUT_SUBMITTED = "checkout_submitted";
|
|
3
|
+
interface CheckoutSubmittedPayload {
|
|
4
|
+
readonly aggregateId: string;
|
|
5
|
+
}
|
|
6
|
+
interface CheckoutSubmitted extends DomainEvent<typeof CHECKOUT_SUBMITTED>, CheckoutSubmittedPayload {
|
|
7
|
+
}
|
|
8
|
+
interface CheckoutSubmittedFunction {
|
|
9
|
+
(payload: CheckoutSubmittedPayload): CheckoutSubmitted;
|
|
10
|
+
}
|
|
11
|
+
declare const checkoutSubmitted: CheckoutSubmittedFunction;
|
|
12
|
+
export type { CheckoutSubmitted };
|
|
13
|
+
export { CHECKOUT_SUBMITTED, checkoutSubmitted };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
|
|
2
|
-
import { MARK_CHECKOUT_AS_PAID } from "../../domain/checkout/command/markCheckoutAsPaid";
|
|
3
2
|
import { START_CHECKOUT } from "../../domain/checkout/command/startCheckout";
|
|
4
|
-
import {
|
|
3
|
+
import { SUBMIT_CHECKOUT } from "../../domain/checkout/command/submitCheckout";
|
|
4
|
+
import { submitCheckoutHandler, startCheckoutHandler } from "../../domain/checkout/model/checkout";
|
|
5
5
|
import { BLOCK_CHECKOUT_BOOKING } from "../../domain/checkoutBooking/command/blockCheckoutBooking";
|
|
6
6
|
import { BOOK_CHECKOUT_BOOKING_FOR_CHECKOUT_ITEM } from "../../domain/checkoutBooking/command/bookCheckoutBookingForCheckoutItem";
|
|
7
7
|
import { createNotificationWhenCheckoutBookingExpired } from "../../domain/checkoutBooking/event/createNotificationWhenCheckoutBookingExpired";
|
|
@@ -47,7 +47,7 @@ const baseBootstrap = ({ checkoutByIdView, firstAvailableCheckoutByCustomerIdVie
|
|
|
47
47
|
})
|
|
48
48
|
.query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler)
|
|
49
49
|
.command(START_CHECKOUT, startCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
50
|
-
.command(
|
|
50
|
+
.command(SUBMIT_CHECKOUT, submitCheckoutHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
|
|
51
51
|
.query(VIEW_CHECKOUT_ITEM_BY_ID, viewCheckoutItemByIdHandler, {
|
|
52
52
|
view: checkoutItemByIdView,
|
|
53
53
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import invariant from "tiny-invariant";
|
|
2
2
|
import { viewCheckoutById, } from "../../../../projection/checkout/viewCheckoutById";
|
|
3
|
-
import { httpCheckoutsMarkAsPaid } from "./httpCheckoutsMarkAsPaid";
|
|
4
3
|
import { httpCheckoutsStart } from "./httpCheckoutsStart";
|
|
4
|
+
import { httpCheckoutsSubmit } from "./httpCheckoutsSubmit";
|
|
5
5
|
const toDomain = (checkout) => {
|
|
6
6
|
invariant(checkout, "No checkout found!");
|
|
7
7
|
return {
|
|
@@ -19,7 +19,7 @@ const getCheckout = ({ queryBus }) => async (aggregateId) => toDomain(await quer
|
|
|
19
19
|
const saveCheckout = ({ httpPost }) => async (aggregateRoot) => {
|
|
20
20
|
await Promise.all([
|
|
21
21
|
httpCheckoutsStart({ httpPost })(aggregateRoot),
|
|
22
|
-
|
|
22
|
+
httpCheckoutsSubmit({ httpPost })(aggregateRoot),
|
|
23
23
|
]);
|
|
24
24
|
};
|
|
25
25
|
export { getCheckout, saveCheckout };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CHECKOUT_SUBMITTED } from "../../../../domain/checkout/model/checkoutSubmitted";
|
|
2
|
+
const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
|
|
3
|
+
const httpCheckoutsSubmit = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
+
const checkoutSubmitted = domainEvents.find(isCheckoutSubmitted);
|
|
5
|
+
if (!checkoutSubmitted) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
await httpPost({
|
|
9
|
+
endpoint: "/submit-checkout",
|
|
10
|
+
body: { checkoutId: aggregateId },
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { httpCheckoutsSubmit };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
+
interface SubmitFunction {
|
|
3
|
+
(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
type UseSubmitCheckout = [submit: SubmitFunction, status: CommandStatus];
|
|
6
|
+
interface UseSubmitCheckoutFunctionArgs {
|
|
7
|
+
readonly checkoutId?: string;
|
|
8
|
+
}
|
|
9
|
+
interface UseSubmitCheckoutFunction {
|
|
10
|
+
(args: UseSubmitCheckoutFunctionArgs): UseSubmitCheckout;
|
|
11
|
+
}
|
|
12
|
+
declare const useSubmitCheckout: UseSubmitCheckoutFunction;
|
|
13
|
+
export { useSubmitCheckout };
|
package/dist/infrastructure/domain/checkout/react/{useMarkCheckoutAsPaid.js → useSubmitCheckout.js}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useCommand } from "@lookiero/messaging-react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import invariant from "tiny-invariant";
|
|
4
|
-
import {
|
|
4
|
+
import { submitCheckout } from "../../../../domain/checkout/command/submitCheckout";
|
|
5
5
|
import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
6
|
-
const
|
|
6
|
+
const useSubmitCheckout = ({ checkoutId }) => {
|
|
7
7
|
const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
|
|
8
|
-
const
|
|
9
|
-
invariant(checkoutId, "CheckoutId must be defined in order to
|
|
10
|
-
return commandBus(
|
|
8
|
+
const submit = useCallback(() => {
|
|
9
|
+
invariant(checkoutId, "CheckoutId must be defined in order to submit checkout");
|
|
10
|
+
return commandBus(submitCheckout({
|
|
11
11
|
aggregateId: checkoutId,
|
|
12
12
|
}));
|
|
13
13
|
}, [checkoutId, commandBus]);
|
|
14
|
-
return [
|
|
14
|
+
return [submit, status];
|
|
15
15
|
};
|
|
16
|
-
export {
|
|
16
|
+
export { useSubmitCheckout };
|
package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery } from "@lookiero/messaging-react";
|
|
2
|
-
import {
|
|
2
|
+
import { CHECKOUT_SUBMITTED } from "../../../../domain/checkout/model/checkoutSubmitted";
|
|
3
3
|
import { CHECKOUT_BOOKING_BOOKED, } from "../../../../domain/checkoutBooking/model/checkoutBookingBooked";
|
|
4
4
|
import { CHECKOUT_BOOKING_EXPIRED, } from "../../../../domain/checkoutBooking/model/checkoutBookingExpired";
|
|
5
5
|
import { CHECKOUT_FEEDBACK_GIVEN, } from "../../../../domain/checkoutFeedback/model/checkoutFeedbackGiven";
|
|
@@ -11,14 +11,14 @@ import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
|
|
|
11
11
|
const isCheckoutItemKept = (event) => event.name === CHECKOUT_ITEM_KEPT;
|
|
12
12
|
const isCheckoutItemReturned = (event) => event.name === CHECKOUT_ITEM_RETURNED;
|
|
13
13
|
const isCheckoutItemReplaced = (event) => event.name === CHECKOUT_ITEM_REPLACED;
|
|
14
|
-
const
|
|
14
|
+
const isCheckoutSubmitted = (event) => event.name === CHECKOUT_SUBMITTED;
|
|
15
15
|
const isCheckoutFeedbackGiven = (event) => event.name === CHECKOUT_FEEDBACK_GIVEN;
|
|
16
16
|
const isCheckoutBookingExpired = (event) => event.name === CHECKOUT_BOOKING_EXPIRED;
|
|
17
17
|
const isCheckoutBookingBooked = (event) => event.name === CHECKOUT_BOOKING_BOOKED;
|
|
18
18
|
const shouldInvalidate = (event) => isCheckoutItemKept(event) ||
|
|
19
19
|
isCheckoutItemReplaced(event) ||
|
|
20
20
|
isCheckoutItemReturned(event) ||
|
|
21
|
-
|
|
21
|
+
isCheckoutSubmitted(event) ||
|
|
22
22
|
isCheckoutFeedbackGiven(event) ||
|
|
23
23
|
isCheckoutBookingExpired(event) ||
|
|
24
24
|
isCheckoutBookingBooked(event);
|
|
@@ -4,11 +4,11 @@ import { useCallback, useMemo, useState } from "react";
|
|
|
4
4
|
import { useCreateNotification } from "../../../shared/notifications";
|
|
5
5
|
import { NotificationLevel } from "../../../shared/notifications/domain/notification/model/notification";
|
|
6
6
|
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
7
|
-
import {
|
|
7
|
+
import { useSubmitCheckout as useSubmitCheckoutCommand } from "../../domain/checkout/react/useSubmitCheckout";
|
|
8
8
|
import { useBlockCheckoutBooking } from "../../domain/checkoutBooking/react/useBlockCheckoutBooking";
|
|
9
9
|
import { I18nMessages } from "../i18n/i18n";
|
|
10
10
|
const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onError }) => {
|
|
11
|
-
const [
|
|
11
|
+
const [submitCheckoutCommand, submitCheckoutCommandStatus] = useSubmitCheckoutCommand({ checkoutId });
|
|
12
12
|
const [blockCheckoutBooking, blockCheckoutBookingStatus] = useBlockCheckoutBooking({ checkoutBookingId });
|
|
13
13
|
const [createNotification] = useCreateNotification({ contextId: MESSAGING_CONTEXT_ID });
|
|
14
14
|
const [startLegacyBoxCheckoutStatus, setStartLegacyBoxCheckoutStatus] = useState("idle");
|
|
@@ -39,31 +39,31 @@ const useSubmitCheckout = ({ checkoutId, checkoutBookingId, paymentFlowRef, onEr
|
|
|
39
39
|
else if (status === ChargeStatus.EXECUTED) {
|
|
40
40
|
setStartLegacyBoxCheckoutStatus("success");
|
|
41
41
|
try {
|
|
42
|
-
await
|
|
42
|
+
await submitCheckoutCommand();
|
|
43
43
|
}
|
|
44
44
|
catch (error) { }
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
}, [blockCheckoutBooking, createNotification,
|
|
47
|
+
}, [blockCheckoutBooking, createNotification, submitCheckoutCommand, paymentFlowRef]);
|
|
48
48
|
const status = useMemo(() => {
|
|
49
49
|
if (blockCheckoutBookingStatus === CommandStatus.LOADING ||
|
|
50
50
|
startLegacyBoxCheckoutStatus === "loading" ||
|
|
51
|
-
|
|
51
|
+
submitCheckoutCommandStatus === CommandStatus.LOADING) {
|
|
52
52
|
return "loading";
|
|
53
53
|
}
|
|
54
54
|
if (blockCheckoutBookingStatus === CommandStatus.SUCCESS &&
|
|
55
55
|
startLegacyBoxCheckoutStatus === "success" &&
|
|
56
|
-
|
|
56
|
+
submitCheckoutCommandStatus === CommandStatus.SUCCESS) {
|
|
57
57
|
return "success";
|
|
58
58
|
}
|
|
59
59
|
if (blockCheckoutBookingStatus === CommandStatus.ERROR ||
|
|
60
60
|
startLegacyBoxCheckoutStatus === "error" ||
|
|
61
|
-
|
|
61
|
+
submitCheckoutCommandStatus === CommandStatus.ERROR) {
|
|
62
62
|
onError();
|
|
63
63
|
return "error";
|
|
64
64
|
}
|
|
65
65
|
return "idle";
|
|
66
|
-
}, [blockCheckoutBookingStatus,
|
|
66
|
+
}, [blockCheckoutBookingStatus, submitCheckoutCommandStatus, onError, startLegacyBoxCheckoutStatus]);
|
|
67
67
|
return [submitCheckout, status];
|
|
68
68
|
};
|
|
69
69
|
export { useSubmitCheckout };
|
|
@@ -34,8 +34,8 @@ const CheckoutMiddleware = ({ customerId, loader = React.createElement(Spinner,
|
|
|
34
34
|
if (checkoutPaymentRouteMatch && !checkoutShown.current) {
|
|
35
35
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.HOME}`, replace: true });
|
|
36
36
|
}
|
|
37
|
-
/* Navigate to the feedback if checkout is
|
|
38
|
-
if (checkout?.status === CheckoutStatus.
|
|
37
|
+
/* Navigate to the feedback if checkout is submitted */
|
|
38
|
+
if (checkout?.status === CheckoutStatus.SUBMITTED &&
|
|
39
39
|
!(feedbackRouteMatch || checkoutRouteMatch || checkoutPaymentRouteMatch)) {
|
|
40
40
|
return React.createElement(Navigate, { to: `${basePath}/${Routes.FEEDBACK}`, replace: true });
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from "@lookiero/messaging";
|
|
2
|
-
declare const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
|
|
3
|
-
interface MarkCheckoutAsPaidPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
}
|
|
6
|
-
interface MarkCheckoutAsPaid extends Command<typeof MARK_CHECKOUT_AS_PAID>, MarkCheckoutAsPaidPayload {
|
|
7
|
-
}
|
|
8
|
-
interface MarkCheckoutAsPaidFunction {
|
|
9
|
-
(payload: MarkCheckoutAsPaidPayload): MarkCheckoutAsPaid;
|
|
10
|
-
}
|
|
11
|
-
declare const markCheckoutAsPaid: MarkCheckoutAsPaidFunction;
|
|
12
|
-
export type { MarkCheckoutAsPaid };
|
|
13
|
-
export { MARK_CHECKOUT_AS_PAID, markCheckoutAsPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DomainEvent } from "@lookiero/messaging";
|
|
2
|
-
declare const CHECKOUT_PAID = "checkout_paid";
|
|
3
|
-
interface CheckoutPaidPayload {
|
|
4
|
-
readonly aggregateId: string;
|
|
5
|
-
}
|
|
6
|
-
interface CheckoutPaid extends DomainEvent<typeof CHECKOUT_PAID>, CheckoutPaidPayload {
|
|
7
|
-
}
|
|
8
|
-
interface CheckoutPaidFunction {
|
|
9
|
-
(payload: CheckoutPaidPayload): CheckoutPaid;
|
|
10
|
-
}
|
|
11
|
-
declare const checkoutPaid: CheckoutPaidFunction;
|
|
12
|
-
export type { CheckoutPaid };
|
|
13
|
-
export { CHECKOUT_PAID, checkoutPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
|
|
2
|
-
const isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
|
|
3
|
-
const httpCheckoutsMarkAsPaid = ({ httpPost }) => async ({ aggregateId, domainEvents }) => {
|
|
4
|
-
const checkoutPaid = domainEvents.find(isCheckoutPaid);
|
|
5
|
-
if (!checkoutPaid) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
await httpPost({
|
|
9
|
-
endpoint: "/mark-checkout-as-paid",
|
|
10
|
-
body: { checkoutId: aggregateId },
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
export { httpCheckoutsMarkAsPaid };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandStatus } from "@lookiero/messaging-react";
|
|
2
|
-
interface MarkAsPaidFunction {
|
|
3
|
-
(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type UseMarkCheckoutAsPaid = [markAsPaid: MarkAsPaidFunction, status: CommandStatus];
|
|
6
|
-
interface UseMarkCheckoutAsPaidFunctionArgs {
|
|
7
|
-
readonly checkoutId?: string;
|
|
8
|
-
}
|
|
9
|
-
interface UseMarkCheckoutAsPaidFunction {
|
|
10
|
-
(args: UseMarkCheckoutAsPaidFunctionArgs): UseMarkCheckoutAsPaid;
|
|
11
|
-
}
|
|
12
|
-
declare const useMarkCheckoutAsPaid: UseMarkCheckoutAsPaidFunction;
|
|
13
|
-
export { useMarkCheckoutAsPaid };
|