Add a validate callback to Currency objects that checks whether an amount is valid for a currency, e.g. has the right amount of decimals, or, in case of the Malagasy ariary, for instance, which is not divided into 100, but 5 subunits, has decimals that represent a valid fraction of the currency.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | currency_1372414_00.patch | 6.4 KB | xano |
Comments
Comment #1
xanoPerhaps we should change this into a method for rounding amounts based on their currency.
Comment #2
xanoWe should support higher precisions than currencies officially have to prevent rounding errors. However, we should have functions to round amounts to currencies' official precisions.
Comment #3
xanoComment #4
xanobartfeenstra/currency has been updated. When #1903748: Composer update is fixed, we can use the new subunits property for rounding.
Comment #5
xanoComment #6
xanoComment #8
xano