import { CalculatedTax, IRoundingSplit, ITaxBase, PriceFieldEnum, PriceSummary } from '../types'; /** * Checks if two prices are the same. * * @param firstPrice - The first price to compare. * @param secondPrice - The second price to compare. * @returns True if the prices are the same, false otherwise. */ declare function samePrice(firstPrice: number, secondPrice: number): boolean; /** * Checks if the first price is greater than the second price. * * @param bigger - The bigger price. * @param smaller - The smaller price. * @returns True if the first price is greater than the second price, false otherwise. */ declare function biggerPrice(bigger: number, smaller: number): boolean; /** * Checks if the first amount is greater than the second amount. * * @param bigger - The bigger amount. * @param smaller - The smaller amount. * @returns True if the first amount is greater than the second amount, false otherwise. */ declare function biggerAmount(bigger: number, smaller: number): boolean; /** * Validates that an amount is valid (not null or undefined). * * @param amount - The amount to validate. * @returns True if the amount is valid, false otherwise. */ declare function validateAmount(amount: number): boolean; /** * Validates that a price is valid (greater than or equal to zero). * * @param price - The price to validate. * @returns True if the price is valid, false otherwise. */ declare function validatePrice(price: number): boolean; /** * Validates an array of prices, checking if each price is valid (greater than or equal to zero). * * @param prices - An array of prices to validate. * @returns True if all prices are valid, false otherwise. */ declare function validatePrices(prices: number[]): boolean; /** * Validates an array of amounts, checking if each amount is valid (not null or undefined). * * @param amounts - An array of amounts to validate. * @returns True if all amounts are valid, false otherwise. */ declare function validateAmounts(amounts: number[]): boolean; /** * Rounds a number to a specified precision and returns the result. * * @param num - The number to round. * @param precision - The number of decimal places to round to. * @returns The rounded number. */ declare function toFixed(num: number, precision: number): number; /** * Rounds the price to the nearest cent. * * @param price - The price to round. * @returns The rounded price. */ declare function roundPriceCents(price: number): number; /** * Calculates the price from the total price, taking into account the quantity and optional tax percentage. * * @deprecated use the new calculatePriceFromTotalWithTaxes * @param price - The price per unit. * @param taxPercent - The tax percentage (optional). * @param quantity - The quantity (default: DEFAULT_QUANTITY). * @returns The calculated price. */ declare function calculatePriceFromTotal(price: number, taxPercent?: number, quantity?: number): number; /** * Calculates the price from the total price, taking into account the taxes. * Assumes that the total price includes all taxes, meaning each tax is treated as inclusive. * @param totalPrice - The total price. * @param taxes - The taxes to apply. * @returns The calculated price. */ declare function calculatePriceFromTotalWithTaxes(totalPrice: number, taxes?: T[]): number; /** * Calculates the price with tax. * * @deprecated use the new calculateTotalPriceWithTaxes * @param price - The price of the item. * @param taxPercent - The tax percentage to apply (optional). * @param quantity - The quantity of items (default: DEFAULT_QUANTITY). * @param skipRounding - Whether to skip rounding the price. Defaults to false. * @returns The calculated price with tax. */ declare function calculatePriceWithTax(price: number, taxPercent?: number, quantity?: number, skipRounding?: boolean): number; /** * Calculates the total price of an item including tax. * * @deprecated use the new calculateTotalPriceWithTaxes * @param price The price of the item. * @param isTaxInclusive Whether the price already includes tax. * @param taxPercent The tax percentage to apply, if `isTaxInclusive` is `false`. * @param quantity - The quantity of items (default: DEFAULT_QUANTITY). * @param skipRounding - Whether to skip rounding the price. Defaults to false. * @returns The total price, including tax. */ declare function calculateTotalPriceWithTax(price: number, isTaxInclusive: boolean, taxPercent?: number, quantity?: number, skipRounding?: boolean): number; /** * Calculates the total price of an item including tax. * * @param price The price of the item. * @param taxes The taxes to apply. * @param quantity - The quantity of items (default: DEFAULT_QUANTITY). * @param options - The options to apply. * @param options.skipRounding - Whether to skip rounding the price. Defaults to false. * @returns The total price, including tax. */ declare function calculateTotalPriceWithTaxes(price: number, taxes?: CalculatedTax[], quantity?: number, options?: { skipRounding?: boolean; }): PriceSummary; /** * Calculates the item unit price based on the given unit price, tax-inclusive status, and tax percentage. * * @deprecated use the new calculateItemUnitPriceWithTaxes * @param unitPrice - The unit price before tax. * @param isTaxInclusive - A flag indicating whether the price includes tax. * @param taxPercent - The tax percentage. * @returns The calculated unit price. */ declare function calculateItemUnitPrice(unitPrice: number, isTaxInclusive: boolean, taxPercent: number): number; /** * Calculates the item unit price based on the given unit price and taxes. * @param unitPrice - The unit price before tax. * @param taxes - The taxes to apply. * @returns The calculated unit price. */ declare function calculateItemUnitPriceWithTaxes(unitPrice: number, taxes?: T[]): number; /** * Calculates the unit price based on the given total price, tax-inclusive status, tax percentage, and quantity. * * @deprecated use the new calculateUnitPriceFromTotalWithTaxes * @param totalPrice - The total price. * @param isTaxInclusive - A flag indicating whether the price includes tax. * @param taxPercent - The tax percentage. * @param quantity - The quantity of items (default: DEFAULT_QUANTITY). * @returns The calculated unit price. */ declare function calculateUnitPriceFromTotal(totalPrice: number, isTaxInclusive: boolean, taxPercent: number, quantity?: number): number; /** * Calculates the unit price before taxes from the total price including taxes. * If all taxes have amounts, we use them to calculate the unit price. * @param totalPrice - The total price including taxes. * @param taxes - The taxes to apply. * @param quantity - The quantity of items (default: DEFAULT_QUANTITY). * @param unitPriceHint - The original unit price to use when it reproduces the rounded total. * @returns The unit price before taxes. */ declare function calculateUnitPriceFromTotalWithTaxes>(totalPrice: number, taxes?: T[], quantity?: number, unitPriceHint?: number): number; /** * Calculates the quantity based on the total amount, unit price, and tax percentage. * @param totalAmount - The total amount. * @param unitPrice - The unit price of the item. * @param taxes - The taxes to apply. * @returns The calculated quantity. */ declare function calculateQuantityFromTotal(totalAmount: number, unitPrice: number, taxes?: T[]): number; /** * Converts the given price in cents to dollars. * * @param price - The price in cents. * @returns The price in dollars. */ declare function convertCentsToDollars(price: number): number; /** * Calculates the rounding split between a requested price and an actual price. * * @param requestedPrice - The requested price. * @param price - The actual price. * @returns An object containing the number of splits and the split amount. */ declare function getRoundingSplit(requestedPrice: number, price: number): IRoundingSplit; /** * Splits the given amount into multiple parts. * * @param amount - The amount to be split. * @param splitsNumber - The number of splits to be made (default: 1). * @returns An array of numbers representing the split amounts. */ declare function splitPriceAmount(amount: number, splitsNumber?: number): number[]; /** * Calculates the total price by a specified price field in an array of items. * * @template T - The type of the items in the array. * @param {T[]} items - The array of items. * @param {number} [startPrice=0] - The starting price. * @param {PriceFieldEnum} [priceField=PriceFieldEnum.PRICE] - The price field to use for calculation. * @returns {number} - The total price. */ declare function calculateTotalPriceByPriceField(items: T[], startPrice?: number, priceField?: PriceFieldEnum): number; /** * Calculates the total price by summing up the prices in the given array. * * @param prices - An array of prices. * @param startPrice - The starting price for the calculation. Defaults to 0. * @returns The total price. */ declare function calculateTotalPriceByPrices(prices: number[], startPrice?: number): number; /** * Calculates the amount due based on the price and the amount already paid. * * @param price - The total price of the item. * @param paidAmount - The amount already paid. Defaults to 0. * @returns The amount due. */ declare function calculateDue(price: number, paidAmount?: number): number; /** * Calculates the amount due for an item based on its price and the amount already paid. * * @template T - The type of the item, which must have a `price` and `paidAmount` property. * @param {T} item - The item for which to calculate the amount due. * @returns The amount due for the item. */ declare function calculateItemDue({ price, paidAmount }: T): number; /** * Returns the percentage of an amount rounded to the hundreths (second) decimal place. * * Example: percentOfAmount(200, 80) returns 160 * * @param amount - The amount. * @param percent - The percent of the amount that should be returned. * @returns The percentage of the amount. */ declare function percentOfAmount(amount: number, percent: number): number; export { biggerAmount, biggerPrice, calculateDue, calculateItemDue, calculateItemUnitPrice, calculateItemUnitPriceWithTaxes, calculatePriceFromTotal, calculatePriceFromTotalWithTaxes, calculatePriceWithTax, calculateQuantityFromTotal, calculateTotalPriceByPriceField, calculateTotalPriceByPrices, calculateTotalPriceWithTax, calculateTotalPriceWithTaxes, calculateUnitPriceFromTotal, calculateUnitPriceFromTotalWithTaxes, convertCentsToDollars, getRoundingSplit, percentOfAmount, roundPriceCents, samePrice, splitPriceAmount, toFixed, validateAmount, validateAmounts, validatePrice, validatePrices, };