SumUp represents money in two different, incompatible shapes depending on which API generation you're calling:
Sumup.Money.Float— legacy major-unit float + currency, used by Checkouts, Customers, Transactions and Payouts.Sumup.Money.MinorUnit— integer minor units + explicit exponent + currency, used by Readers.
This module intentionally does not unify them into one struct: doing so would either lose precision (coercing minor units to float) or require guessing a currency's exponent (coercing float to minor units). Instead, each resource module returns whichever shape the underlying endpoint actually returns, and this module offers currency metadata shared by both.
Summary
Functions
Returns the ISO 4217 decimal exponent for a currency code, defaulting to
2 for anything not explicitly known.
Returns true if currency has no minor unit (e.g. JPY, KRW).
Functions
@spec exponent_for(String.t()) :: non_neg_integer()
Returns the ISO 4217 decimal exponent for a currency code, defaulting to
2 for anything not explicitly known.
Useful for converting Sumup.Money.Float amounts to minor units, since
legacy endpoints don't send the exponent explicitly.
iex> Sumup.Money.exponent_for("JPY")
0
iex> Sumup.Money.exponent_for("EUR")
2
Returns true if currency has no minor unit (e.g. JPY, KRW).