add /config

This commit is contained in:
swrup 2026-02-07 21:03:21 +01:00
parent c3b36461cf
commit b7c6cfbfd7
3 changed files with 44 additions and 11 deletions

View file

@ -178,41 +178,42 @@ end
module ExchangeVersionResponse = struct
type t = {
version: string;
(* todo: const string
name: "taler-exchange";*)
(* todo jsont const string
`name: "taler-exchange"` *)
name: string;
implementation: string option;
currency: string;
shopping_url: string option;
open_banking_gateway: string option;
currency_specification: CurrencySpecification.t;
supported_kyc_requirements: string list;
aml_spa_dialect: string option;
}
let jsont =
let make version implementation currency shopping_url open_banking_gateway
currency_specification supported_kyc_requirements aml_spa_dialect =
let make version name implementation currency shopping_url
open_banking_gateway currency_specification aml_spa_dialect =
{
version;
name;
implementation;
currency;
shopping_url;
open_banking_gateway;
currency_specification;
supported_kyc_requirements;
aml_spa_dialect;
}
in
let version v = v.version in
let name v = v.name in
let implementation v = v.implementation in
let currency v = v.currency in
let shopping_url v = v.shopping_url in
let open_banking_gateway v = v.open_banking_gateway in
let currency_specification v = v.currency_specification in
let supported_kyc_requirements v = v.supported_kyc_requirements in
let aml_spa_dialect v = v.aml_spa_dialect in
map ~kind:"ExchangeVersionResponse" make
|> mem "version" Jsont.string ~enc:version
|> mem "name" Jsont.string ~enc:name
|> mem "implementation" (Jsont.option Jsont.string) ~enc:implementation
|> mem "currency" Jsont.string ~enc:currency
|> mem "shopping_url" (Jsont.option Jsont.string) ~enc:shopping_url
@ -221,12 +222,38 @@ module ExchangeVersionResponse = struct
~enc:open_banking_gateway
|> mem "currency_specification" CurrencySpecification.jsont
~enc:currency_specification
|> mem "supported_kyc_requirements" (Jsont.list Jsont.string)
~enc:supported_kyc_requirements
|> mem "aml_spa_dialect" (Jsont.option Jsont.string) ~enc:aml_spa_dialect
|> finish
end
let config =
let currency_specification =
let open Config.Currency in
let alt_unit_names =
Parse_config.Alt_unit_names.encode_exn v.alt_unit_names
in
CurrencySpecification.
{
name= v.name;
num_fractional_input_digits= v.fractional_input_digits;
num_fractional_normal_digits= v.fractional_normal_digits;
num_fractional_trailing_zero_digits= v.fractional_trailing_zero_digits;
alt_unit_names;
common_amounts= [];
}
in
ExchangeVersionResponse.
{
version= protocol_version;
name= "taler-exchange";
currency= Config.currency;
currency_specification;
implementation= None;
shopping_url= None;
open_banking_gateway= None;
aml_spa_dialect= None;
}
module RsaDenominationKey = struct
type t = {
age_mask: int;