From 00eb61ecbc2a58cda72fccf8c15f50935ebbba7e Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Thu, 7 Nov 2024 14:09:45 -0300 Subject: [PATCH 01/10] fix(core-flows): create order before payment capture --- .../core-flows/src/payment/workflows/index.ts | 2 - .../payment/workflows/on-payment-processed.ts | 38 ------------------- .../src/payment/workflows/process-payment.ts | 32 +++++++++++++++- .../medusa/src/subscribers/payment-webhook.ts | 10 +---- 4 files changed, 32 insertions(+), 50 deletions(-) delete mode 100644 packages/core/core-flows/src/payment/workflows/on-payment-processed.ts diff --git a/packages/core/core-flows/src/payment/workflows/index.ts b/packages/core/core-flows/src/payment/workflows/index.ts index ee60681180a57..46de7ec09899e 100644 --- a/packages/core/core-flows/src/payment/workflows/index.ts +++ b/packages/core/core-flows/src/payment/workflows/index.ts @@ -1,5 +1,3 @@ export * from "./capture-payment" -export * from "./on-payment-processed" export * from "./process-payment" export * from "./refund-payment" - diff --git a/packages/core/core-flows/src/payment/workflows/on-payment-processed.ts b/packages/core/core-flows/src/payment/workflows/on-payment-processed.ts deleted file mode 100644 index 9ebc24009389e..0000000000000 --- a/packages/core/core-flows/src/payment/workflows/on-payment-processed.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { WebhookActionResult } from "@medusajs/types" -import { createWorkflow, when } from "@medusajs/workflows-sdk" -import { completeCartWorkflow } from "../../cart" -import { useRemoteQueryStep } from "../../common" -import { useQueryStep } from "../../common/steps/use-query" - -export const onPaymentProcessedWorkflowId = "on-payment-processed-workflow" -export const onPaymentProcessedWorkflow = createWorkflow( - onPaymentProcessedWorkflowId, - (input: WebhookActionResult) => { - const paymentSessionResult = useRemoteQueryStep({ - entry_point: "payment_session", - fields: ["payment_collection_id"], - variables: { filters: { id: input.data?.session_id } }, - list: false, - }) - - const cartPaymentCollection = useQueryStep({ - entity: "cart_payment_collection", - fields: ["cart_id"], - filters: { - payment_collection_id: paymentSessionResult.payment_collection_id, - }, - }) - - when({ cartPaymentCollection }, ({ cartPaymentCollection }) => { - return !!cartPaymentCollection.data.length - }).then(() => { - completeCartWorkflow.runAsStep({ - input: { - id: cartPaymentCollection.data[0].cart_id, - }, - }) - }) - - // TODO: Add more cases down the line, e.g. order payments - } -) diff --git a/packages/core/core-flows/src/payment/workflows/process-payment.ts b/packages/core/core-flows/src/payment/workflows/process-payment.ts index b93516e2fe593..9c9155993afe1 100644 --- a/packages/core/core-flows/src/payment/workflows/process-payment.ts +++ b/packages/core/core-flows/src/payment/workflows/process-payment.ts @@ -1,6 +1,7 @@ import { WebhookActionResult } from "@medusajs/types" import { PaymentActions } from "@medusajs/utils" import { createWorkflow, when } from "@medusajs/workflows-sdk" +import { completeCartWorkflow } from "../../cart/workflows/complete-cart" import { useQueryStep } from "../../common/steps/use-query" import { authorizePaymentSessionStep } from "../steps" import { capturePaymentWorkflow } from "./capture-payment" @@ -17,6 +18,31 @@ export const processPaymentWorkflow = createWorkflow( filters: { payment_session_id: input.data?.session_id }, }) + const paymentSessionResult = useQueryStep({ + entity: "payment_session", + fields: ["payment_collection_id"], + filters: { id: input.data?.session_id }, + }) + + const cartPaymentCollection = useQueryStep({ + entity: "cart_payment_collection", + fields: ["cart_id"], + filters: { + payment_collection_id: + paymentSessionResult.data[0].payment_collection_id, + }, + }) + + when({ cartPaymentCollection }, ({ cartPaymentCollection }) => { + return !!cartPaymentCollection.data.length + }).then(() => { + completeCartWorkflow.runAsStep({ + input: { + id: cartPaymentCollection.data[0].cart_id, + }, + }) + }) + when({ input }, ({ input }) => { return ( input.action === PaymentActions.SUCCESSFUL && !!paymentData.data.length @@ -31,8 +57,12 @@ export const processPaymentWorkflow = createWorkflow( }) when({ input }, ({ input }) => { + // Authorize payment session if no Cart is linked to the payment + // When associated with a Cart, the complete cart workflow will handle the authorization return ( - input.action === PaymentActions.AUTHORIZED && !!input.data?.session_id + !cartPaymentCollection.data.length && + input.action === PaymentActions.AUTHORIZED && + !!input.data?.session_id ) }).then(() => { authorizePaymentSessionStep({ diff --git a/packages/medusa/src/subscribers/payment-webhook.ts b/packages/medusa/src/subscribers/payment-webhook.ts index b8c56f8f6d9eb..14d4a29a350a8 100644 --- a/packages/medusa/src/subscribers/payment-webhook.ts +++ b/packages/medusa/src/subscribers/payment-webhook.ts @@ -1,7 +1,4 @@ -import { - onPaymentProcessedWorkflow, - processPaymentWorkflow, -} from "@medusajs/core-flows" +import { processPaymentWorkflow } from "@medusajs/core-flows" import { IPaymentModuleService, ProviderWebhookPayload, @@ -49,11 +46,6 @@ export default async function paymentWebhookhandler({ await processPaymentWorkflow(container).run({ input: processedEvent, }) - - // We process the intended side effects of payment processing separately. - await onPaymentProcessedWorkflow(container).run({ - input: processedEvent, - }) } export const config: SubscriberConfig = { From a362530855047817f9cc8536e893bd9d00341b9d Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Thu, 7 Nov 2024 14:10:33 -0300 Subject: [PATCH 02/10] changeset --- .changeset/thirty-lamps-collect.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/thirty-lamps-collect.md diff --git a/.changeset/thirty-lamps-collect.md b/.changeset/thirty-lamps-collect.md new file mode 100644 index 0000000000000..9b62cebb36aff --- /dev/null +++ b/.changeset/thirty-lamps-collect.md @@ -0,0 +1,6 @@ +--- +"@medusajs/core-flows": patch +"@medusajs/medusa": patch +--- + +Create Order before payment capture From e5ab07a224718ce387b7958d613ee8c4e4cf30b8 Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Thu, 7 Nov 2024 14:23:41 -0300 Subject: [PATCH 03/10] step name --- .../core-flows/src/payment/workflows/process-payment.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/core-flows/src/payment/workflows/process-payment.ts b/packages/core/core-flows/src/payment/workflows/process-payment.ts index 9c9155993afe1..453382a54077b 100644 --- a/packages/core/core-flows/src/payment/workflows/process-payment.ts +++ b/packages/core/core-flows/src/payment/workflows/process-payment.ts @@ -16,12 +16,16 @@ export const processPaymentWorkflow = createWorkflow( entity: "payment", fields: ["id"], filters: { payment_session_id: input.data?.session_id }, + }).config({ + name: "payment-query", }) const paymentSessionResult = useQueryStep({ entity: "payment_session", fields: ["payment_collection_id"], filters: { id: input.data?.session_id }, + }).config({ + name: "payment-session-query", }) const cartPaymentCollection = useQueryStep({ @@ -31,6 +35,8 @@ export const processPaymentWorkflow = createWorkflow( payment_collection_id: paymentSessionResult.data[0].payment_collection_id, }, + }).config({ + name: "cart-payment-query", }) when({ cartPaymentCollection }, ({ cartPaymentCollection }) => { From 27ba67e44d0c4dbecbec0e6d840a2f85838b69ac Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Thu, 7 Nov 2024 14:32:11 -0300 Subject: [PATCH 04/10] handle optional rawData --- packages/medusa/src/subscribers/payment-webhook.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/medusa/src/subscribers/payment-webhook.ts b/packages/medusa/src/subscribers/payment-webhook.ts index 14d4a29a350a8..895159adc3e3a 100644 --- a/packages/medusa/src/subscribers/payment-webhook.ts +++ b/packages/medusa/src/subscribers/payment-webhook.ts @@ -26,7 +26,7 @@ export default async function paymentWebhookhandler({ const input = event.data if ( - (input.payload.rawData as unknown as SerializedBuffer).type === "Buffer" + (input.payload?.rawData as unknown as SerializedBuffer)?.type === "Buffer" ) { input.payload.rawData = Buffer.from( (input.payload.rawData as unknown as SerializedBuffer).data From ae980f7c6d368a00fdcd6c8052dcf5cf6ba086f5 Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Fri, 8 Nov 2024 07:39:05 -0300 Subject: [PATCH 05/10] continue on permanent failure --- .../src/payment/workflows/process-payment.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/core/core-flows/src/payment/workflows/process-payment.ts b/packages/core/core-flows/src/payment/workflows/process-payment.ts index 453382a54077b..5cfdf5ee82caf 100644 --- a/packages/core/core-flows/src/payment/workflows/process-payment.ts +++ b/packages/core/core-flows/src/payment/workflows/process-payment.ts @@ -42,11 +42,15 @@ export const processPaymentWorkflow = createWorkflow( when({ cartPaymentCollection }, ({ cartPaymentCollection }) => { return !!cartPaymentCollection.data.length }).then(() => { - completeCartWorkflow.runAsStep({ - input: { - id: cartPaymentCollection.data[0].cart_id, - }, - }) + completeCartWorkflow + .runAsStep({ + input: { + id: cartPaymentCollection.data[0].cart_id, + }, + }) + .config({ + continueOnPermanentFailure: true, // Continue payment processing even if cart completion fails + }) }) when({ input }, ({ input }) => { From 35852c98a0be94b582d135c72ae8bb84605ad52e Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Mon, 11 Nov 2024 08:15:37 -0300 Subject: [PATCH 06/10] add order transactions on cart complete --- packages/core/core-flows/src/cart/utils/fields.ts | 4 ++++ .../src/cart/workflows/complete-cart.ts | 13 +++++++++++++ .../src/order/steps/add-order-transaction.ts | 15 +++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/packages/core/core-flows/src/cart/utils/fields.ts b/packages/core/core-flows/src/cart/utils/fields.ts index 1de3548e7d612..52a05e85651e8 100644 --- a/packages/core/core-flows/src/cart/utils/fields.ts +++ b/packages/core/core-flows/src/cart/utils/fields.ts @@ -85,6 +85,10 @@ export const completeCartFields = [ "region.*", "payment_collection.*", "payment_collection.payment_sessions.*", + "payment_collection.payments.currency_code", + "payment_collection.payments.captures.id", + "payment_collection.payments.captures.raw_amount", + "payment_collection.payments.captures.amount", "items.variant.id", "items.variant.product.id", "items.variant.manage_inventory", diff --git a/packages/core/core-flows/src/cart/workflows/complete-cart.ts b/packages/core/core-flows/src/cart/workflows/complete-cart.ts index e47a5f9973af2..ad421b5fe21bf 100644 --- a/packages/core/core-flows/src/cart/workflows/complete-cart.ts +++ b/packages/core/core-flows/src/cart/workflows/complete-cart.ts @@ -104,6 +104,18 @@ export const completeCartWorkflow = createWorkflow( }) const cartToOrder = transform({ cart }, ({ cart }) => { + const transactions = + cart.payment_collection?.payments?.flatMap((payment) => + payment.captures.map((capture) => { + return { + amount: capture.raw_amount ?? capture.amount, + currency_code: payment.currency_code, + reference: "capture", + reference_id: capture.id, + } + }) + ) ?? [] + const allItems = (cart.items ?? []).map((item) => { return prepareLineItemData({ item, @@ -158,6 +170,7 @@ export const completeCartWorkflow = createWorkflow( shipping_methods: shippingMethods, metadata: cart.metadata, promo_codes: promoCodes, + transactions, } }) diff --git a/packages/core/core-flows/src/order/steps/add-order-transaction.ts b/packages/core/core-flows/src/order/steps/add-order-transaction.ts index 4e3a2a03d48e3..6896b1f3e9219 100644 --- a/packages/core/core-flows/src/order/steps/add-order-transaction.ts +++ b/packages/core/core-flows/src/order/steps/add-order-transaction.ts @@ -11,6 +11,21 @@ export const addOrderTransactionStep = createStep( async (data: CreateOrderTransactionDTO, { container }) => { const service = container.resolve(Modules.ORDER) + const existing = await service.listOrderTransactions( + { + order_id: data.order_id, + reference: data.reference, + reference_id: data.reference_id, + }, + { + select: ["id"], + } + ) + + if (existing.length) { + return new StepResponse(null) + } + const created = await service.addOrderTransactions(data) return new StepResponse(created, created.id) From da30f62ce900885416ddaf746a6c20e33b6a3a8d Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Mon, 11 Nov 2024 15:57:06 -0300 Subject: [PATCH 07/10] order transactions --- .../core/core-flows/src/cart/utils/fields.ts | 4 -- .../src/cart/workflows/complete-cart.ts | 22 +++++----- .../src/order/steps/add-order-transaction.ts | 44 ++++++++++++------- .../steps/authorize-payment-session.ts | 7 ++- .../src/payment/workflows/capture-payment.ts | 16 ++++--- packages/core/types/src/payment/common.ts | 10 +++++ 6 files changed, 62 insertions(+), 41 deletions(-) diff --git a/packages/core/core-flows/src/cart/utils/fields.ts b/packages/core/core-flows/src/cart/utils/fields.ts index 52a05e85651e8..1de3548e7d612 100644 --- a/packages/core/core-flows/src/cart/utils/fields.ts +++ b/packages/core/core-flows/src/cart/utils/fields.ts @@ -85,10 +85,6 @@ export const completeCartFields = [ "region.*", "payment_collection.*", "payment_collection.payment_sessions.*", - "payment_collection.payments.currency_code", - "payment_collection.payments.captures.id", - "payment_collection.payments.captures.raw_amount", - "payment_collection.payments.captures.amount", "items.variant.id", "items.variant.product.id", "items.variant.manage_inventory", diff --git a/packages/core/core-flows/src/cart/workflows/complete-cart.ts b/packages/core/core-flows/src/cart/workflows/complete-cart.ts index ad421b5fe21bf..b991a253fc60c 100644 --- a/packages/core/core-flows/src/cart/workflows/complete-cart.ts +++ b/packages/core/core-flows/src/cart/workflows/complete-cart.ts @@ -77,7 +77,7 @@ export const completeCartWorkflow = createWorkflow( const paymentSessions = validateCartPaymentsStep({ cart }) - authorizePaymentSessionStep({ + const payment = authorizePaymentSessionStep({ // We choose the first payment session, as there will only be one active payment session // This might change in the future. id: paymentSessions[0].id, @@ -103,18 +103,16 @@ export const completeCartWorkflow = createWorkflow( } }) - const cartToOrder = transform({ cart }, ({ cart }) => { + const cartToOrder = transform({ cart, payment }, ({ cart, payment }) => { const transactions = - cart.payment_collection?.payments?.flatMap((payment) => - payment.captures.map((capture) => { - return { - amount: capture.raw_amount ?? capture.amount, - currency_code: payment.currency_code, - reference: "capture", - reference_id: capture.id, - } - }) - ) ?? [] + payment?.captures?.map((capture) => { + return { + amount: capture.raw_amount ?? capture.amount, + currency_code: payment.currency_code, + reference: "capture", + reference_id: capture.id, + } + }) ?? [] const allItems = (cart.items ?? []).map((item) => { return prepareLineItemData({ diff --git a/packages/core/core-flows/src/order/steps/add-order-transaction.ts b/packages/core/core-flows/src/order/steps/add-order-transaction.ts index 6896b1f3e9219..841f5a0a1e81e 100644 --- a/packages/core/core-flows/src/order/steps/add-order-transaction.ts +++ b/packages/core/core-flows/src/order/steps/add-order-transaction.ts @@ -4,34 +4,44 @@ import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk" export const addOrderTransactionStepId = "add-order-transaction" /** - * This step creates an order transaction. + * This step creates order transactions. */ export const addOrderTransactionStep = createStep( addOrderTransactionStepId, - async (data: CreateOrderTransactionDTO, { container }) => { + async ( + data: CreateOrderTransactionDTO | CreateOrderTransactionDTO[], + { container } + ) => { const service = container.resolve(Modules.ORDER) - const existing = await service.listOrderTransactions( - { - order_id: data.order_id, - reference: data.reference, - reference_id: data.reference_id, - }, - { - select: ["id"], - } - ) + const trxsData = Array.isArray(data) ? data : [data] + + for (const trx of trxsData) { + const existing = await service.listOrderTransactions( + { + order_id: trx.order_id, + reference: trx.reference, + reference_id: trx.reference_id, + }, + { + select: ["id"], + } + ) - if (existing.length) { - return new StepResponse(null) + if (existing.length) { + return new StepResponse(null) + } } - const created = await service.addOrderTransactions(data) + const created = await service.addOrderTransactions(trxsData) - return new StepResponse(created, created.id) + return new StepResponse( + Array.isArray(data) ? created : created[0], + created.map((c) => c.id) + ) }, async (id, { container }) => { - if (!id) { + if (!id?.length) { return } diff --git a/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts b/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts index 6f6f9ba27cd23..8cc644827a5b4 100644 --- a/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts +++ b/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts @@ -40,7 +40,12 @@ export const authorizePaymentSessionStep = createStep( ) } - const paymentSession = await paymentModule.retrievePaymentSession(input.id) + const paymentSession = await paymentModule.retrievePaymentSession( + input.id, + { + relations: ["payments", "payments.captures"], + } + ) // Throw a special error type when the status is requires_more as it requires a specific further action // from the consumer diff --git a/packages/core/core-flows/src/payment/workflows/capture-payment.ts b/packages/core/core-flows/src/payment/workflows/capture-payment.ts index 49d416e86e37b..a426d562aecf9 100644 --- a/packages/core/core-flows/src/payment/workflows/capture-payment.ts +++ b/packages/core/core-flows/src/payment/workflows/capture-payment.ts @@ -39,13 +39,15 @@ export const capturePaymentWorkflow = createWorkflow( const orderTransactionData = transform( { input, payment, orderPayment }, ({ input, payment, orderPayment }) => { - return { - order_id: orderPayment.order.id, - amount: input.amount ?? payment.raw_amount ?? payment.amount, - currency_code: payment.currency_code, - reference_id: payment.id, - reference: "capture", - } + return payment.captures?.map((capture) => { + return { + order_id: orderPayment.order.id, + amount: input.amount ?? capture.raw_amount ?? capture.amount, + currency_code: payment.currency_code, + reference_id: capture.id, + reference: "capture", + } + }) } ) diff --git a/packages/core/types/src/payment/common.ts b/packages/core/types/src/payment/common.ts index de4043f63095d..4dca5c8c7e039 100644 --- a/packages/core/types/src/payment/common.ts +++ b/packages/core/types/src/payment/common.ts @@ -471,6 +471,11 @@ export interface CaptureDTO { */ amount: BigNumberValue + /** + * The raw captured amount. + */ + raw_amount?: BigNumberValue + /** * The creation date of the capture. */ @@ -502,6 +507,11 @@ export interface RefundDTO { */ amount: BigNumberValue + /** + * The raw refunded amount. + */ + raw_amount?: BigNumberValue + /** * The id of the refund_reason that is associated with the refund */ From 2d5c28be376296327c5510127ef36e3525f84aa3 Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Mon, 11 Nov 2024 18:42:21 -0300 Subject: [PATCH 08/10] payment --- .../core-flows/src/payment/steps/authorize-payment-session.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts b/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts index 8cc644827a5b4..d706e61b7dba8 100644 --- a/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts +++ b/packages/core/core-flows/src/payment/steps/authorize-payment-session.ts @@ -43,7 +43,7 @@ export const authorizePaymentSessionStep = createStep( const paymentSession = await paymentModule.retrievePaymentSession( input.id, { - relations: ["payments", "payments.captures"], + relations: ["payment", "payment.captures"], } ) From fdbb343c47f24a7a1e1906360c319df2cd0dccf9 Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Tue, 12 Nov 2024 10:03:53 -0300 Subject: [PATCH 09/10] implement delay --- .../src/services/event-bus-local.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/modules/event-bus-local/src/services/event-bus-local.ts b/packages/modules/event-bus-local/src/services/event-bus-local.ts index 5ad982a54a0b7..a17d045d70c1e 100644 --- a/packages/modules/event-bus-local/src/services/event-bus-local.ts +++ b/packages/modules/event-bus-local/src/services/event-bus-local.ts @@ -9,6 +9,7 @@ import { } from "@medusajs/framework/types" import { AbstractEventBusModuleService } from "@medusajs/framework/utils" import { EventEmitter } from "events" +import { setTimeout } from "timers/promises" import { ulid } from "ulid" type InjectedDependencies = { @@ -86,7 +87,13 @@ export default class LocalEventBusService extends AbstractEventBusModuleService await this.groupEvent(eventGroupId, eventData) } else { const { options, ...eventBody } = eventData - this.eventEmitter_.emit(eventData.name, eventBody) + + const options_ = options as { delay: number } + const delay = options?.delay ? setTimeout : async () => {} + + delay(options_?.delay).then(() => + this.eventEmitter_.emit(eventData.name, eventBody) + ) } } @@ -108,7 +115,12 @@ export default class LocalEventBusService extends AbstractEventBusModuleService for (const event of groupedEvents) { const { options, ...eventBody } = event - this.eventEmitter_.emit(event.name, eventBody) + const options_ = options as { delay: number } + const delay = options?.delay ? setTimeout : async () => {} + + delay(options_?.delay).then(() => + this.eventEmitter_.emit(event.name, eventBody) + ) } await this.clearGroupedEvents(eventGroupId) From c1a65b142e2ee4d1825a1bfa38d17febef2c03a6 Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Tue, 12 Nov 2024 10:22:48 -0300 Subject: [PATCH 10/10] add option --- .../src/services/__tests__/event-bus-local.ts | 1 + .../modules/event-bus-local/src/services/event-bus-local.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/modules/event-bus-local/src/services/__tests__/event-bus-local.ts b/packages/modules/event-bus-local/src/services/__tests__/event-bus-local.ts index c31da43b8ffa4..89b651f493b42 100644 --- a/packages/modules/event-bus-local/src/services/__tests__/event-bus-local.ts +++ b/packages/modules/event-bus-local/src/services/__tests__/event-bus-local.ts @@ -123,6 +123,7 @@ describe("LocalEventBusService", () => { data: { test: "1234" }, metadata: { eventGroupId: "test" }, name: "test-event", + options: {}, }) jest.clearAllMocks() diff --git a/packages/modules/event-bus-local/src/services/event-bus-local.ts b/packages/modules/event-bus-local/src/services/event-bus-local.ts index a17d045d70c1e..3d33cf5cc13c8 100644 --- a/packages/modules/event-bus-local/src/services/event-bus-local.ts +++ b/packages/modules/event-bus-local/src/services/event-bus-local.ts @@ -70,7 +70,10 @@ export default class LocalEventBusService extends AbstractEventBusModuleService ) } - await this.groupOrEmitEvent(eventData) + await this.groupOrEmitEvent({ + ...eventData, + options, + }) } }