From 97c1d78601db10860f819b8b8ceccca6552a001c Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 17 May 2024 06:15:03 +1000 Subject: [PATCH] Treat UGX as a decimal based currency. (#1320) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stripe documents several currencies as Zero-decimal currencies, these currencies should be charged as “$1 = 1” in the stripe API. https://docs.stripe.com/currencies#zero-decimal However, for backwards compatibility, specific zero-decimal currencies must be treated as decimal currencies, this includes UGX and ISK (which is not documented as a zero-decimal in the above documentation) This means that when we've attempted to charge `1,000 UGX` we've actually charged `10.00 UGX = 10 UGX`. --- .../wp-content/mu-plugins/utilities/class-stripe-client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public_html/wp-content/mu-plugins/utilities/class-stripe-client.php b/public_html/wp-content/mu-plugins/utilities/class-stripe-client.php index 0b5a5ef50..1d12394d7 100644 --- a/public_html/wp-content/mu-plugins/utilities/class-stripe-client.php +++ b/public_html/wp-content/mu-plugins/utilities/class-stripe-client.php @@ -191,7 +191,7 @@ public static function get_fractional_unit_amount( $order_currency, $base_unit_a $currency_multipliers = array( // Zero-decimal currencies. 1 => array( - 'BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', + 'BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF', ), 100 => array( @@ -204,7 +204,7 @@ public static function get_fractional_unit_amount( $order_currency, $base_unit_a 'MXN', 'MYR', 'MZN', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NZD', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'QAR', 'RON', 'RSD', 'RUB', 'SAR', 'SBD', 'SCR', 'SEK', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'STD', 'SZL', 'THB', 'TJS', 'TOP', 'TRY', 'TTD', 'TWD', - 'TZS', 'UAH', 'USD', 'UYU', 'UZS', 'WST', 'XCD', 'YER', 'ZAR', 'ZMW', + 'TZS', 'UAH', 'UGX', 'USD', 'UYU', 'UZS', 'WST', 'XCD', 'YER', 'ZAR', 'ZMW', ), );