Skip to content

OrderApprovalModule

Module in @evolve-framework/medusa

Order approvals, served by @evolve-framework/medusa-plugin-approval.

The two models meet awkwardly and it is worth being plain about where. The contract's OrderApproval.order is non-null: it assumes an order exists while approval is pending, which is how commercetools works. Medusa gates the cart and creates the order only once every signature is in — the better side of the difference, because completing a cart authorises payment, and holding money before anyone approved is what a spending control exists to prevent.

So a pending approval has no order to point at, and order reports that rather than inventing one. What does map cleanly is the configuration: the company's two switches become the contract's approval rules, and deciding an approval works whenever the caller has its id.

Composing this requires BusinessUnitModule: every approval field hangs off BusinessUnit.

import { OrderApprovalModule } from "@evolve-framework/medusa/modules";

Serves the Order approval part of the GraphQL API: orderApprovalRuleCreate, orderApprovalRuleDelete, orderApprovalRuleStatusUpdate, orderApprovalRuleUpdate, orderApprovalStatusUpdate.

new OrderApprovalModule()

Extends AbstractModule<unknown>.

The same module on commercetools and sfcc.