Open MercatoDocsSearch docsAPI reference

Framework

Sales services

A custom quote import should use the same total calculation and numbering rules as a quote created in the back office. Resolve the Sales services from the current container and let them perform the operation on behalf of the importing module.

Available services

Service keyDescription
salesCalculationServiceRuns the full document and line calculation pipeline. Always use this instead of inline price math.
taxCalculationServiceHandles tax calculation for sales documents.
salesDocumentNumberGeneratorGenerates sequential document numbers for orders, quotes, invoices, etc.

Usage

// src/modules/<your_module>/di.ts
export function register(container) {
  // salesCalculationService is already registered by the sales module
}

// In a command handler or service:
const calcService = container.resolve('salesCalculationService')

See also

Previous: Search indexes for sales records · Next: Built-in Subscribers