fix(core-flows): add no_notification to fulfillment created event (#11507)

what:

- passes no notification toggle to events - fulfillment created and canceled

fixes https://github.com/medusajs/medusa/issues/11505
This commit is contained in:
Riqwan Thamir authored and GitHub committed 2025-02-19 08:05:52 +00:00
1 parent b60e1c855e
commit 30171f3dc4
2 files changed
+7 -9

No files matched your search

@@ -78,10 +78,7 @@ export type CancelOrderFulfillmentValidateOrderStep = {
*/
export const cancelOrderFulfillmentValidateOrder = createStep(
"cancel-fulfillment-validate-order",
({
order,
input,
}: CancelOrderFulfillmentValidateOrderStep) => {
({ order, input }: CancelOrderFulfillmentValidateOrderStep) => {
throwIfOrderIsCancelled({ order })
const fulfillment = order.fulfillments.find(
@@ -162,7 +159,8 @@ function prepareInventoryUpdate({
/**
* The data to cancel an order's fulfillment, along with custom data that's passed to the workflow's hooks.
*/
export type CancelOrderFulfillmentWorkflowInput = OrderWorkflow.CancelOrderFulfillmentWorkflowInput & AdditionalData
export type CancelOrderFulfillmentWorkflowInput =
OrderWorkflow.CancelOrderFulfillmentWorkflowInput & AdditionalData
export const cancelOrderFulfillmentWorkflowId = "cancel-order-fulfillment"
/**
@@ -193,9 +191,7 @@ export const cancelOrderFulfillmentWorkflowId = "cancel-order-fulfillment"
*/
export const cancelOrderFulfillmentWorkflow = createWorkflow(
cancelOrderFulfillmentWorkflowId,
(
input: WorkflowData<CancelOrderFulfillmentWorkflowInput>
) => {
(input: WorkflowData<CancelOrderFulfillmentWorkflowInput>) => {
const order: OrderDTO & { fulfillments: FulfillmentDTO[] } =
useRemoteQueryStep({
entry_point: "orders",
@@ -227,10 +223,11 @@ export const cancelOrderFulfillmentWorkflow = createWorkflow(
prepareInventoryUpdate
)
const eventData = transform({ order, fulfillment }, (data) => {
const eventData = transform({ order, fulfillment, input }, (data) => {
return {
order_id: data.order.id,
fulfillment_id: data.fulfillment.id,
no_notification: data.input.no_notification,
}
})
@@ -467,6 +467,7 @@ export const createOrderFulfillmentWorkflow = createWorkflow(
data: {
order_id: input.order_id,
fulfillment_id: fulfillment.id,
no_notification: input.no_notification,
},
})
)