Money as represented by SumUp's legacy resources (Checkouts, Customers'
payment instruments, Transactions, Payouts): a decimal major-unit
float plus an ISO 4217 currency code, e.g. %{"amount" => 10.5, "currency" => "EUR"}.
This shape predates SumUp's Sumup.Money.MinorUnit representation used by
Readers. It is kept as its own type rather than being coerced into minor
units automatically, because floating point major-unit amounts cannot be
losslessly converted for all currencies without knowing the currency's
exponent (SumUp's API itself does not send that exponent on these legacy
endpoints). Use to_minor_units/1 when you know the currency's exponent
and need exact integer cents for further arithmetic.
Summary
Types
Functions
Builds a t/0 from a decoded JSON map using the given amount/currency keys.
@spec to_minor_units(t(), non_neg_integer()) :: integer()
Converts to integer minor units (e.g. cents) given the currency's decimal exponent (2 for EUR/USD/GBP, 0 for JPY/CLP/COP/HUF, etc).
Rounds half-away-from-zero to avoid systematic bias.
Encodes back into the wire shape expected by legacy endpoints.