Handle minor amount values
Kunde21 opened this issue · comments
Chad Kunde commented
Financial APIs use minor values in order to avoid any invalid amounts or ambiguous encoding.
As this library stands, it is unable to handle parsing amounts from or writing amounts to a string in minor units. ToMinorUnits
risks overflow attacks on int64 datatype.
Bojan Zivanovic commented
Let's add a NewFromMinorUnits() which parallels ToMinorUnits(), and use strings for both.
How does that sound?
Chad Kunde commented
I'm experimenting with a type currency.Minor
that embeds an amount, so the encoding/decoding can be handled properly, as well.
Bojan Zivanovic commented