+ WireSetupMessage
This commit is contained in:
parent
689c08ddf5
commit
21473a6ddc
2 changed files with 122 additions and 21 deletions
40
src/api.ml
40
src/api.ml
|
|
@ -483,3 +483,43 @@ module GlobalFees = struct
|
|||
|> mem "master_sig" GlobalFeesPS.jsont ~enc:master_sig
|
||||
|> finish
|
||||
end
|
||||
|
||||
module WireSetupMessage = struct
|
||||
type t = {
|
||||
payto_uri: string;
|
||||
master_sig_wire: MasterWireDetailsPS.t;
|
||||
master_sig_add: MasterAddWirePS.t;
|
||||
(* TODO time monotonic *)
|
||||
validity_start: Timestamp.t;
|
||||
bank_label: string option;
|
||||
priority: int option;
|
||||
}
|
||||
|
||||
let jsont =
|
||||
let make payto_uri master_sig_wire master_sig_add validity_start bank_label
|
||||
priority =
|
||||
{
|
||||
payto_uri;
|
||||
master_sig_wire;
|
||||
master_sig_add;
|
||||
validity_start;
|
||||
bank_label;
|
||||
priority;
|
||||
}
|
||||
in
|
||||
let payto_uri v = v.payto_uri in
|
||||
let master_sig_wire v = v.master_sig_wire in
|
||||
let master_sig_add v = v.master_sig_add in
|
||||
let validity_start v = v.validity_start in
|
||||
let bank_label v = v.bank_label in
|
||||
let priority v = v.priority in
|
||||
let open Jsont.Object in
|
||||
map ~kind:"WireSetupMessage" make
|
||||
|> mem "payto_uri" Jsont.string ~enc:payto_uri
|
||||
|> mem "master_sig_wire" MasterWireDetailsPS.jsont ~enc:master_sig_wire
|
||||
|> mem "master_sig_add" MasterAddWirePS.jsont ~enc:master_sig_add
|
||||
|> mem "validity_start" Timestamp.jsont ~enc:validity_start
|
||||
|> mem "bank_label" (Jsont.option Jsont.string) ~enc:bank_label
|
||||
|> mem "priority" (Jsont.option Jsont.int) ~enc:priority
|
||||
|> finish
|
||||
end
|
||||
|
|
|
|||
|
|
@ -355,6 +355,88 @@ module GlobalFeesPS = struct
|
|||
include MK (R)
|
||||
end
|
||||
|
||||
module MasterWireDetailsPS = struct
|
||||
module R = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_DETAILS *)
|
||||
type r = {
|
||||
h_wire_details: FullPaytoHash.t;
|
||||
h_conversion_url: Hash_64_cstr.t;
|
||||
h_credit_restrictions: Hash_64_cstr.t;
|
||||
h_debit_restrictions: Hash_64_cstr.t;
|
||||
}
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
Purpose.make_bin Taler_signatures.master_wire_details @@ fun purpose ->
|
||||
record
|
||||
(fun
|
||||
_purpose
|
||||
h_wire_details
|
||||
h_conversion_url
|
||||
h_credit_restrictions
|
||||
h_debit_restrictions
|
||||
->
|
||||
{
|
||||
h_wire_details;
|
||||
h_conversion_url;
|
||||
h_credit_restrictions;
|
||||
h_debit_restrictions;
|
||||
})
|
||||
|+ Purpose.field purpose
|
||||
|+ field FullPaytoHash.bin (fun t -> t.h_wire_details)
|
||||
|+ field Hash_64_cstr.bin (fun t -> t.h_conversion_url)
|
||||
|+ field Hash_64_cstr.bin (fun t -> t.h_credit_restrictions)
|
||||
|+ field Hash_64_cstr.bin (fun t -> t.h_debit_restrictions)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
module MasterAddWirePS = struct
|
||||
module R = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_ADD_WIRE *)
|
||||
type r = {
|
||||
start_date: TimeAbsoluteNBO.t;
|
||||
h_wire: FullPaytoHash.t;
|
||||
h_conversion_url: Hash_64_cstr.t;
|
||||
h_credit_restrictions: Hash_64_cstr.t;
|
||||
h_debit_restrictions: Hash_64_cstr.t;
|
||||
}
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
Purpose.make_bin Taler_signatures.master_add_wire @@ fun _purpose ->
|
||||
record
|
||||
(fun
|
||||
_purpose
|
||||
start_date
|
||||
h_wire
|
||||
h_conversion_url
|
||||
h_credit_restrictions
|
||||
h_debit_restrictions
|
||||
->
|
||||
{
|
||||
start_date;
|
||||
h_wire;
|
||||
h_conversion_url;
|
||||
h_credit_restrictions;
|
||||
h_debit_restrictions;
|
||||
})
|
||||
|+ Purpose.field _purpose
|
||||
|+ field TimeAbsoluteNBO.bin (fun t -> t.start_date)
|
||||
|+ field FullPaytoHash.bin (fun t -> t.h_wire)
|
||||
|+ field Hash_64_cstr.bin (fun t -> t.h_conversion_url)
|
||||
|+ field Hash_64_cstr.bin (fun t -> t.h_credit_restrictions)
|
||||
|+ field Hash_64_cstr.bin (fun t -> t.h_debit_restrictions)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
(* ### BIN IMPL END ### *)
|
||||
|
||||
module WithdrawRequestPS = struct
|
||||
|
|
@ -473,16 +555,6 @@ module ExchangeKeySetPS = struct
|
|||
}
|
||||
end
|
||||
|
||||
module MasterWireDetailsPS = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_DETAILS *)
|
||||
type t = {
|
||||
h_wire_details: FullPaytoHash.t;
|
||||
h_conversion_url: Hash_64_cstr.t;
|
||||
h_credit_restrictions: Hash_64_cstr.t;
|
||||
h_debit_restrictions: Hash_64_cstr.t;
|
||||
}
|
||||
end
|
||||
|
||||
module MasterWireFeePS = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_FEES *)
|
||||
type t = {
|
||||
|
|
@ -843,17 +915,6 @@ module CoinPurseRefundConfirmationPS = struct
|
|||
}
|
||||
end
|
||||
|
||||
module MasterAddWirePS = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_ADD_WIRE *)
|
||||
type t = {
|
||||
start_date: TimeAbsoluteNBO.t;
|
||||
h_wire: FullPaytoHash.t;
|
||||
h_conversion_url: Hash_64_cstr.t;
|
||||
h_credit_restrictions: Hash_64_cstr.t;
|
||||
h_debit_restrictions: Hash_64_cstr.t;
|
||||
}
|
||||
end
|
||||
|
||||
module MasterDelWirePS = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_DEL_WIRE *)
|
||||
type t = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue