+ ExchangeVersionResponse
This commit is contained in:
parent
22a26441e8
commit
47c4303363
1 changed files with 97 additions and 0 deletions
97
src/api.ml
97
src/api.ml
|
|
@ -81,6 +81,103 @@ module RelativeTime = struct
|
||||||
|> Jsont.Object.finish
|
|> Jsont.Object.finish
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module CurrencySpecification = struct
|
||||||
|
type t = {
|
||||||
|
name: string;
|
||||||
|
num_fractional_input_digits: int;
|
||||||
|
num_fractional_normal_digits: int;
|
||||||
|
num_fractional_trailing_zero_digits: int;
|
||||||
|
alt_unit_names: string;
|
||||||
|
common_amounts: Amount.t list;
|
||||||
|
}
|
||||||
|
|
||||||
|
let jsont =
|
||||||
|
let make name num_fractional_input_digits num_fractional_normal_digits
|
||||||
|
num_fractional_trailing_zero_digits alt_unit_names common_amounts =
|
||||||
|
{
|
||||||
|
name;
|
||||||
|
num_fractional_input_digits;
|
||||||
|
num_fractional_normal_digits;
|
||||||
|
num_fractional_trailing_zero_digits;
|
||||||
|
alt_unit_names;
|
||||||
|
common_amounts;
|
||||||
|
}
|
||||||
|
in
|
||||||
|
let name v = v.name in
|
||||||
|
let num_fractional_input_digits v = v.num_fractional_input_digits in
|
||||||
|
let num_fractional_normal_digits v = v.num_fractional_normal_digits in
|
||||||
|
let num_fractional_trailing_zero_digits v =
|
||||||
|
v.num_fractional_trailing_zero_digits
|
||||||
|
in
|
||||||
|
let alt_unit_names v = v.alt_unit_names in
|
||||||
|
let common_amounts v = v.common_amounts in
|
||||||
|
let open Jsont.Object in
|
||||||
|
map ~kind:"CurrencySpecification" make
|
||||||
|
|> mem "name" Jsont.string ~enc:name
|
||||||
|
|> mem "num_fractional_input_digits" Jsont.int
|
||||||
|
~enc:num_fractional_input_digits
|
||||||
|
|> mem "num_fractional_normal_digits" Jsont.int
|
||||||
|
~enc:num_fractional_normal_digits
|
||||||
|
|> mem "num_fractional_trailing_zero_digits" Jsont.int
|
||||||
|
~enc:num_fractional_trailing_zero_digits
|
||||||
|
|> mem "alt_unit_names" Jsont.string ~enc:alt_unit_names
|
||||||
|
|> mem "common_amounts" (Jsont.list Amount.jsont) ~enc:common_amounts
|
||||||
|
|> finish
|
||||||
|
end
|
||||||
|
|
||||||
|
module ExchangeVersionResponse = struct
|
||||||
|
type t = {
|
||||||
|
version: string;
|
||||||
|
(* todo: const string
|
||||||
|
name: "taler-exchange";*)
|
||||||
|
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 =
|
||||||
|
{
|
||||||
|
version;
|
||||||
|
implementation;
|
||||||
|
currency;
|
||||||
|
shopping_url;
|
||||||
|
open_banking_gateway;
|
||||||
|
currency_specification;
|
||||||
|
supported_kyc_requirements;
|
||||||
|
aml_spa_dialect;
|
||||||
|
}
|
||||||
|
in
|
||||||
|
let version v = v.version 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
|
||||||
|
let open Jsont.Object in
|
||||||
|
map ~kind:"ExchangeVersionResponse" make
|
||||||
|
|> mem "version" Jsont.string ~enc:version
|
||||||
|
|> mem "implementation" (Jsont.option Jsont.string) ~enc:implementation
|
||||||
|
|> mem "currency" Jsont.string ~enc:currency
|
||||||
|
|> mem "shopping_url" (Jsont.option Jsont.string) ~enc:shopping_url
|
||||||
|
|> mem "open_banking_gateway"
|
||||||
|
(Jsont.option Jsont.string)
|
||||||
|
~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
|
||||||
|
|
||||||
module RsaDenominationKey = struct
|
module RsaDenominationKey = struct
|
||||||
type t = {
|
type t = {
|
||||||
age_mask: int;
|
age_mask: int;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue