import { ISquareVendorMath, ISquareVendorMetadata, IToastVendorMath, IToastVendorMetadata } from './vendor-provider'; export enum VendorProviderEnum { TOAST = 'toast', SQUARE = 'square', } export interface IVendorMetadata {} export enum VendorCustomMathStrategyEnum { OLD = 'old', } export type VendorMathStrategyType = VendorProviderEnum | VendorCustomMathStrategyEnum; export enum VendorMathRoundingTypeEnum { HALF_EVEN = 'HALF_EVEN', HALF_UP = 'HALF_UP', HALF_DOWN = 'HALF_DOWN', ALWAYS_ROUND_DOWN = 'ALWAYS_ROUND_DOWN', ALWAYS_ROUND_UP = 'ALWAYS_ROUND_UP', } /** * @link https://doc.toasttab.com/0IV1p/roundingOptions.html */ export type VendorMathRoundingTypeType = VendorMathRoundingTypeEnum; export interface IVendorMath { strategy: VendorMathStrategyType; rounding: { type: VendorMathRoundingTypeType; }; } export interface IVendorOldMath extends IVendorMath { strategy: VendorCustomMathStrategyEnum.OLD; } export type VendorMetadataType = IToastVendorMetadata | ISquareVendorMetadata; export type VendorMathType = IToastVendorMath | ISquareVendorMath | IVendorOldMath; export interface IVendor { readonly _id: string | any; merchantId: string; storeId: string; /** * If true, the order will be sent to the pos system. * Otherwise will not be sent. */ isLiveMode?: boolean; provider: VendorProviderEnum; metadata: VendorMetadataType; math: VendorMathType; }