Add custom currency support via custom_currency_path#515
Merged
Conversation
kajol-maheshwari
left a comment
There was a problem hiding this comment.
I think we should add some documentation for configuration and the shape of custom currencies file
nnidhi
approved these changes
Feb 27, 2026
Contributor
Author
|
The PR description includes config examples and the YAML format — is there a specific place you'd like documentation added (README, inline comments, etc.)? |
5eee16a to
ecbaede
Compare
kajol-maheshwari
left a comment
There was a problem hiding this comment.
@csgavino yes in the README, like we have for crypto currencies https://github.com/Shopify/money?tab=readme-ov-file#crypto-currencies
ecbaede to
4c9a266
Compare
kajol-maheshwari
approved these changes
Feb 27, 2026
robinbrandt
reviewed
Feb 27, 2026
4c9a266 to
c450535
Compare
robinbrandt
reviewed
Mar 2, 2026
robinbrandt
reviewed
Mar 2, 2026
Allow apps to define custom currencies (e.g., loyalty points) by pointing Money::Config to a YAML file. Lookup order: ISO → crypto → custom, so custom currencies cannot shadow built-in ones. Uses YAML.safe_load_file for user-provided paths and a path-keyed cache to support per-Fiber config isolation.
c450535 to
a647f51
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for app-defined custom currencies (e.g. loyalty points) loaded from a user-provided YAML file. Follows the same pattern established in #401 for crypto currencies: config option gates the feature,
Loaderreads the file, data is frozen viadeep_deduplicate!.Changes
custom_currency_pathconfig option (defaults to nil)Loader.load_custom_currencies(path)usingYAML.safe_load_filefor securityCurrencyandCurrency::Loaderto handle custom currencies as a third-tier fallback (ISO > crypto > custom)@@custom_currencies_cache[path]) for fiber safetyBreaking changes
None. The feature is opt-in and disabled by default, so existing code will continue to work without any changes.
Configuration System
Before
After
YAML format
Design decisions
YAML.safe_load_filefor user-provided paths (bundled YAML files still useYAML.load_file)ArgumentErrorraised if the YAML file doesn't contain a Hashcustom_currency_pathvalues don't share stale data