rename handler modules
This commit is contained in:
parent
f0254c6f5d
commit
f69f393abb
3 changed files with 1 additions and 1 deletions
111
src/http_keys.ml
Normal file
111
src/http_keys.ml
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
[@@@ocaml.warning "-26-27"]
|
||||
|
||||
open Syntax
|
||||
open Api
|
||||
module String_map = Stdlib.Map.Make (Stdlib.String)
|
||||
|
||||
let mk_keys ~db_conn ~sm ~last_issue_date =
|
||||
let version = "0" in
|
||||
let base_url = Config.base_url in
|
||||
let currency = Config.currency in
|
||||
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.to_json_string 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 tiny_amount = Config.tiny_amount in
|
||||
let stefan_abs = Config.stefan_abs in
|
||||
let stefan_log = Config.stefan_log in
|
||||
let stefan_lin = Config.stefan_lin in
|
||||
(* todo asset_type
|
||||
Type of the asset. "fiat", "crypto", "regional" or "stock". *)
|
||||
let asset_type = "xxx" in
|
||||
let* accounts = Pg.get_wire_accouts db_conn |> unwrap_err_caqti in
|
||||
let* wire_fees =
|
||||
(* todo
|
||||
where does wire_methods comes from? *)
|
||||
let wire_method = "xxx" in
|
||||
let+ wire_fees =
|
||||
Pg.get_wire_fees db_conn ~wire_method |> unwrap_err_caqti
|
||||
in
|
||||
String_map.singleton wire_method wire_fees
|
||||
in
|
||||
let wads =
|
||||
(* TODO wads *)
|
||||
[]
|
||||
in
|
||||
let rewards_allowed = false in
|
||||
let kyc_enabled = false in
|
||||
let disable_direct_deposit = (* todo *) false in
|
||||
let master_public_key = Config.master_public_key in
|
||||
let reserve_closing_delay = Config.Exchangedb.idle_reserve_expiration_time in
|
||||
(* todo *)
|
||||
let wallet_balance_limit_without_kyc = None in
|
||||
let hard_limits = [] in
|
||||
let zero_limits = [] in
|
||||
(*
|
||||
{
|
||||
version;
|
||||
base_url;
|
||||
currency;
|
||||
shopping_url;
|
||||
open_banking_gateway;
|
||||
bank_compliance_language;
|
||||
currency_specification;
|
||||
tiny_amount;
|
||||
stefan_abs;
|
||||
stefan_log;
|
||||
stefan_lin;
|
||||
asset_type;
|
||||
accounts;
|
||||
wire_fees;
|
||||
wads;
|
||||
rewards_allowed;
|
||||
kyc_enabled;
|
||||
disable_direct_deposit;
|
||||
master_public_key;
|
||||
reserve_closing_delay;
|
||||
wallet_balance_limit_without_kyc;
|
||||
hard_limits;
|
||||
zero_limits;
|
||||
denominations;
|
||||
exchange_sig;
|
||||
exchange_pub;
|
||||
recoup;
|
||||
global_fees;
|
||||
list_issue_date;
|
||||
auditors;
|
||||
signkeys;
|
||||
extensions;
|
||||
extensions_sig;
|
||||
}
|
||||
*)
|
||||
assert false
|
||||
|
||||
let jsont = ExchangeKeysResponse.jsont
|
||||
|
||||
(* TODO query param ?last_issue_date *)
|
||||
let f req server _env =
|
||||
Logs.info (fun m -> m "GET /keys/");
|
||||
let db_conn = Vif.Server.device Devices.db_connection server in
|
||||
let sm = Vif.Server.device Devices.secmod server in
|
||||
let res =
|
||||
let last_issue_date = Ptime_clock.now () |> Option.some in
|
||||
let* v = mk_keys ~db_conn ~sm ~last_issue_date in
|
||||
let s = Api.encode_exn jsont v in
|
||||
Ok s
|
||||
in
|
||||
Respond_util.respond_with_res res req
|
||||
Loading…
Add table
Add a link
Reference in a new issue