storj/satellite/payments
paul cannon a16aecfa96 satellite/payments: specialized type for monetary amounts
Why: big.Float is not an ideal type for dealing with monetary amounts,
because no matter how high the precision, some non-integer decimal
values can not be represented exactly in base-2 floating point. Also,
storing gob-encoded big.Float values in the database makes it very hard
to use those values in meaningful queries, making it difficult to do
any sort of analysis on billing.

For better accuracy, then, we can just represent monetary values as
integers (in whatever base units are appropriate for the currency). For
example, STORJ tokens or Bitcoins can not be split into pieces smaller
than 10^-8, so we can store amounts of STORJ or BTC with precision
simply by moving the decimal point 8 digits to the right. For USD values
(assuming we don't want to deal with fractional cents), we can move the
decimal point 2 digits to the right.

To make it easier and less error-prone to deal with the math involved, I
introduce here a new type, monetary.Amount, instances of which have an
associated value _and_ a currency.

Change-Id: I03395d52f0e2473cf301361f6033722b54640265
2021-09-28 23:27:44 +00:00
..
coinpayments satellite/payments: specialized type for monetary amounts 2021-09-28 23:27:44 +00:00
monetary satellite/payments: specialized type for monetary amounts 2021-09-28 23:27:44 +00:00
paymentsconfig web,satellite: Remove paywall-related functionality 2021-06-29 02:47:48 +02:00
stripecoinpayments satellite/payments: specialized type for monetary amounts 2021-09-28 23:27:44 +00:00
account.go web,satellite: Remove paywall-related functionality 2021-06-29 02:47:48 +02:00
balance.go satellite: account balance divided into Free Credits and Coins 2020-05-18 14:25:26 +00:00
charges.go satellite/console: add credit card charges to billing history 2020-01-03 17:34:59 +02:00
coupons_test.go satellite/payments: fix invoice generation to include the last day of 2021-08-31 16:25:18 +00:00
coupons.go satellite/payments: fix invoice generation to include the last day of 2021-08-31 16:25:18 +00:00
creditcards.go satellite/{payments,admin}: add deletion of user creditcards on account deletion 2020-08-27 10:18:19 +00:00
credits.go all: switch to storj.io/common/uuid 2020-03-31 19:16:41 +03:00
invoices.go satellite/admin: add user deletion 2020-07-14 11:37:00 +00:00
projectcharges.go all: switch to storj.io/common/uuid 2020-03-31 19:16:41 +03:00
tokens.go satellite/payments: specialized type for monetary amounts 2021-09-28 23:27:44 +00:00