pub struct Trace {
pub comment: String,
pub client: Client,
pub accounts: Vec<TraceAccount>,
pub exchanges: Vec<Exchange>,
}trace only.Expand description
A recorded dialog: the exchanges in order, and the accounts they name.
Fields§
§comment: StringFree text for readers (where and how the trace was recorded).
client: ClientThe client that recorded it, and how its run ended.
accounts: Vec<TraceAccount>Every account an exchange may name, listed once.
exchanges: Vec<Exchange>The exchanges, in the order they happened.
Implementations§
Source§impl Trace
impl Trace
Sourcepub fn from_exchanges(exchanges: Vec<Exchange>) -> Trace
pub fn from_exchanges(exchanges: Vec<Exchange>) -> Trace
A trace from redacted exchanges (as Recorder::exchanges returns
them), anonymised further; no comment, no accounts:
- dialog IDs (HNHBK) and order references (HITAN) become
DIALOG0001,TASK0001, … everywhere they occur; - the product registration in HKVVB becomes stars.
Amounts, names and statements are shape-masked by the recorder already.
Sourcepub fn remask(&mut self)
pub fn remask(&mut self)
Masks the trace again, with the masking rules of this version of
fints-client: for a trace recorded before the rules hid more. The
stand-ins are made anew (aliases and pseudonyms of a fresh random
salt, so they link to no other trace) and every date moves by a
further 3 to 30 days. What the trace already hides stays hidden;
unknown segments stay as they are, starred or kept. comment,
client, accounts, and each exchange’s account, error and
notes stay.
Sourcepub fn set_outcome(&mut self, result: Result<(), &FinTSError>)
pub fn set_outcome(&mut self, result: Result<(), &FinTSError>)
Records how the run ended: completed, or the kind of the error
that stopped it (the variant, for a bank error its code), never its
text.
Sourcepub fn to_json(&self) -> String
pub fn to_json(&self) -> String
The trace as one pretty-printed JSON document:
format(TRACE_FORMAT),comment(lines),bank(blz,bic:Trace::blz,Trace::bic),accounts(TraceAccounts);exchanges, each withindex,account(alias or null),retry_of,sent(jobsasCODE:version,tanas{process, for}or null),answer(message: HIRMG codes,segments: HIRMS codes with thejobthey refer to),failed,error,requestandresponse.
request and response hold the message, one string per segment
(the HNVSD header up to its @len@ and each segment inside HNVSD get
their own; the closing ' of HNVSD is a string of its own), each byte as the ISO 8859-1 character
of the same value: joined, they are the bytes again. They are the
only source of truth; index, retry_of, sent, answer, failed
and bank are derived from them for readers (see Trace::summary),
and Trace::from_json rejects a file in which they differ.
Sourcepub fn from_json(json: &str) -> Result<Trace, String>
pub fn from_json(json: &str) -> Result<Trace, String>
Reads a trace written by Trace::to_json. Fails on another
format, unknown fields, a character outside ISO 8859-1, an
exchange naming an alias that accounts does not list, a failed
exchange with a response, and any derived field that differs from
what the raw request/response give (the error names the exchange
and the field).
Sourcepub fn blz(&self) -> Option<String>
pub fn blz(&self) -> Option<String>
The bank code the client logged in at (HKIDN of the first request that has one).
Sourcepub fn bic(&self) -> Option<String>
pub fn bic(&self) -> Option<String>
The bank’s BIC: the BIC of the first account element (KTI,
IBAN:BIC) a job of a request names.
Sourcepub fn account(&self, alias: &str) -> Option<&TraceAccount>
pub fn account(&self, alias: &str) -> Option<&TraceAccount>
The account with this alias.
Sourcepub fn summary(&self) -> Vec<ExchangeSummary>
pub fn summary(&self) -> Vec<ExchangeSummary>
One ExchangeSummary per exchange. Never fails: a message that
does not tokenize is reported as unreadable.
An exchange is a retry of the one before it (retry_of) when that
one was answered with 9075 (strong customer authentication required)
and it sends the same jobs again, now with HKTAN.
Sourcepub fn summary_table(&self) -> String
pub fn summary_table(&self) -> String
The summary as a table for humans: SUMMARY_LEGEND, the accounts
(one line each), then one line per exchange.