Skip to content

Commit

Permalink
feat(addon-commerce): missing currency codes (#7513)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Belokopytov <[email protected]>
  • Loading branch information
AndreiBelokopytov and Andrey Belokopytov authored May 21, 2024
1 parent 41114ac commit 710e1f6
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 2 deletions.
59 changes: 59 additions & 0 deletions projects/addon-commerce/enums/currency-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ export enum TuiCurrencyCode {
Baht = '764',

/**
* Bahraini Dinar
*
* @description Numeric code: 048
* @description Alphabetic code: BHD
* @description Countries and territories: Bahrain
* @description Currency symbol: BD
*/
BahrainiDinar = '048',

/**
* Belarusian ruble
*
* @description Numeric code: 933
Expand Down Expand Up @@ -80,6 +89,16 @@ export enum TuiCurrencyCode {
*/
CanadianDollar = '124',

/**
* Czech Koruna
*
* @description Numeric code: 203
* @description Alphabetic code: CZK
* @description Countries and territories: Czech Republic
* @description Currency symbol: Kč
*/
CzechKoruna = '203',

/**
* United Arab Emirates dirham
*
Expand All @@ -100,6 +119,16 @@ export enum TuiCurrencyCode {
*/
Dollar = '840',

/**
* East Caribbean Dollar
*
* @description Numeric code: 951
* @description Alphabetic code: XCD
* @description Countries and territories: Anguilla, Antigua and Barbuda, Dominica, Grenada, Montserrat, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines
* @description Currency symbol: EC$
*/
EastCaribbeanDollar = '951',

/**
* Euro
*
Expand All @@ -110,6 +139,16 @@ export enum TuiCurrencyCode {
*/
Euro = '978',

/**
* Forint
*
* @description Numeric code: 348
* @description Alphabetic code: HUF
* @description Countries and territories: Hungray
* @description Currency symbol: Ft
*/
Forint = '348',

/**
* Georgian lari
*
Expand Down Expand Up @@ -210,6 +249,16 @@ export enum TuiCurrencyCode {
*/
MexicanPeso = '484',

/**
* Moldovan Leu
*
* @description Numeric code: 498
* @description Alphabetic code: MDL
* @description Countries and territories: Moldova
* @description Currency symbol: L
*/
MoldovanLeu = '498',

/**
* Mongolian tugrik
*
Expand All @@ -230,6 +279,16 @@ export enum TuiCurrencyCode {
*/
NewTurkmenManat = '934',

/**
* Poland Zloty
*
* @description Numeric code: 985
* @description Alphabetic code: PLN
* @description Countries and territories: Poland
* @description Currency symbol: zł
*/
PolandZloty = '985',

/**
* Pound sterling
*
Expand Down
68 changes: 68 additions & 0 deletions projects/addon-commerce/enums/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ export enum TuiCurrency {
*/
Baht = 'THB',

/**
* Bahraini Dinar
*
* @description Numeric code: 048
* @description Alphabetic code: BHD
* @description Countries and territories: Bahrain
* @description Currency symbol: BD
*/
BahrainiDinar = 'BHD',

/**
* Belarusian ruble
*
* @description Numeric code: 933
* @description Alphabetic code: BYN
* @description Countries and territories: Belarus
* @description Currency symbol: Br
*/
BelarusianRuble = 'BYN',

/**
Expand All @@ -64,6 +82,16 @@ export enum TuiCurrency {
*/
CanadianDollar = 'CAD',

/**
* Czech Koruna
*
* @description Numeric code: 203
* @description Alphabetic code: СZK
* @description Countries and territories: Czech Republic
* @description Currency symbol: Kč
*/
CzechKoruna = 'CZK',

/**
* United Arab Emirates dirham
*
Expand All @@ -84,6 +112,16 @@ export enum TuiCurrency {
*/
Dollar = 'USD',

/**
* East Caribbean Dollar
*
* @description Numeric code: 951
* @description Alphabetic code: XCD
* @description Countries and territories: Anguilla, Antigua and Barbuda, Dominica, Grenada, Montserrat, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines
* @description Currency symbol: EC$
*/
EastCaribbeanDollar = 'XCD',

/**
* Euro
*
Expand All @@ -94,6 +132,16 @@ export enum TuiCurrency {
*/
Euro = 'EUR',

/**
* Forint
*
* @description Numeric code: 348
* @description Alphabetic code: HUF
* @description Countries and territories: Hungray
* @description Currency symbol: Ft
*/
Forint = 'HUF',

GeorgianLari = 'GEL',

/**
Expand Down Expand Up @@ -162,10 +210,30 @@ export enum TuiCurrency {
*/
MexicanPeso = 'MXN',

/**
* Moldovan Leu
*
* @description Numeric code: 498
* @description Alphabetic code: MDL
* @description Countries and territories: Moldova
* @description Currency symbol: L
*/
MoldovanLeu = 'MDL',

MongolianTugrik = 'MNT',

NewTurkmenManat = 'TMT',

/**
* Poland Zloty
*
* @description Numeric code: 985
* @description Alphabetic code: PLN
* @description Countries and territories: Poland
* @description Currency symbol: zł
*/
PolandZloty = 'PLN',

/**
* Pound sterling
*
Expand Down
6 changes: 6 additions & 0 deletions projects/addon-commerce/utils/get-code-by-currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ export const TUI_CODE_DICTIONARY: Record<TuiCurrency, TuiCurrencyCode> = {
[TuiCurrency.Ruble]: TuiCurrencyCode.Ruble,
[TuiCurrency.Dollar]: TuiCurrencyCode.Dollar,
[TuiCurrency.MexicanPeso]: TuiCurrencyCode.MexicanPeso,
[TuiCurrency.MoldovanLeu]: TuiCurrencyCode.MoldovanLeu,
[TuiCurrency.PolandZloty]: TuiCurrencyCode.PolandZloty,
[TuiCurrency.SingaporeDollar]: TuiCurrencyCode.SingaporeDollar,
[TuiCurrency.AustralianDollar]: TuiCurrencyCode.AustralianDollar,
[TuiCurrency.HongKongDollar]: TuiCurrencyCode.HongKongDollar,
[TuiCurrency.CanadianDollar]: TuiCurrencyCode.CanadianDollar,
[TuiCurrency.CzechKoruna]: TuiCurrencyCode.CzechKoruna,
[TuiCurrency.EastCaribbeanDollar]: TuiCurrencyCode.EastCaribbeanDollar,
[TuiCurrency.Euro]: TuiCurrencyCode.Euro,
[TuiCurrency.Forint]: TuiCurrencyCode.Forint,
[TuiCurrency.Pound]: TuiCurrencyCode.Pound,
[TuiCurrency.Baht]: TuiCurrencyCode.Baht,
[TuiCurrency.BahrainiDinar]: TuiCurrencyCode.BahrainiDinar,
[TuiCurrency.TurkishLira]: TuiCurrencyCode.TurkishLira,
[TuiCurrency.YuanRenminbi]: TuiCurrencyCode.YuanRenminbi,
[TuiCurrency.Yen]: TuiCurrencyCode.Yen,
Expand Down
8 changes: 6 additions & 2 deletions projects/addon-commerce/utils/get-currency-by-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ export const TUI_CURRENCY_DICTIONARY: Record<TuiCurrencyCode, TuiCurrency> = {
[TuiCurrencyCode.Ruble]: TuiCurrency.Ruble,
[TuiCurrencyCode.Dollar]: TuiCurrency.Dollar,
[TuiCurrencyCode.MexicanPeso]: TuiCurrency.MexicanPeso,
[TuiCurrencyCode.SingaporeDollar]: TuiCurrency.SingaporeDollar,
[TuiCurrencyCode.MoldovanLeu]: TuiCurrency.MoldovanLeu,
[TuiCurrencyCode.PolandZloty]: TuiCurrency.PolandZloty,
[TuiCurrencyCode.SingaporeDollar]: TuiCurrency.SingaporeDollar,
[TuiCurrencyCode.AustralianDollar]: TuiCurrency.AustralianDollar,
[TuiCurrencyCode.HongKongDollar]: TuiCurrency.HongKongDollar,
[TuiCurrencyCode.CanadianDollar]: TuiCurrency.CanadianDollar,
[TuiCurrencyCode.CzechKoruna]: TuiCurrency.CzechKoruna,
[TuiCurrencyCode.EastCaribbeanDollar]: TuiCurrency.EastCaribbeanDollar,
[TuiCurrencyCode.Euro]: TuiCurrency.Euro,
[TuiCurrencyCode.Forint]: TuiCurrency.Forint,
[TuiCurrencyCode.Pound]: TuiCurrency.Pound,
[TuiCurrencyCode.Baht]: TuiCurrency.Baht,
[TuiCurrencyCode.BahrainiDinar]: TuiCurrency.BahrainiDinar,
[TuiCurrencyCode.TurkishLira]: TuiCurrency.TurkishLira,
[TuiCurrencyCode.YuanRenminbi]: TuiCurrency.YuanRenminbi,
[TuiCurrencyCode.Yen]: TuiCurrency.Yen,
[TuiCurrencyCode.IsraeliShekel]: TuiCurrency.IsraeliShekel,
[TuiCurrencyCode.IsraeliShekel]: TuiCurrency.IsraeliShekel,
[TuiCurrencyCode.IndianRupee]: TuiCurrency.IndianRupee,
[TuiCurrencyCode.SwissFranc]: TuiCurrency.SwissFranc,
[TuiCurrencyCode.ArmenianDram]: TuiCurrency.ArmenianDram,
Expand Down
18 changes: 18 additions & 0 deletions projects/addon-commerce/utils/get-currency-symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,27 @@ export function tuiGetCurrencySymbol(currency: TuiCurrencyVariants): string | nu
case TuiCurrency.AustralianDollar:
case TuiCurrencyCode.AustralianDollar:
return 'A$';
case TuiCurrency.BahrainiDinar:
case TuiCurrencyCode.BahrainiDinar:
return 'BD';
case TuiCurrency.CzechKoruna:
case TuiCurrencyCode.CzechKoruna:
return 'Kč';
case TuiCurrency.HongKongDollar:
case TuiCurrencyCode.HongKongDollar:
return 'HK$';
case TuiCurrency.CanadianDollar:
case TuiCurrencyCode.CanadianDollar:
return 'C$';
case TuiCurrency.EastCaribbeanDollar:
case TuiCurrencyCode.EastCaribbeanDollar:
return 'EC$';
case TuiCurrency.Euro:
case TuiCurrencyCode.Euro:
return '€';
case TuiCurrency.Forint:
case TuiCurrencyCode.Forint:
return 'Ft';
case TuiCurrency.Pound:
case TuiCurrencyCode.Pound:
return '£';
Expand Down Expand Up @@ -95,9 +107,15 @@ export function tuiGetCurrencySymbol(currency: TuiCurrencyVariants): string | nu
case TuiCurrency.SaudiRiyal:
case TuiCurrencyCode.SaudiRiyal:
return 'SR';
case TuiCurrency.MoldovanLeu:
case TuiCurrencyCode.MoldovanLeu:
return 'L';
case TuiCurrency.MongolianTugrik:
case TuiCurrencyCode.MongolianTugrik:
return '₮';
case TuiCurrency.PolandZloty:
case TuiCurrencyCode.PolandZloty:
return 'zł';
case TuiCurrency.SouthAfricanRand:
case TuiCurrencyCode.SouthAfricanRand:
return 'R';
Expand Down

0 comments on commit 710e1f6

Please sign in to comment.