diff --git a/recharge/index.html b/recharge/index.html
index b96584d..7c656bb 100644
--- a/recharge/index.html
+++ b/recharge/index.html
@@ -2420,7 +2420,7 @@
var amount =
Number.isFinite(rate) && rate > 0 ? usd * rate : usd;
return (
- amount.toFixed(currency === 'USD' ? 2 : 2) +
+ amount.toFixed(currencyFractionDigits(currency)) +
' ' +
currency
);
@@ -2483,7 +2483,35 @@
function amountMinorText(value, currency) {
var minor = Number(value || 0);
if (!Number.isFinite(minor) || minor <= 0) return '-';
- return (minor / 100).toFixed(2) + ' ' + currency;
+ return (
+ (minor / 100).toFixed(currencyFractionDigits(currency)) +
+ ' ' +
+ currency
+ );
+ }
+
+ function currencyFractionDigits(currency) {
+ var normalized = String(currency || '').toUpperCase();
+ var zeroDecimal = {
+ BIF: true,
+ CLP: true,
+ DJF: true,
+ GNF: true,
+ IDR: true,
+ JPY: true,
+ KMF: true,
+ KRW: true,
+ MGA: true,
+ PYG: true,
+ RWF: true,
+ UGX: true,
+ VND: true,
+ VUV: true,
+ XAF: true,
+ XOF: true,
+ XPF: true,
+ };
+ return zeroDecimal[normalized] ? 0 : 2;
}
function shortOrderID(value) {