feat(types,fulfillment): ability to delete a canceled fulfillment (#10602)
This commit is contained in:
@@ -653,6 +653,28 @@ export default class FulfillmentModuleService
|
||||
)
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
async deleteFulfillment(
|
||||
id: string,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
const fulfillment = await this.fulfillmentService_.retrieve(
|
||||
id,
|
||||
{},
|
||||
sharedContext
|
||||
)
|
||||
|
||||
if (!isPresent(fulfillment.canceled_at)) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
`Fulfillment with id ${fulfillment.id} needs to be canceled first before deleting`
|
||||
)
|
||||
}
|
||||
|
||||
await this.fulfillmentService_.delete(id, sharedContext)
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
async createReturnFulfillment(
|
||||
|
||||
Reference in New Issue
Block a user