juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.35k stars 1.22k forks source link

feat(core): Add all currencies in Currency Enum #1814

Open prasunna09 opened 1 year ago

prasunna09 commented 1 year ago

Feature Description

Add missing currencies to Currency enum in enum.rs, since we want descent coverage of the currencies. Reference - https://en.wikipedia.org/wiki/List_of_circulating_currencies

Possible Implementation

  1. Add all the missing currencies.
  2. Run the migrations (Can refer to this pr - https://github.com/juspay/hyperswitch/pull/1670/files#diff-b90f2b50c9b9e664a9f6b840c1590342362713cffb3546db779813106242772f)

Have you spent some time to check if this feature request has been raised before?

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

None

tusharxoxoxo commented 1 year ago

@prasunna09 going to take a look at this by the evening, and will submit it in morning

prasunna09 commented 1 year ago

Then I'll assign this to you! @tusharxoxoxo

tusharxoxoxo commented 1 year ago

what should be done for these currencies whose iso code is missing? image

In this issue, do we only need to add the missing currencies in pub enum Currency or do we also need to implement them with their respective iso_4212 code in the very next function and also the other parts such as pub fn is_three_decimal_currency(self) -> bool { and pub fn is_zero_decimal_currency accordingly?? image

prasunna09 commented 1 year ago

Yes, you have to add all the missing currencies in pub enum currency and have to add their corresponding iso_4217 codes and also include them in other is_three_decimal_currency(self) -> bool and pub fn is_zero_decimal_currency.

tusharxoxoxo commented 1 year ago

There r some currencies which are mentioned in this Wikipedia article List_of_circulating_currencies which r not present in ISO_4217 like, for example, SVC is not present in the list of currencies, but is present in ISO_4217 list of currencies and vice versa CNY is present in the list of currencies but is not present in the ISO_4217 list.

tusharxoxoxo commented 1 year ago

HRK is also not present in ISO_4217 list

tusharxoxoxo commented 1 year ago

There r some currencies which are mentioned in this Wikipedia article List_of_circulating_currencies which r not present in ISO_4217 like, for example, SVC is not present in the list of currencies, but is present in ISO_4217 list of currencies and vice versa CNY is present in the list of currencies but is not present in the ISO_4217 list.

my bad CNY is present in the list, I don't understand why CNY is being written in a weird place, it feels completely out of place like all the currencies r written alphabetically but this CNY is placed at a completely strange place out of alphabetical order

tusharxoxoxo commented 1 year ago

some of the currencies go to the 4 decimal digits so for them should I create a new function or leave them as it is CLF

tusharxoxoxo commented 1 year ago

there r a lot of currencies that don't have anything in the place decimal row like it's blank, I am treating those blanks as 0 image