@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.
Files changed (23) hide show
  1. package/dist/domain/checkout/command/submitCheckout.d.ts +13 -0
  2. package/dist/domain/checkout/command/submitCheckout.js +4 -0
  3. package/dist/domain/checkout/model/checkout.d.ts +4 -4
  4. package/dist/domain/checkout/model/checkout.js +6 -6
  5. package/dist/domain/checkout/model/checkoutSubmitted.d.ts +13 -0
  6. package/dist/domain/checkout/model/checkoutSubmitted.js +4 -0
  7. package/dist/infrastructure/delivery/baseBootstrap.js +3 -3
  8. package/dist/infrastructure/domain/checkout/model/httpCheckouts.js +2 -2
  9. package/dist/infrastructure/domain/checkout/model/httpCheckoutsSubmit.d.ts +5 -0
  10. package/dist/infrastructure/domain/checkout/model/httpCheckoutsSubmit.js +13 -0
  11. package/dist/infrastructure/domain/checkout/react/useSubmitCheckout.d.ts +13 -0
  12. package/dist/infrastructure/domain/checkout/react/{useMarkCheckoutAsPaid.js → useSubmitCheckout.js} +7 -7
  13. package/dist/infrastructure/projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId.js +3 -3
  14. package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +8 -8
  15. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +2 -2
  16. package/package.json +1 -1
  17. package/dist/domain/checkout/command/markCheckoutAsPaid.d.ts +0 -13
  18. package/dist/domain/checkout/command/markCheckoutAsPaid.js +0 -4
  19. package/dist/domain/checkout/model/checkoutPaid.d.ts +0 -13
  20. package/dist/domain/checkout/model/checkoutPaid.js +0 -4
  21. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.d.ts +0 -5
  22. package/dist/infrastructure/domain/checkout/model/httpCheckoutsMarkAsPaid.js +0 -13
  23. 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 };
@@ -0,0 +1,4 @@
1
+ import { command } from "@lookiero/messaging";
2
+ const SUBMIT_CHECKOUT = "submit_checkout";
3
+ const submitCheckout = ({ aggregateId }) => command({ aggregateId, name: SUBMIT_CHECKOUT });
4
+ 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
- PAID = "PAID",
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 markCheckoutAsPaidHandler: CommandHandlerFunction<MarkCheckoutAsPaid, Checkout>;
20
+ declare const submitCheckoutHandler: CommandHandlerFunction<SubmitCheckout, Checkout>;
21
21
  export type { Checkout };
22
- export { CheckoutStatus, startCheckoutHandler, markCheckoutAsPaidHandler };
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["PAID"] = "PAID";
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 markCheckoutAsPaidHandler = () => async ({ aggregateRoot, command }) => {
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.PAID,
29
- domainEvents: [checkoutPaid({ aggregateId })],
28
+ status: CheckoutStatus.SUBMITTED,
29
+ domainEvents: [checkoutSubmitted({ aggregateId })],
30
30
  };
31
31
  };
32
- export { CheckoutStatus, startCheckoutHandler, markCheckoutAsPaidHandler };
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 };
@@ -0,0 +1,4 @@
1
+ import { domainEvent } from "@lookiero/messaging";
2
+ const CHECKOUT_SUBMITTED = "checkout_submitted";
3
+ const checkoutSubmitted = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_SUBMITTED });
4
+ 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 { markCheckoutAsPaidHandler, startCheckoutHandler } from "../../domain/checkout/model/checkout";
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(MARK_CHECKOUT_AS_PAID, markCheckoutAsPaidHandler)(getCheckout, saveCheckout, ...checkoutsDependencies)
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
- httpCheckoutsMarkAsPaid({ httpPost })(aggregateRoot),
22
+ httpCheckoutsSubmit({ httpPost })(aggregateRoot),
23
23
  ]);
24
24
  };
25
25
  export { getCheckout, saveCheckout };
@@ -0,0 +1,5 @@
1
+ import { HttpCheckoutsSaveFunction } from "./httpCheckouts";
2
+ interface HttpCheckoutsSubmitFunction extends HttpCheckoutsSaveFunction {
3
+ }
4
+ declare const httpCheckoutsSubmit: HttpCheckoutsSubmitFunction;
5
+ export { httpCheckoutsSubmit };
@@ -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 };
@@ -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 { markCheckoutAsPaid } from "../../../../domain/checkout/command/markCheckoutAsPaid";
4
+ import { submitCheckout } from "../../../../domain/checkout/command/submitCheckout";
5
5
  import { MESSAGING_CONTEXT_ID } from "../../../delivery/baseBootstrap";
