UNPKG

@eristack/qups

Version:

Quantity / unit price / subtotal (QUPS) with 2-of-3 sources of truth, plus modifiers and tax — business line pricing on @eristack/money

103 lines • 3.19 kB
import { Money } from "@eristack/money"; import { AdjustedAmount, type ModifierSpec } from "./modifier.js"; import { Qups, type QupsInput } from "./qups.js"; import { LineTax } from "./tax.js"; export type PricingLineInput = { qups: QupsInput; /** Applied to QUPS subtotal in order. */ modifiers?: readonly ModifierSpec[]; tax?: { ratePercent: string; mode?: "exclusive"; } | { ratePercent: string; mode: "inclusive"; }; }; /** * Full line: QUPS → modifiers → tax. * All math stays in the business layer via Money — UI only displays. */ export declare class PricingLine { readonly qups: Qups; readonly adjusted: AdjustedAmount; readonly tax: LineTax; /** Payable total (tax.gross). */ readonly total: Money; private constructor(); static of(input: PricingLineInput): PricingLine; editQups(patch: Parameters<Qups["edit"]>[0], options?: Parameters<Qups["edit"]>[1]): PricingLine; withModifiers(modifiers: readonly ModifierSpec[]): PricingLine; withRounding(round?: import("@eristack/money").MonetaryOperator): PricingLine; toJSON(): { qups: { truth: "quantity+subtotal" | "quantity+unitPrice" | "unitPrice+subtotal"; quantity: string; quantityRatio: import("./qups.js").QuantityRatio | null; unitPrice: { currency: string; amount: string; }; subtotal: { currency: string; amount: string; }; }; adjusted: { truth: "base+modifiers" | "base+net" | "modifiers+net"; base: { currency: string; amount: string; }; net: { currency: string; amount: string; }; discountTotal: { currency: string; amount: string; }; surchargeTotal: { currency: string; amount: string; }; modifiers: ({ id: string | undefined; kind: import("./modifier.js").ModifierKind; type: "percent"; percent: string; amount?: undefined; } | { percent?: undefined; id: string | undefined; kind: import("./modifier.js").ModifierKind; type: "nominal"; amount: { currency: string; amount: string; }; })[]; }; tax: { truth: "gross+rate" | "net+rate" | "net+tax"; net: { currency: string; amount: string; }; tax: { currency: string; amount: string; }; gross: { currency: string; amount: string; }; ratePercent: string | null; }; total: { currency: string; amount: string; }; }; } //# sourceMappingURL=line.d.ts.map