UNPKG

@chiper-inc/ecommerce-lib

Version:
27 lines (26 loc) 1.33 kB
/** * Finds the highest quantity that can be sold of an item adjusted to its `multipleQuantity` * @param stock item stock * @param maxQuantity maximum quantity of this item that can be added * @param multipleQuantity `multipleQuantity` for the item * @returns the highest quantity of the item that can be sold */ export declare const getMaximumValue: (stock: number, maxQuantity: number, multipleQuantity: number) => number; /** * Find the `multipleQuantity` closest to `quantity` * @param quantity amount you want to add * @param multipleQuantity multipleQuantity of this item * @param stock item stock * @returns quantity that complies with the `multiple Quantity` */ export declare const roundToMultipleQuantity: (quantity: number, multipleQuantity: number, stock: number) => number; export declare const getDiscount: (regularPrice: number, discountedPrice: number) => number; export declare class MaxQuantityHelper { private readonly _quantity; private readonly _discounted; private readonly _scales; constructor(productMaxQuantity?: number | null, discountedMaximumQuantity?: number | null); private scaleMaxQuantity; maxQuantity(startQuantity?: number, endQuantity?: number): number | undefined; discountedMaxQuantity(startQuantity?: number, endQuantity?: number): number | undefined; }