commit 5c1cfafd11db4cab79137838022c49ebe5113bd2
parent 24902458fe0c0d2293de8dc268b13ab3c6546807
Author: Antoine A <>
Date: Fri, 17 Nov 2023 16:45:14 +0000
Improve corebank and conversion API
Diffstat:
3 files changed, 58 insertions(+), 36 deletions(-)
diff --git a/core/api-bank-conversion-info.rst b/core/api-bank-conversion-info.rst
@@ -47,12 +47,55 @@ is used by wallets for withdrawals that involve a currency conversion.
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
+
+ // Name of the API.
+ name: "taler-conversion-info";
// Currency used by this bank.
- currency: string;
+ regional_currency: string;
- // Name of the API.
- name: "taler-conversion-info";
+ // How the bank SPA should render this currency.
+ regional_currency_specification: CurrencySpecification;
+
+ // External currency used during conversion.
+ fiat_currency: string;
+
+ // How the bank SPA should render this currency.
+ fiat_currency_specification: CurrencySpecification;
+
+ // Extra conversion rate information.
+ // Only present if server opts in to report the static conversion rate.
+ conversion_info?: {
+ // Exchange rate to buy regional currency from fiat
+ cashin_ratio: DecimalNumber;
+
+ // Exchange rate to sell regional currency for fiat
+ cashout_ratio: DecimalNumber;
+
+ // Fee to subtract after applying the cashin ratio.
+ cashin_fee: Amount;
+
+ // Fee to subtract after applying the cashout ratio.
+ cashout_fee: Amount;
+
+ // Minimum amount authorised for cashin, in fiat before conversion
+ cashin_min_amount: Amount;
+
+ // Minimum amount authorised for cashout, in regional before conversion
+ cashout_min_amount: Amount;
+
+ // Smallest possible regional amount, converted amount is rounded to this amount
+ cashin_tiny_amount: Amount;
+
+ // Smallest possible fiat amount, converted amount is rounded to this amount
+ cashout_tiny_amount: Amount;
+
+ // Rounding mode used during cashin conversion
+ cashin_rounding_mode: "zero" | "up" | "nearest";
+
+ // Rounding mode used during cashout conversion
+ cashout_rounding_mode: "zero" | "up" | "nearest";
+ }
}
@@ -88,7 +131,7 @@ is used by wallets for withdrawals that involve a currency conversion.
:http:statuscode:`409 Conflict`:
The amount is too small to be converted, either because it produces produce an amount less than zero, or because the server requires a higher minimum amount than that supplied.
:http:statuscode:`501 Not implemented`:
- This server does not support conversion or this specific conversion is not currently supported.
+ This server does not support conversion, client should check config response.
**Details:**
@@ -131,7 +174,7 @@ is used by wallets for withdrawals that involve a currency conversion.
:http:statuscode:`409 Conflict`:
The amount is too small to be converted, either because it produces produce an amount less than zero, or because the server requires a higher minimum amount than that supplied.
:http:statuscode:`501 Not implemented`:
- This server does not support conversion or this specific conversion is not currently supported.
+ This server does not support conversion, client should check config response.
**Details:**
diff --git a/core/api-corebank.rst b/core/api-corebank.rst
@@ -1,7 +1,7 @@
..
This file is part of GNU TALER.
- Copyright (C) 2014-2020 Taler Systems SA
+ Copyright (C) 2014-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -77,11 +77,9 @@ Config
// API version in the form $n:$n:$n
version: string;
- // If 'true', the server provides local currency
- // conversion support.
- // If missing or false, some parts of the API
- // are not supported and return 404.
- have_cashout?: boolean;
+ // If 'true' the server provides local currency conversion support
+ // If 'false' some parts of the API are not supported and return 501
+ allow_conversion: boolean;
// If 'true' anyone can register
// If 'false' only the admin can
@@ -91,30 +89,11 @@ Config
// If 'false' only the admin can delete accounts
allow_deletions: boolean;
- // How the bank SPA should render the currency.
- currency: CurrencySpecification;
+ // Currency used by this bank.
+ currency: string;
- // Fiat currency. That is the currency in which
- // cash-out operations ultimately wire money.
- // Only applicable if have_cashout=true.
- fiat_currency?: CurrencySpecification;
-
- // Extra conversion rate information.
- // Only present if conversion is supported and the server opts in
- // to report the static conversion rate.
- conversion_info?: {
- // Exchange rate to buy the local currency from the external one
- buy_at_ratio: DecimalNumber;
-
- // Exchange rate to sell the local currency for the external one
- sell_at_ratio: DecimalNumber;
-
- // Fee to subtract after applying the buy ratio.
- buy_in_fee: DecimalNumber;
-
- // Fee to subtract after applying the sell ratio.
- sell_out_fee: DecimalNumber;
- }
+ // How the bank SPA should render this currency.
+ currency_specification: CurrencySpecification;
}
@@ -1129,7 +1108,7 @@ Taler Conversion Info API
.. http:any:: /conversion-info/*
All endpoints under this prefix are specified
- by the :doc:`GNU Taler Revenue API </core/api-bank-conversion-info>`.
+ by the :doc:`GNU Taler Conversion Info API </core/api-bank-conversion-info>`.
EBICS Host
----------
diff --git a/core/index-bank-apis.rst b/core/index-bank-apis.rst
@@ -31,7 +31,7 @@ Bank RESTful APIs
api-bank-wire
api-bank-revenue
api-bank-integration
-
+ api-bank-conversion-info
.. toctree::
:hidden: