+ DrainProfitsMessage
This commit is contained in:
parent
5a5e19e3ff
commit
3bfbaf4ccd
2 changed files with 80 additions and 16 deletions
56
src/api.ml
56
src/api.ml
|
|
@ -30,6 +30,12 @@ module ErrorDetail = struct
|
|||
|> Jsont.Object.finish
|
||||
end
|
||||
|
||||
module B32 = struct
|
||||
include B32
|
||||
|
||||
let jsont = Jsont.of_of_string ~kind:"B32" B32.decode ~enc:B32.encode
|
||||
end
|
||||
|
||||
module HashCode : sig
|
||||
type t
|
||||
|
||||
|
|
@ -42,7 +48,7 @@ end = struct
|
|||
let open Digestif.SHA512 in
|
||||
s |> digest_string |> to_raw_string
|
||||
|
||||
let jsont = Jsont.of_of_string ~kind:"HashCode" B32.decode ~enc:B32.encode
|
||||
let jsont = B32.jsont
|
||||
end
|
||||
|
||||
module RelativeTime = struct
|
||||
|
|
@ -98,16 +104,13 @@ module CSDenominationKey = struct
|
|||
cs_pub: B32.t;
|
||||
}
|
||||
|
||||
(* TODO B32.jsont *)
|
||||
let b32_jsont = Jsont.of_of_string ~kind:"B32" B32.decode ~enc:B32.encode
|
||||
|
||||
let jsont =
|
||||
let make age_mask cs_pub = { age_mask; cs_pub } in
|
||||
let age_mask v = v.age_mask in
|
||||
let cs_pub v = v.cs_pub in
|
||||
Jsont.Object.map ~kind:"CSDenominationKey" make
|
||||
|> Jsont.Object.mem "age_mask" Jsont.int ~enc:age_mask
|
||||
|> Jsont.Object.mem "cs_pub" b32_jsont ~enc:cs_pub
|
||||
|> Jsont.Object.mem "cs_pub" B32.jsont ~enc:cs_pub
|
||||
|> Jsont.Object.finish
|
||||
end
|
||||
|
||||
|
|
@ -546,3 +549,46 @@ module WireTeardownMessage = struct
|
|||
|> mem "validity_end" Timestamp.jsont ~enc:validity_end
|
||||
|> finish
|
||||
end
|
||||
|
||||
module DrainProfitsMessage = struct
|
||||
type t = {
|
||||
debit_account_section: string;
|
||||
credit_payto_uri: string;
|
||||
wtid: B32.t;
|
||||
(*
|
||||
// TALER_MasterDrainProfitPS.
|
||||
// Must have purpose TALER_SIGNATURE_MASTER_DRAIN_PROFITS.
|
||||
*)
|
||||
master_sig: EddsaSignature.t;
|
||||
date: Timestamp.t;
|
||||
amount: Amount.t;
|
||||
}
|
||||
|
||||
let jsont =
|
||||
let make debit_account_section credit_payto_uri wtid master_sig date amount
|
||||
=
|
||||
{
|
||||
debit_account_section;
|
||||
credit_payto_uri;
|
||||
wtid;
|
||||
master_sig;
|
||||
date;
|
||||
amount;
|
||||
}
|
||||
in
|
||||
let debit_account_section v = v.debit_account_section in
|
||||
let credit_payto_uri v = v.credit_payto_uri in
|
||||
let wtid v = v.wtid in
|
||||
let master_sig v = v.master_sig in
|
||||
let date v = v.date in
|
||||
let amount v = v.amount in
|
||||
let open Jsont.Object in
|
||||
map ~kind:"DrainProfitsMessage" make
|
||||
|> mem "debit_account_section" Jsont.string ~enc:debit_account_section
|
||||
|> mem "credit_payto_uri" Jsont.string ~enc:credit_payto_uri
|
||||
|> mem "wtid" B32.jsont ~enc:wtid
|
||||
|> mem "master_sig" EddsaSignature.jsont ~enc:master_sig
|
||||
|> mem "date" Timestamp.jsont ~enc:date
|
||||
|> mem "amount" Amount.jsont ~enc:amount
|
||||
|> finish
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue