TypeScriptBusiness logicDifficulty 2/3
// lib/fees.ts
// amount is in euros (e.g. 10.5 means 10.50 EUR)
export function applyFee(amount: number, feeRate: number): number {
return amount * (1 + feeRate);
}
// checkout.ts
const total = applyFee(order.amount, 0.0125); // 1.25% fee
await chargeCard(customerId, total); // chargeCard expects minor units (cents)