[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-docs] branch master updated: improve amount description, no more
From: |
gnunet |
Subject: |
[taler-docs] branch master updated: improve amount description, no more ParsedAmount |
Date: |
Thu, 25 Mar 2021 23:44:21 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository docs.
The following commit(s) were added to refs/heads/master by this push:
new 53da30c improve amount description, no more ParsedAmount
53da30c is described below
commit 53da30caea49d5802333994a42f0ccfe43e5138f
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu Mar 25 23:43:59 2021 +0100
improve amount description, no more ParsedAmount
---
core/api-common.rst | 49 +++++++++++++++++++------------------------------
1 file changed, 19 insertions(+), 30 deletions(-)
diff --git a/core/api-common.rst b/core/api-common.rst
index a875d10..cecaf95 100644
--- a/core/api-common.rst
+++ b/core/api-common.rst
@@ -387,37 +387,15 @@ this allows accurate representation of monetary amounts.
The following constrains apply for a valid amount:
-1. The ``<Currency>`` part must be at most 12 characters long and may not
contain a colon (``:``).
+1. The ``<Currency>`` part must be at most 11 characters long and may only
consist
+ of ASCII letters (``a-zA-Z``).
2. The integer part of ``<DecimalAmount>`` may be at most 2^52.
3. The fractional part of ``<DecimalAmount>`` may contain at most 8 decimal
digits.
-Internally, amounts are parsed into the following object:
-
.. note::
"EUR:1.50" and "EUR:10" are valid amounts. These are all invalid amounts:
"A:B:1.5", "EUR:4503599627370501.0", "EUR:1.", "EUR:.1".
-.. ts:def:: ParsedAmount
-
- interface ParsedAmount {
- // Name of the currency using either a three-character ISO 4217 currency
- // code, or a regional currency identifier starting with a "*" followed by
- // at most 10 characters. ISO 4217 exponents in the name are not
supported,
- // although the "fraction" is corresponds to an ISO 4217 exponent of 6.
- currency: string;
-
- // Non-negative integer value in the currency, can be at most 2^52.
- // Note that "1" here would correspond to 1 EUR or 1 USD,
- // depending on `currency`, not 1 cent.
- value: number;
-
- // Unsigned 32 bit fractional value to be added to ``value`` representing
- // an additional currency fraction, in units of one hundred millionth
(1e-8)
- // of the base currency value. For example, a fraction
- // of 50,000,000 would correspond to 50 cents.
- fraction: number;
- }
-
An amount that is prefixed with a ``+`` or ``-`` character is also used in
certain contexts.
When no sign is present, the amount is assumed to be positive.
@@ -471,14 +449,25 @@ value and the denomination of the currency:
.. sourcecode:: c
- struct TALER_Amount {
+ struct TALER_AmountNBO {
+ // Non-negative integer value in the currency (in network byte order),
+ // can be at most 2^52.
+ // Note that "1" here would correspond to 1 EUR or 1 USD,
+ // depending on `currency`, not 1 cent.
uint64_t value;
+
+ // Unsigned 32 bit fractional value (in network byte order)
+ // to be added to ``value`` representing
+ // an additional currency fraction, in units of one hundred millionth
(1e-8)
+ // of the base currency value. For example, a fraction
+ // of 50,000,000 would correspond to 50 cents.
uint32_t fraction;
- uint8_t currency_code[12]; // i.e. "EUR" or "USD"
- };
- struct TALER_AmountNBO {
- uint64_t value; // in network byte order
- uint32_t fraction; // in network byte order
+
+ // Name of the currency, using either a three-character ISO 4217 currency
+ // code, or a regional currency identifier between 4 and 11 characters,
+ // consisting of ASCII alphabetic characters ("a-zA-Z").
+ // Should be padded to 12 bytes with 0-characters.
+ // Currency codes are compared case-insensitively.
uint8_t currency_code[12];
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-docs] branch master updated: improve amount description, no more ParsedAmount,
gnunet <=