__('United Arab Emirates Dirham', 'fluent-cart'), 'AFN' => __('Afghan Afghani', 'fluent-cart'), 'ALL' => __('Albanian Lek', 'fluent-cart'), 'AMD' => __('Armenian Dram', 'fluent-cart'), 'ANG' => __('Netherlands Antillean Gulden', 'fluent-cart'), 'AOA' => __('Angolan Kwanza', 'fluent-cart'), 'ARS' => __('Argentine Peso', 'fluent-cart'), // non amex 'AUD' => __('Australian Dollar', 'fluent-cart'), 'AWG' => __('Aruban Florin', 'fluent-cart'), 'AZN' => __('Azerbaijani Manat', 'fluent-cart'), 'BAM' => __('Bosnia & Herzegovina Convertible Mark', 'fluent-cart'), 'BBD' => __('Barbadian Dollar', 'fluent-cart'), 'BDT' => __('Bangladeshi Taka', 'fluent-cart'), 'BIF' => __('Burundian Franc', 'fluent-cart'), 'BGN' => __('Bulgarian Lev', 'fluent-cart'), 'BMD' => __('Bermudian Dollar', 'fluent-cart'), 'BND' => __('Brunei Dollar', 'fluent-cart'), 'BOB' => __('Bolivian Boliviano', 'fluent-cart'), 'BRL' => __('Brazilian Real', 'fluent-cart'), 'BSD' => __('Bahamian Dollar', 'fluent-cart'), 'BWP' => __('Botswana Pula', 'fluent-cart'), 'BYN' => __('Belarusian Ruble', 'fluent-cart'), 'BZD' => __('Belize Dollar', 'fluent-cart'), 'CAD' => __('Canadian Dollar', 'fluent-cart'), 'CDF' => __('Congolese Franc', 'fluent-cart'), 'CHF' => __('Swiss Franc', 'fluent-cart'), 'CLP' => __('Chilean Peso', 'fluent-cart'), 'CNY' => __('Chinese Renminbi Yuan', 'fluent-cart'), 'COP' => __('Colombian Peso', 'fluent-cart'), 'CRC' => __('Costa Rican Colón', 'fluent-cart'), 'CVE' => __('Cape Verdean Escudo', 'fluent-cart'), 'CZK' => __('Czech Koruna', 'fluent-cart'), 'DJF' => __('Djiboutian Franc', 'fluent-cart'), 'DKK' => __('Danish Krone', 'fluent-cart'), 'DOP' => __('Dominican Peso', 'fluent-cart'), 'DZD' => __('Algerian Dinar', 'fluent-cart'), 'EGP' => __('Egyptian Pound', 'fluent-cart'), 'ETB' => __('Ethiopian Birr', 'fluent-cart'), 'EUR' => __('Euro', 'fluent-cart'), 'FJD' => __('Fijian Dollar', 'fluent-cart'), 'FKP' => __('Falkland Islands Pound', 'fluent-cart'), 'GBP' => __('British Pound', 'fluent-cart'), 'GEL' => __('Georgian Lari', 'fluent-cart'), 'GHS' => __('Ghanaian Cedi', 'fluent-cart'), 'GIP' => __('Gibraltar Pound', 'fluent-cart'), 'GMD' => __('Gambian Dalasi', 'fluent-cart'), 'GNF' => __('Guinean Franc', 'fluent-cart'), 'GTQ' => __('Guatemalan Quetzal', 'fluent-cart'), 'GYD' => __('Guyanese Dollar', 'fluent-cart'), 'HKD' => __('Hong Kong Dollar', 'fluent-cart'), 'HNL' => __('Honduran Lempira', 'fluent-cart'), 'HRK' => __('Croatian Kuna', 'fluent-cart'), 'HTG' => __('Haitian Gourde', 'fluent-cart'), 'HUF' => __('Hungarian Forint', 'fluent-cart'), 'IDR' => __('Indonesian Rupiah', 'fluent-cart'), 'ILS' => __('Israeli New Sheqel', 'fluent-cart'), 'INR' => __('Indian Rupee', 'fluent-cart'), 'IRR' => __('Iranian Rial', 'fluent-cart'), 'ISK' => __('Icelandic Króna', 'fluent-cart'), 'JMD' => __('Jamaican Dollar', 'fluent-cart'), 'JPY' => __('Japanese Yen', 'fluent-cart'), 'KES' => __('Kenyan Shilling', 'fluent-cart'), 'KGS' => __('Kyrgyzstani Som', 'fluent-cart'), 'KHR' => __('Cambodian Riel', 'fluent-cart'), 'KMF' => __('Comorian Franc', 'fluent-cart'), 'KRW' => __('South Korean Won', 'fluent-cart'), 'KYD' => __('Cayman Islands Dollar', 'fluent-cart'), 'KZT' => __('Kazakhstani Tenge', 'fluent-cart'), 'LAK' => __('Lao Kip', 'fluent-cart'), 'LBP' => __('Lebanese Pound', 'fluent-cart'), 'LKR' => 'Sri Lankan Rupee', 'LRD' => __('Liberian Dollar', 'fluent-cart'), 'LSL' => __('Lesotho Loti', 'fluent-cart'), 'MAD' => __('Moroccan Dirham', 'fluent-cart'), 'MDL' => __('Moldovan Leu', 'fluent-cart'), 'MGA' => __('Malagasy Ariary', 'fluent-cart'), 'MKD' => __('Macedonian Denar', 'fluent-cart'), 'MMK' => __('Myanmar Kyat', 'fluent-cart'), 'MNT' => __('Mongolian Tögrög', 'fluent-cart'), 'MOP' => __('Macanese Pataca', 'fluent-cart'), 'MRO' => __('Mauritanian Ouguiya', 'fluent-cart'), 'MUR' => __('Mauritian Rupee', 'fluent-cart'), 'MVR' => __('Maldivian Rufiyaa', 'fluent-cart'), 'MWK' => __('Malawian Kwacha', 'fluent-cart'), 'MXN' => __('Mexican Peso', 'fluent-cart'), 'MYR' => __('Malaysian Ringgit', 'fluent-cart'), 'MZN' => __('Mozambican Metical', 'fluent-cart'), 'NAD' => __('Namibian Dollar', 'fluent-cart'), 'NGN' => __('Nigerian Naira', 'fluent-cart'), 'NIO' => __('Nicaraguan Córdoba', 'fluent-cart'), 'NOK' => __('Norwegian Krone', 'fluent-cart'), 'NPR' => __('Nepalese Rupee', 'fluent-cart'), 'NZD' => __('New Zealand Dollar', 'fluent-cart'), 'PAB' => __('Panamanian Balboa', 'fluent-cart'), 'PEN' => __('Peruvian Nuevo Sol', 'fluent-cart'), 'PGK' => __('Papua New Guinean Kina', 'fluent-cart'), 'PHP' => __('Philippine Peso', 'fluent-cart'), 'PKR' => __('Pakistani Rupee', 'fluent-cart'), 'PLN' => __('Polish Złoty', 'fluent-cart'), 'PYG' => __('Paraguayan Guaraní', 'fluent-cart'), 'QAR' => __('Qatari Riyal', 'fluent-cart'), 'RON' => __('Romanian Leu', 'fluent-cart'), 'RSD' => __('Serbian Dinar', 'fluent-cart'), 'RUB' => __('Russian Ruble', 'fluent-cart'), 'RWF' => __('Rwandan Franc', 'fluent-cart'), 'SAR' => __('Saudi Riyal', 'fluent-cart'), 'SBD' => __('Solomon Islands Dollar', 'fluent-cart'), 'SCR' => __('Seychellois Rupee', 'fluent-cart'), 'SEK' => __('Swedish Krona', 'fluent-cart'), 'SGD' => __('Singapore Dollar', 'fluent-cart'), 'SHP' => __('Saint Helenian Pound', 'fluent-cart'), 'SLL' => __('Sierra Leonean Leone', 'fluent-cart'), 'SOS' => __('Somali Shilling', 'fluent-cart'), 'SRD' => __('Surinamese Dollar', 'fluent-cart'), 'STD' => __('São Tomé and Príncipe Dobra', 'fluent-cart'), 'SVC' => __('Salvadoran Colón', 'fluent-cart'), 'SZL' => __('Swazi Lilangeni', 'fluent-cart'), 'THB' => __('Thai Baht', 'fluent-cart'), 'TJS' => __('Tajikistani Somoni', 'fluent-cart'), 'TOP' => __('Tongan Paʻanga', 'fluent-cart'), 'TRY' => __('Turkish Lira', 'fluent-cart'), 'TTD' => __('Trinidad and Tobago Dollar', 'fluent-cart'), 'TWD' => __('New Taiwan Dollar', 'fluent-cart'), 'TZS' => __('Tanzanian Shilling', 'fluent-cart'), 'UAH' => __('Ukrainian Hryvnia', 'fluent-cart'), 'UGX' => __('Ugandan Shilling', 'fluent-cart'), 'USD' => __('United States Dollar', 'fluent-cart'), 'UYU' => __('Uruguayan Peso', 'fluent-cart'), 'UZS' => __('Uzbekistani Som', 'fluent-cart'), 'VND' => __('Vietnamese Đồng', 'fluent-cart'), 'VUV' => __('Vanuatu Vatu', 'fluent-cart'), 'WST' => __('Samoan Tala', 'fluent-cart'), 'XAF' => __('Central African Cfa Franc', 'fluent-cart'), 'XCD' => __('East Caribbean Dollar', 'fluent-cart'), 'XOF' => __('West African Cfa Franc', 'fluent-cart'), 'XPF' => __('Cfp Franc', 'fluent-cart'), 'YER' => __('Yemeni Rial', 'fluent-cart'), 'ZAR' => __('South African Rand', 'fluent-cart'), 'ZMW' => __('Zambian Kwacha', 'fluent-cart'), ), []); if ($code) { return isset($currencies[$code]) ? $currencies[$code] : ''; } return $currencies; } /** * Get the available locales that Stripe can use * * @return array */ public static function getLocales() { return array( '' => 'English (en) (default)', 'auto' => 'Auto-detect locale', 'zh' => 'Simplified Chinese (zh)', 'da' => 'Danish (da)', 'nl' => 'Dutch (nl)', 'fi' => 'Finnish (fi)', 'fr' => 'French (fr)', 'de' => 'German (de)', 'it' => 'Italian (it)', 'ja' => 'Japanese (ja)', 'no' => 'Norwegian (no)', 'es' => 'Spanish (es)', 'sv' => 'Swedish (sv)', ); } public static function getCurrencySigns() { return apply_filters('fluent_cart/global_currency_symbols', [ 'AED' => 'د.إ', 'AFN' => '؋', 'ALL' => 'L', 'AMD' => 'AMD', 'ANG' => 'ƒ', 'AOA' => 'Kz', 'ARS' => '$', 'AUD' => '$', 'AWG' => 'Afl.', 'AZN' => '₼', 'BAM' => 'KM', 'BBD' => '$', 'BDT' => '৳ ', 'BGN' => 'лв.', 'BHD' => '.د.ب', 'BIF' => 'Fr', 'BMD' => '$', 'BND' => '$', 'BOB' => 'Bs.', 'BRL' => 'R$', 'BSD' => '$', 'BTC' => '฿', 'BTN' => 'Nu.', 'BWP' => 'P', 'BYR' => 'Br', 'BYN' => 'Br', 'BZD' => '$', 'CAD' => '$', 'CDF' => 'Fr', 'CHF' => 'CHF', 'CLP' => '$', 'CNY' => '¥', 'COP' => '$', 'CRC' => '₡', 'CUC' => '$', 'CUP' => '$', 'CVE' => '$', 'CZK' => 'Kč', 'DJF' => 'Fr', 'DKK' => 'kr.', 'DOP' => 'RD$', 'DZD' => 'د.ج', 'EGP' => 'EGP', 'ERN' => 'Nfk', 'ETB' => 'Br', 'EUR' => '€', 'FJD' => '$', 'FKP' => '£', 'GBP' => '£', 'GEL' => '₾', 'GGP' => '£', 'GHS' => '₵', 'GIP' => '£', 'GMD' => 'D', 'GNF' => 'Fr', 'GTQ' => 'Q', 'GYD' => '$', 'HKD' => '$', 'HNL' => 'L', 'HRK' => 'kn', 'HTG' => 'G', 'HUF' => 'Ft', 'IDR' => 'Rp', 'ILS' => '₪', 'IMP' => '£', 'INR' => '₹', 'IQD' => 'د.ع', 'IRR' => '﷼', 'IRT' => 'تومان', 'ISK' => 'kr.', 'JEP' => '£', 'JMD' => '$', 'JOD' => 'د.ا', 'JPY' => '¥', 'KES' => 'KSh', 'KGS' => 'сом', 'KHR' => '៛', 'KMF' => 'Fr', 'KPW' => '₩', 'KRW' => '₩', 'KWD' => 'د.ك', 'KYD' => '$', 'KZT' => '₸', 'LAK' => '₭', 'LBP' => 'ل.ل', 'LKR' => 'රු', 'LRD' => '$', 'LSL' => 'L', 'LYD' => 'د.ل', 'MAD' => 'د.م.', 'MDL' => 'MDL', 'MGA' => 'Ar', 'MKD' => 'ден', 'MMK' => 'Ks', 'MNT' => '₮', 'MOP' => 'P', 'MRU' => 'UM', 'MUR' => '₨', 'MVR' => '.ރ', 'MWK' => 'MK', 'MXN' => '$', 'MYR' => 'RM', 'MZN' => 'MT', 'NAD' => 'N$', 'NGN' => '₦', 'NIO' => 'C$', 'NOK' => 'kr', 'NPR' => '₨', 'NZD' => '$', 'OMR' => 'ر.ع.', 'PAB' => 'B/.', 'PEN' => 'S/', 'PGK' => 'K', 'PHP' => '₱', 'PKR' => '₨', 'PLN' => 'zł', 'PRB' => 'р.', 'PYG' => '₲', 'QAR' => 'ر.ق', 'RMB' => '¥', 'RON' => 'lei', 'RSD' => 'рсд', 'RUB' => '₽', 'RWF' => 'Fr', 'SAR' => 'ر.س', 'SBD' => '$', 'SCR' => '₨', 'SDG' => 'ج.س.', 'SEK' => 'kr', 'SGD' => '$', 'SHP' => '£', 'SLL' => 'Le', 'SOS' => 'Sh', 'SRD' => '$', 'SSP' => '£', 'STN' => 'Db', 'SYP' => 'ل.س', 'SZL' => 'E', 'THB' => '฿', 'TJS' => 'ЅМ', 'TMT' => 'm', 'TND' => 'د.ت', 'TOP' => 'T$', 'TRY' => '₺', 'TTD' => '$', 'TWD' => 'NT$', 'TZS' => 'Sh', 'UAH' => '₴', 'UGX' => 'UGX', 'USD' => '$', 'UYU' => '$', 'UZS' => 'UZS', 'VEF' => 'Bs F', 'VES' => 'Bs.', 'VND' => '₫', 'VUV' => 'Vt', 'WST' => 'T', 'XAF' => 'CFA', 'XCD' => '$', 'XOF' => 'CFA', 'XPF' => 'XPF', 'YER' => '﷼', 'ZAR' => 'R', 'ZMW' => 'ZK', ], []); } public static function getCurrencySign($currency = 'USD') { $currency = strtoupper($currency); $symbols = static::getCurrencySigns(); return $symbols[$currency] ?? ''; } public static function getCurrencyWithSign($currencies = []) { $currencyWithSign = []; foreach ($currencies as $currency) { $currencyWithSign[$currency] = self::getCurrencySign($currency); } return $currencyWithSign; } public static function zeroDecimalCurrencies() { return apply_filters('fluent_cart/zero_decimal_currencies', array( 'BIF' => esc_html__('Burundian Franc', 'fluent-cart'), 'CLP' => esc_html__('Chilean Peso', 'fluent-cart'), 'DJF' => esc_html__('Djiboutian Franc', 'fluent-cart'), 'GNF' => esc_html__('Guinean Franc', 'fluent-cart'), 'JPY' => esc_html__('Japanese Yen', 'fluent-cart'), 'KMF' => esc_html__('Comorian Franc', 'fluent-cart'), 'KRW' => esc_html__('South Korean Won', 'fluent-cart'), 'MGA' => esc_html__('Malagasy Ariary', 'fluent-cart'), 'PYG' => esc_html__('Paraguayan Guaraní', 'fluent-cart'), 'RWF' => esc_html__('Rwandan Franc', 'fluent-cart'), 'VND' => esc_html__('Vietnamese Dong', 'fluent-cart'), 'VUV' => esc_html__('Vanuatu Vatu', 'fluent-cart'), 'XAF' => esc_html__('Central African Cfa Franc', 'fluent-cart'), 'XOF' => esc_html__('West African Cfa Franc', 'fluent-cart'), 'XPF' => esc_html__('Cfp Franc', 'fluent-cart'), 'UGX' => esc_html__('Ugandan Shilling', 'fluent-cart'), ), []); } public static function isZeroDecimal($currencyCode): bool { $currencyCode = strtoupper($currencyCode); $zeroDecimals = self::zeroDecimalCurrencies(); return isset($zeroDecimals[$currencyCode]); } public static function updateCurrencyArray($oldCurrencies = [], $amount = 0, $currency = ''): array { if (!Arr::exists($oldCurrencies, $currency)) { $oldCurrencies[$currency] = [ 'currency' => $currency, 'total' => 0, 'count' => 0, 'sign' => '$' ]; } $oldCurrencies[$currency]['total'] += $amount; $oldCurrencies[$currency]['count']++; $oldCurrencies[$currency]['sign'] = static::getCurrencySign($currency); return $oldCurrencies; } public static function centsToDecimal($cents, $currency = null) { if (!$currency) { $currency = CurrencySettings::get('currency'); } if (self::isZeroDecimal($currency)) { return $cents; } return number_format($cents / 100, 2, '.', ''); } }