ShippingCalculator

ShippingCalculator

Documentation generated from shipping-calculator.ts on Feb 19 2019 at 16:20

The ShippingCalculator is used by a ShippingMethod to calculate the price of shipping on a given Order.

Signature

class ShippingCalculator<T extends ShippingCalculatorArgs = {}> {
  readonly code: string;
  readonly description: string;
  readonly args: ShippingCalculatorArgs;
  constructor(config: { args: T; calculate: CalculateShippingFn<T>; code: string; description: string })
  calculate(order: Order, args: ConfigArg[]) => number | Promise<number>;
}

Members

code

property
type:
string

description

property
type:
string

args

property
type:
ShippingCalculatorArgs

constructor

method
type:
(config: { args: T; calculate: CalculateShippingFn<T>; code: string; description: string }) => ShippingCalculator

calculate

method
type:
(order: Order, args: ConfigArg[]) => number | Promise<number>

Calculates the price of shipping for the given Order.

alpha