Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ISO alpha and numeric code definitions in Currency objects #34

Merged
merged 1 commit into from
Jul 27, 2020

Conversation

zacharra
Copy link
Contributor

@zacharra zacharra commented Jul 26, 2020

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.

@zacharra zacharra force-pushed the fix_currency_iso_definitions branch from b2ce34e to 4bd0e01 Compare July 27, 2020 00:04
@varunsrin
Copy link
Owner

Thank you, really appreciate the fix and PR.

@varunsrin varunsrin merged commit 751b83b into varunsrin:master Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants