~
This commit is contained in:
parent
af355249fc
commit
72b0c3012a
7 changed files with 72 additions and 76 deletions
|
|
@ -17,8 +17,8 @@ let seed req _server _env =
|
|||
|
||||
let config req _server _env =
|
||||
Logs.info (fun m -> m "GET /config");
|
||||
let s = Api.(encode_exn ExchangeVersionResponse.jsont config) in
|
||||
Respond.ok s req
|
||||
let res = Api.encode Api.ExchangeVersionResponse.jsont config in
|
||||
Respond.result res req
|
||||
|
||||
(* TODO
|
||||
for now we only have one item in each "denom group"
|
||||
|
|
@ -65,21 +65,7 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date =
|
|||
let shopping_url = Config.shopping_url in
|
||||
let open_banking_gateway = Config.open_banking_gateway_url in
|
||||
let bank_compliance_language = Config.bank_compliance_language in
|
||||
let currency_specification =
|
||||
let v = Config.Currency.v 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
|
||||
let currency_specification = Api.currency_specification in
|
||||
let tiny_amount = Config.tiny_amount in
|
||||
let stefan_abs = Config.stefan_abs in
|
||||
let stefan_log = Config.stefan_log in
|
||||
|
|
@ -234,15 +220,14 @@ let keys req server _env =
|
|||
let* last_issue_date =
|
||||
match Vif.Queries.get req "last_issue_date" with
|
||||
| [] -> Ok None
|
||||
| v :: _ -> (
|
||||
match int_of_string_opt v with
|
||||
| s :: _ -> (
|
||||
match Int64.of_string_opt s with
|
||||
| None ->
|
||||
Error
|
||||
"invalid `?last_issue_date` query param, int_of_string failure"
|
||||
| Some n -> Ok (Some (Time.Timestamp.of_s (Int64.of_int n))))
|
||||
| Some n -> Ok (Some (Timestamp.of_s n)))
|
||||
in
|
||||
let* v = mk_keys ~db_conn keys ~last_issue_date in
|
||||
let s = Api.encode_exn jsont v in
|
||||
Ok s
|
||||
Api.encode jsont v
|
||||
in
|
||||
Respond.result res req
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue