/** * A step is an action that can be performed during an order checkout * * @export * @interface ICheckoutStepStatus */ export interface ICheckoutStepStatus { /** * Indicates it is possible to perform the step * Meaning all requirements and prerequisites are met from * getRequiredDataForOrder * * @type {boolean} */ possible: boolean; /** * Optional indicator for certain steps (ie. placeOrder) * which indicates the step will be possible once payment has completed * This can be used as a trigger for the front-end to ensure all requirements * other then payment have been met * * @type {boolean} */ possibleAfterPayment?: boolean; /** * Indicates this step is required for the current order * * @type {boolean} */ required: boolean; /** * Indicates all requirements are met for this step * * @type {boolean} */ valid: boolean; } /** * Status for any product that has product requirements. * Product requirements are custom values that can be set for a specific order line. * Things like inscriptions are an example. * Product requirements are updated using `EVA.Core.UpdateProductRequirementValuesForOrderLine` * * @export * @interface IProductRequirementState */ export interface IProductRequirementState { requirement: EVA.Core.Requirement; orderLineID: number; values?: EVA.Core.ProductRequirementLineModel[]; valid: boolean; } /** * Status for any product that needs a serial number. * Serial numbers are set for an order line using `EVA.Core.UpdateSerialNumber` * * @export * @interface IProductSerialNumberState */ export interface IProductSerialNumberState { requirement: EVA.Core.Requirement; orderLineID: number; serialNumber?: string; valid: boolean; } /** * Status for any product bundle. * Bundles are collections of sub-product that make one main product. * * @export * @interface IProductRequirementState */ export interface IProductBundleState { requirement: EVA.Core.Requirement; orderLineID: number; productLineIDs: number[]; valid: boolean; } /** * Status for the pick discount product requirement. * This is the feature used to have a customer pick a gift product based on * current order properties (total value mostly) * * @export * @interface IPickDiscountProductState */ export interface IPickDiscountProductState { requirement: EVA.Core.Requirement; orderLineID: number; pickedProductLineIDs: number[]; valid: boolean; } /** * The checkout steps we provide a status for * NOTE: More checkout steps could exist depending on customer requirements * * @export * @interface IOrderStatus */ export interface IOrderStatus { orderMode: OrderMode; lineActionTypes: EVA.Core.LineActionTypes[]; checkoutSteps: { /** * Status and validity of the customer attached to the current order * * @type {ICheckoutStepStatus} */ attachCustomer: ICheckoutStepStatus; /** * Status of the preparation of the order for a checkout. * Client applications should call `PrepareOrderForCheckout` every time * the order enters a checkout flow * * @type {ICheckoutStepStatus} */ createOrder: ICheckoutStepStatus; /** * Status of the placement of the order. * This will reserve the products and update stock as needed * * @type {ICheckoutStepStatus} */ placeOrder: ICheckoutStepStatus; /** * Status of the order line(s) handover to the customer * * @type {ICheckoutStepStatus} */ shipOrder: ICheckoutStepStatus; /** * Status of the payment (if required) for the order * * @type {ICheckoutStepStatus} */ payment: ICheckoutStepStatus; }; issues: { customer: EVA.Core.Requirement[]; order: EVA.Core.Requirement[]; orderLine: { [orderlineID: string]: EVA.Core.Requirement[]; }; invalidOrderLineIDs: number[]; }; bundleProducts: IProductBundleState[]; pickDiscountProducts: IPickDiscountProductState[]; productsWithRequirements: IProductRequirementState[]; productsWithSerialNumbers: IProductSerialNumberState[]; } /** * The type of order which is deduced based on line action types present * and possibly other characteristics * * @export * @enum {number} */ export declare enum OrderMode { empty = "EMPTY", sale = "SALE", reservation = "RESERVATION", delivery = "DELIVERY", order = "ORDER", interbranch = "INTERBRANCH", returnToSupplier = "RETURN_TO_SUPPLIER", mixed = "MIXED" } /** * Helper method to determine if an order has product with product requirements * based on the getRequiredDataForOrder response * * @export * @param {{ * requiredData: EVA.Core.GetRequiredDataForOrder, * }} { * requiredData, * } * @returns {boolean} */ export declare function hasProductRequirement({ requiredData, }: { requiredData: EVA.Core.RequiredData; }): boolean; /** * Helper method to determine the current order mode * * @export * @param {{ * order: EVA.Core.OrderDto, * }} { * order, * } * @returns */ export declare function determineOrderMode({ order, }: { order: EVA.Core.OrderDto; }): OrderMode; /** * Helper method to calculate the current order (checkout) status based * on the order and required data response * * @export * @param {{ * order: EVA.Core.OrderDto, * requiredData: EVA.Core.GetRequiredDataForOrderResponse, * }} { * order, * requiredData, * } * @returns {IOrderStatus} */ export declare function determineOrderStatus({ order, requiredData, productRequirements, }: { order: EVA.Core.OrderDto; requiredData: EVA.Core.RequiredData; productRequirements?: EVA.Core.ProductRequirementModel[]; }): IOrderStatus; //# sourceMappingURL=order-status.d.ts.map