bc-checkout-sdk
Version:
BetterCommerce's Checkout NodeJS SDK enables BC client applications to integrate with Checkout merchant API system. It publishes an interface to interact with [Checkout API](https://api-reference.checkout.com/#operation/getPaymentDetails/) endpoints.
18 lines (17 loc) • 890 B
TypeScript
/**
* Counts the number of decimal places of a given number.
* @param {number} value The number to count the decimal places of.
* @returns {number} The number of decimal places of the given number.
*/
export declare const countDecimals: (value: number) => number;
/**
* Sanitizes the given amount by converting it to an integer representation of the lowest currency unit.
*
* This function handles amounts with up to two decimal places. If the amount has more than two decimals,
* it is rounded to two decimal places before conversion. The sanitized amount is returned as an integer
* by multiplying the value by 100 to handle the currency in the lowest denomination (e.g., cents for USD).
*
* @param value - The monetary amount to be sanitized.
* @returns The sanitized amount as an integer.
*/
export declare const sanitizeAmount: (value: number) => number;