taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

commit 4c576832413d8a0877db34a51624193d3a7d7c49
parent d6657d860bb943bf85cbe7f3be538b09231b188e
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Fri, 28 Mar 2025 12:13:02 +0900

fix syntax issues and missing declarations and duplicate amount definition

Diffstat:
Mcore/api-bank-integration.rst | 2+-
Mcore/api-common.rst | 81++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
Mcore/api-corebank.rst | 4++--
Mcore/api-donau.rst | 4++--
Mcore/api-merchant.rst | 15++++++++++-----
Mdesign-documents/058-ebics-tx-unique-id.rst | 4++--
Mdesign-documents/index.rst | 4++--
7 files changed, 70 insertions(+), 44 deletions(-)

diff --git a/core/api-bank-integration.rst b/core/api-bank-integration.rst @@ -182,7 +182,7 @@ for the withdrawal operation (the ``WITHDRAWAL_ID``) to interact with the withdr // operation. The amount to withdraw will be set // by the final ``/withdrawals/$WITHDRAWAL_ID/confirm`` step. // @since **v5** - no_amount_to_wallet?: bool; + no_amount_to_wallet?: boolean; // @deprecated since **v1**, use ``status`` instead // Indicates whether the withdrawal was aborted. diff --git a/core/api-common.rst b/core/api-common.rst @@ -759,6 +759,9 @@ Signatures Amounts ^^^^^^^ +Amounts of currency are always expressed in terms of a base value, a +fractional value and the denomination of the currency. + .. ts:def:: Amount type Amount = string; @@ -792,6 +795,31 @@ When no sign is present, the amount is assumed to be positive. type SignedAmount = string; +.. sourcecode:: c + + 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; + + // 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]; + }; + + Images ^^^^^^ @@ -829,36 +857,6 @@ protocols. The message formats are given in a C-style pseudocode notation. Padding is always specified explicitly, and numeric values are in network byte order (big endian). -Amounts -^^^^^^^ - -Amounts of currency are always expressed in terms of a base value, a fractional -value and the denomination of the currency: - -.. sourcecode:: c - - 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; - - // 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]; - }; - Time ^^^^ @@ -875,6 +873,29 @@ denoting microseconds since the UNIX Epoch. ``UINT64_MAX`` represents "never". uint64_t abs_value_us__; // in network byte order }; +.. sourcecode:: c + + struct GNUNET_TIME_Relative { + uint64_t timestamp_us; + }; + struct GNUNET_TIME_RelativeNBO { + uint64_t rel_value_us__; // in network byte order + }; + +For certain statistics, we need to express relative time +in ways that correspond exactly to the calendar. So while +constants like ``GNUNET_TIME_UNIT_MONTH`` are defined to +mean 30 days, we cannot do this when tracking income for +a merchant over a calendar year. Thus, in this case, +we use the `StatisticBucketRange` when rounding time to +values that cannot be expressed as fixed multiples of +seconds: + + .. ts:def:: StatisticBucketRange + + type MerchantStatisticCounterByBucket = + "decade" | "year" | "quarter" | "month" | "week" | "day" | "hour" | "minute" | "second"; + .. _LegalTrouble: 451 Responses diff --git a/core/api-corebank.rst b/core/api-corebank.rst @@ -935,7 +935,7 @@ Account withdrawals // operation. The amount to withdraw will be set // by the final ``/withdrawals/$WITHDRAWAL_ID/confirm`` step. // @since **v8** - no_amount_to_wallet?: bool; + no_amount_to_wallet?: boolean; } .. ts:def:: BankAccountCreateWithdrawalResponse @@ -1056,7 +1056,7 @@ Account withdrawals // operation. The amount to withdraw will be set // by the final ``/withdrawals/$WITHDRAWAL_ID/confirm`` step. // @since **v8** - no_amount_to_wallet?: bool; + no_amount_to_wallet?: boolean; // Account username username: string; diff --git a/core/api-donau.rst b/core/api-donau.rst @@ -319,10 +319,10 @@ CSR Issue cipher: "CS"; // CSR R0 value - r_pub_0: CsRPublic; + r_pub_0: CSRPublic; // CSR R1 value - r_pub_1: CsRPublic; + r_pub_1: CSRPublic; } diff --git a/core/api-merchant.rst b/core/api-merchant.rst @@ -1416,6 +1416,7 @@ Getting statistics **Request:** :query by: *Optional*. If set to "BUCKET", only statistics by bucket will be returned. If set to "INTERVAL", only staistics kept by interval will be returned. If not set or set to "ANY", both will be returned. + **Response:** :http:statuscode:`200 Ok`: @@ -1455,6 +1456,7 @@ Getting statistics // Sum of all amounts falling under the given // SLUG within this timeframe. cumulative_amounts: Amount[]; + } .. ts:def:: MerchantStatisticAmountByInterval @@ -1469,6 +1471,7 @@ Getting statistics // Sum of all amounts falling under the given // SLUG within this timeframe. cumulative_amounts: Amount[]; + } .. http:get:: /management/instances/$INSTANCE/statistics-counter/$SLUG @@ -1508,7 +1511,7 @@ Getting statistics .. ts:def:: MerchantStatisticCounterByBucket - interface MerchantStatisticCounterByBucket { + interface MerchantStatisticCounterByBucket { // Start time of the bucket (inclusive) start_time: Timestamp; @@ -1521,12 +1524,13 @@ Getting statistics // Sum of all counters falling under the given // SLUG within this timeframe. - cumulative_counter: Number; + cumulative_counter: number; + } - .. ts:def:: MerchantStatisticCounterByBucket + .. ts:def:: MerchantStatisticCounterByInterval - interface MerchantStatisticCounterByBucket { + interface MerchantStatisticCounterByInterval { // Start time of the interval. // The interval always ends at the response @@ -1535,7 +1539,8 @@ Getting statistics // Sum of all counters falling under the given // SLUG within this timeframe. - cumulative_counter: Number; + cumulative_counter: number; + } Deleting instances diff --git a/design-documents/058-ebics-tx-unique-id.rst b/design-documents/058-ebics-tx-unique-id.rst @@ -31,6 +31,7 @@ Solution We should embrace this imperfection and store all the identifiers that are provided as there is always at least one present: .. code-block:: sql + CREATE TABLE incoming_transactions ( acct_svcr_ref TEXT UNIQUE CHECK (char_length(acct_svcr_ref) <= 35), tx_id TEXT UNIQUE CHECK (char_length(tx_id) <= 35), @@ -43,4 +44,4 @@ We should then be able to store all transaction and support UETR everywhere in t Migration ========= -Before running the SQL migration script we can store the current dialect in a Postgres session variable that will then be used to move the current bank_id into the appropriate column. -\ No newline at end of file +Before running the SQL migration script we can store the current dialect in a Postgres session variable that will then be used to move the current bank_id into the appropriate column. diff --git a/design-documents/index.rst b/design-documents/index.rst @@ -70,4 +70,5 @@ Design documents that start with "XX" are considered deprecated. 056-weblate-integration.rst 057-libeufin-bank-account-lockout.rst 058-ebics-tx-unique-id.rst - 999-template -\ No newline at end of file + 059-statistics + 999-template