6
- const useMarkCheckoutAsPaid = ({ checkoutId }) => {
6
+ const useSubmitCheckout = ({ checkoutId }) => {
7
7
  const [commandBus, status] = useCommand({ contextId: MESSAGING_CONTEXT_ID });
8
- const markAsPaid = useCallback(() => {
9
- invariant(checkoutId, "CheckoutId must be defined in order to mark the checkout as paid");
10
- return commandBus(markCheckoutAsPaid({
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 [markAsPaid, status];
14
+ return [submit, status];
15
15
  };
16
- export { useMarkCheckoutAsPaid };
16
+ export { useSubmitCheckout };
@@ -1,5 +1,5 @@
1
1
  import { useQuery } from "@lookiero/messaging-react";
2
- import { CHECKOUT_PAID } from "../../../../domain/checkout/model/checkoutPaid";
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 isCheckoutPaid = (event) => event.name === CHECKOUT_PAID;
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
- isCheckoutPaid(event) ||
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 { useMarkCheckoutAsPaid } from "../../domain/checkout/react/useMarkCheckoutAsPaid";
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 [markAsPaid, markAsPaidStatus] = useMarkCheckoutAsPaid({ checkoutId });
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 markAsPaid();
42
+ await submitCheckoutCommand();
43
43
  }
44
44
  catch (error) { }
45
45
  }
46
46
  });
47
- }, [blockCheckoutBooking, createNotification, markAsPaid, paymentFlowRef]);
47
+ }, [blockCheckoutBooking, createNotification, submitCheckoutCommand, paymentFlowRef]);
48
48
  const status = useMemo(() => {
49
49
  if (blockCheckoutBookingStatus === CommandStatus.LOADING ||
50
50
  startLegacyBoxCheckoutStatus === "loading" ||
51
- markAsPaidStatus === CommandStatus.LOADING) {
51
+ submitCheckoutCommandStatus === CommandStatus.LOADING) {
52
52
  return "loading";
53
53
  }
54
54
  if (blockCheckoutBookingStatus === CommandStatus.SUCCESS &&
55
55
  startLegacyBoxCheckoutStatus === "success" &&
56
- markAsPaidStatus === CommandStatus.SUCCESS) {
56
+ submitCheckoutCommandStatus === CommandStatus.SUCCESS) {
57
57
  return "success";
58
58
  }
59
59
  if (blockCheckoutBookingStatus === CommandStatus.ERROR ||
60
60
  startLegacyBoxCheckoutStatus === "error" ||
61
- markAsPaidStatus === CommandStatus.ERROR) {
61
+ submitCheckoutCommandStatus === CommandStatus.ERROR) {
62
62
  onError();
63
63
  return "error";
64
64
  }
65
65
  return "idle";
66
- }, [blockCheckoutBookingStatus, markAsPaidStatus, onError, startLegacyBoxCheckoutStatus]);
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 paid */
38
- if (checkout?.status === CheckoutStatus.PAID &&
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -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,4 +0,0 @@
1
- import { command } from "@lookiero/messaging";
2
- const MARK_CHECKOUT_AS_PAID = "mark_checkout_as_paid";
3
- const markCheckoutAsPaid = ({ aggregateId }) => command({ aggregateId, name: MARK_CHECKOUT_AS_PAID });
4
- 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,4 +0,0 @@
1
- import { domainEvent } from "@lookiero/messaging";
2
- const CHECKOUT_PAID = "checkout_paid";
3
- const checkoutPaid = ({ aggregateId }) => domainEvent({ aggregateId, name: CHECKOUT_PAID });
4
- export { CHECKOUT_PAID, checkoutPaid };
@@ -1,5 +0,0 @@
1
- import { HttpCheckoutsSaveFunction } from "./httpCheckouts";
2
- interface HttpCheckoutsMarkAsPaidFunction extends HttpCheckoutsSaveFunction {
3
- }
4
- declare const httpCheckoutsMarkAsPaid: HttpCheckoutsMarkAsPaidFunction;
5
- export { httpCheckoutsMarkAsPaid };
@@ -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 };