+ 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
|
||||
|
|
|
|||
|
|
@ -459,6 +459,35 @@ module MasterDelWirePS = struct
|
|||
include MK (R)
|
||||
end
|
||||
|
||||
module MasterDrainProfitPS = struct
|
||||
module R = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_DRAIN_PROFITS *)
|
||||
type r = {
|
||||
wtid: WireTransferIdentifierRawP.t;
|
||||
date: TimeAbsoluteNBO.t;
|
||||
amount: AmountNBO.t;
|
||||
h_section: Hash_64_cstr.t;
|
||||
h_payto: FullPaytoHash.t;
|
||||
}
|
||||
|
||||
let bin =
|
||||
let open Bin in
|
||||
Purpose.make_bin Taler_signatures.master_drain_profit @@ fun _purpose ->
|
||||
record (fun _purpose wtid date amount h_section h_payto ->
|
||||
{ wtid; date; amount; h_section; h_payto })
|
||||
|+ Purpose.field _purpose
|
||||
|+ field WireTransferIdentifierRawP.bin (fun t -> t.wtid)
|
||||
|+ field TimeAbsoluteNBO.bin (fun t -> t.date)
|
||||
|+ field AmountNBO.bin (fun t -> t.amount)
|
||||
|+ field Hash_64_cstr.bin (fun t -> t.h_section)
|
||||
|+ field FullPaytoHash.bin (fun t -> t.h_payto)
|
||||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
(* ### BIN IMPL END ### *)
|
||||
|
||||
module WithdrawRequestPS = struct
|
||||
|
|
@ -588,17 +617,6 @@ module MasterWireFeePS = struct
|
|||
}
|
||||
end
|
||||
|
||||
module MasterDrainProfitPS = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_DRAIN_PROFITS *)
|
||||
type t = {
|
||||
wtid: WireTransferIdentifierRawP.t;
|
||||
date: TimeAbsoluteNBO.t;
|
||||
amount: AmountNBO.t;
|
||||
h_section: Hash_64_cstr.t;
|
||||
h_payto: FullPaytoHash.t;
|
||||
}
|
||||
end
|
||||
|
||||
module DepositTrackPS = struct
|
||||
(* purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION *)
|
||||
type t = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue