Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // grab the value of the purchase (eg. 4.3)
- var costRaw = Monzo.cardPurchase.AmountInAccountCurrency;
- // convert it to a number value
- var cost = parseFloat(costRaw);
- // round it up to the nearest full integer (eg. 5)
- var costRounded = Math.ceil(cost / 5) * 5;
- // work out the difference in the rounding up (eg. 5 - 4.3 = 0.7)
- var costDiff = costRounded - cost;
- // some form of round up accelorator
- var costDiffMult = costDiff * 1;
- // convert to string
- var totalRoundup = costDiffMult.toFixed(2);
- // set the rounded up value to be moved to the pot
- Monzo.potDeposit.setAmount(totalRoundup)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement