* app initialization * btcpay-calcom payment * include logo and images * resolve comments * include USD and webhook cleaning * currency display * fix type error * payment service create error * type error fix * icon update * bot feedback update * Remove console * Remove currency suffix in price * fix coderRabbit comment * resolve extra comments * Use repositories and declarative installation ocode for app * use PrismaBookingPaymentRepository as well as fix UI view * Avoid fetching booking just for title which is already passed to create fn in handlePayment * fix type issues * return 200 if payment is already processed --------- Co-authored-by: Anik Dhabal Babu <[email protected]> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Omar López <[email protected]>
21 lines
605 B
TypeScript
21 lines
605 B
TypeScript
export const currencyOptions = [
|
|
{ label: "SATS", value: "BTC", unit: "SATS" },
|
|
{ label: "USD", value: "USD", unit: "USD" },
|
|
];
|
|
|
|
const zeroDecimalCurrencies = ["SATS", "BTC"];
|
|
|
|
export const convertToSmallestCurrencyUnit = (amount: number, currency: string) => {
|
|
if (zeroDecimalCurrencies.includes(currency.toUpperCase())) {
|
|
return amount;
|
|
}
|
|
return Math.round(amount * 100);
|
|
};
|
|
|
|
export const convertFromSmallestToPresentableCurrencyUnit = (amount: number, currency: string) => {
|
|
if (zeroDecimalCurrencies.includes(currency.toUpperCase())) {
|
|
return amount;
|
|
}
|
|
return amount / 100;
|
|
};
|