Hello,
while using this library I noticed that the Currency::find() function is returning an error for the HUF currency (InvalidCurrency). Investigating further, I found that the issue lies in the definitions of the ISO alpha codes in the Currency objects in the iso.rs file.
Due to the way the lookup maps are populated in currency.rs (using the iso_alpha_code field as key) this also causes the function to return the wrong Currency object for HTG, since the values in the hash map get overridden due to the duplicate values.
The PR also contains a fix for a similar copy-paste bug regarding the numeric codes as well as some tests to ensure those kind of bugs are caught before being merged. I put them in the same file, if you don't mind.
Hello, while using this library I noticed that the
Currency::find()
function is returning an error for the HUF currency (InvalidCurrency
). Investigating further, I found that the issue lies in the definitions of the ISO alpha codes in theCurrency
objects in the iso.rs file.Due to the way the lookup maps are populated in currency.rs (using the
iso_alpha_code
field as key) this also causes the function to return the wrongCurrency
object for HTG, since the values in the hash map get overridden due to the duplicate values.The PR also contains a fix for a similar copy-paste bug regarding the numeric codes as well as some tests to ensure those kind of bugs are caught before being merged. I put them in the same file, if you don't mind.