A recent graphql gem bump PR in Billing which introduced additional checks to ensured a field isn't defined more than once revealed an issue with Money::Currency.currencies as there is a pair of currency entries with the same ISO code.
The error is raised on https://github.com/Shopify/billing/blob/dependabot/bundler/graphql-1.12.4/app/graphql/types/currency_code.rb#L8, when the iso_code is used to create the fields. There are 2 that are the same with GHS, which results in the error ArgumentError: GHS is already defined for CurrencyCode, please remove one of the definitions.:
[19] pry(main)> (::Money::Currency.currencies.values.map{|x| x["iso_code"]}).count
=> 190
[20] pry(main)> (::Money::Currency.currencies.values.map{|x| x["iso_code"]}).uniq.count
=> 189
{
"priority":100,
"iso_code":"GHS",
"name":"Ghanaian Cedi",
"symbol":"₵",
"disambiguate_symbol":"GH₵",
"alternate_symbols":[
"GH₵"
],
"subunit":"Pesewa",
"subunit_to_unit":100,
"symbol_first":true,
"html_entity":"₵",
"decimal_mark":".",
"thousands_separator":",",
"iso_numeric":"288",
"smallest_denomination":1
}
{
"priority":100,
"iso_code":"GHS",
"name":"Ghanaian Cedi",
"symbol":"₵",
"alternate_symbols":[
"GH¢",
"GH₵"
],
"subunit":"Pesewa",
"subunit_to_unit":100,
"symbol_first":true,
"html_entity":"₵",
"decimal_mark":".",
"thousands_separator":",",
"iso_numeric":"936",
"smallest_denomination":1
}
Based on https://en.wikipedia.org/wiki/ISO_4217#Numeric_codes, it looks like the "iso_numeric":"288" one is historic while "iso_numeric":"936" is current.
I'm unsure how long this has been going on. The relevant ymls haven't been recently changed and they seem to look correct: 288, 936.
Is this indeed an issue? Should we make sure that Money::Currency.currencies doesn't return two currency entries for GHS?
A recent graphql gem bump PR in Billing which introduced additional checks to ensured a field isn't defined more than once revealed an issue with
Money::Currency.currenciesas there is a pair of currency entries with the same ISO code.The error is raised on https://github.com/Shopify/billing/blob/dependabot/bundler/graphql-1.12.4/app/graphql/types/currency_code.rb#L8, when the
iso_codeis used to create the fields. There are 2 that are the same withGHS, which results in the errorArgumentError: GHS is already defined for CurrencyCode, please remove one of the definitions.:Based on https://en.wikipedia.org/wiki/ISO_4217#Numeric_codes, it looks like the
"iso_numeric":"288"one is historic while"iso_numeric":"936"is current.I'm unsure how long this has been going on. The relevant ymls haven't been recently changed and they seem to look correct: 288, 936.
Is this indeed an issue? Should we make sure that
Money::Currency.currenciesdoesn't return two currency entries forGHS?