1
2
3
4
5
6
7
8
9
10
11
12
13
14
export const calculateFlyBill = async (params) => {
const chargeableVM = params.expectedVMSeconds - 8436960;
const VMCost = chargeableVM < 0 ? 0 : chargeableVM * 0.00000075;
const extraRAM = params.extraRAMInGB * params.expectedRAMSeconds * 0.00000193;
const chargeableVolume = params.volumeInGB - 3;
const volumeCost = chargeableVolume < 0 ? 0 : chargeableVolume * 0.15;
const total = VMCost + extraRAM + volumeCost;
return {
VMCost,
extraRAM,
volumeCost,
total,
};
};