pub struct Dialog { /* private fields */ }Expand description
An open dialog with the bank. Holds the paused job, if any; the caller
owns it and passes it to every job. End it with Dialog::end to get
the updated SessionState.
Not cancel-safe. The futures of open, of every job and of
Dialog::submit_tan, Dialog::poll and Dialog::confirm_vop
must run to completion: dropping one mid-request (select!, a
timeout around the call) loses what was sent. The dialog then ends;
when the request carried a transfer’s order or TAN, the next call
returns FinTSError::PaymentOutcomeUnknown with the payment’s IDs
once, and FinTSError::DialogEnded after that. Cancel between calls
(in the wait until not_before) with Dialog::cancel; timeouts
belong in the transport.
Implementations§
Source§impl Dialog
impl Dialog
Sourcepub fn freeze(self) -> Result<PausedDialog>
pub fn freeze(self) -> Result<PausedDialog>
Freeze the dialog into plain data to store, for an open dialog
between two jobs and for one paused on a TAN. Sends nothing;
consumes the dialog, so no live copy can send the same message
number. An ended dialog fails with FinTSError::DialogEnded; one
whose transfer request was dropped mid-flight with
FinTSError::PaymentOutcomeUnknown.
Sourcepub fn thaw(
paused: PausedDialog,
client: &BankClient,
creds: &Credentials,
) -> Result<Dialog>
pub fn thaw( paused: PausedDialog, client: &BankClient, creds: &Credentials, ) -> Result<Dialog>
Continue a frozen dialog through client with the PIN of creds.
Fails with FinTSError::PausedDialogMismatch when the client’s
BLZ or URL, or the user ID, differ from the frozen dialog’s; sends
nothing. The thawed dialog is paused on the same job (resume it with
the ticket of PausedDialog::pending) or open. It never refuses
on time: a dialog the bank has dropped answers with
FinTSError::DialogEnded.
Source§impl Dialog
impl Dialog
Sourcepub async fn confirm_vop<T: JobValue>(
&mut self,
resume: Resume<T>,
) -> Result<Step<T>>
pub async fn confirm_vop<T: JobValue>( &mut self, resume: Resume<T>, ) -> Result<Step<T>>
Confirm the payee check result of the paused transfer: sends the
execution order (HKVPA + order + HKTAN:4) and returns its step,
usually NeedTan. When every payee matched (the user was asked
because of 3090 or an explanation text) and the bank’s TAN of
message 1 is still live, returns NeedTan for that challenge
without sending. A payee that did not match always goes through the
execution order (VoP E.8.1 point 4), even when message 1 had a
challenge. On a job that waits for something else:
FinTSError::Dialog, and the job stays paused.
Not cancel-safe (see Dialog).
Source§impl Dialog
impl Dialog
Sourcepub fn pending(&self) -> Option<&PendingJob>
pub fn pending(&self) -> Option<&PendingJob>
The paused job, if any.
Sourcepub fn last_message_at(&self) -> Timestamp
pub fn last_message_at(&self) -> Timestamp
Wall clock of the bank’s last response.
Sourcepub fn capabilities(&self, accounts: &[Account]) -> Capabilities
pub fn capabilities(&self, accounts: &[Account]) -> Capabilities
What the bank offers per account (accounts, or the UPD’s accounts
when empty), from this dialog’s BPD and UPD, the learned TAN codes
and the client’s TAN overrides. Sends nothing.
Sourcepub async fn submit_tan<T: JobValue>(
&mut self,
resume: Resume<T>,
tan: &str,
) -> Result<Step<T>>
pub async fn submit_tan<T: JobValue>( &mut self, resume: Resume<T>, tan: &str, ) -> Result<Step<T>>
Send the TAN for the paused job (HKTAN process 2, PIN/TAN B.4.2), for the login and for any order. The bank’s confirmation carries the order’s data; if it does not, a read order is sent once more (a transfer never). A transfer whose payee check the bank wants released sends HKVPA with its first TAN message.
A wrong TAN the bank rejects with 9941 alone (the order kept, the
dialog open) gives NeedTan again for the same order, with
TanChallenge::rejected set: show the bank’s text and ask again,
or Dialog::cancel. Nothing is resent unless the caller submits
another TAN. Any other rejection fails the job (the order deleted,
the access locked, the dialog ended): an order’s dialog stays open
unless the bank ended it, a login’s dialog ends. On a transfer
every error but a class 9 rejection is
FinTSError::PaymentOutcomeUnknown.
Not cancel-safe (see Dialog).
Sourcepub async fn poll<T: JobValue>(&mut self, resume: Resume<T>) -> Result<Step<T>>
pub async fn poll<T: JobValue>(&mut self, resume: Resume<T>) -> Result<Step<T>>
One decoupled status request for the paused job (HKTAN process S;
process 2 before HKTAN 7). Still pending (3956): NeedTan again
with polls_done + 1 and a new not_before. Once the bank’s
max_polls are used up, FinTSError::DecoupledMaxPolls without
sending, and the job is dropped; on a transfer that error is
FinTSError::PaymentOutcomeUnknown (the bank may still execute
it), as is every error of a transfer’s status request but a class 9
rejection. The library does not wait; sleep first_wait /
next_wait before calling (or until not_before). When the
challenge’s auto_polling_allowed is Some(false) the caller must
not poll automatically: the bank expects the user to trigger each
status request. poll itself does not check it.
On a transfer’s unfinished payee check (Step::VopPending) it
sends the next HKVPP instead; HKVPA goes with a transfer’s first
decoupled status request when the bank wants the check released.
Not cancel-safe (see Dialog).
Sourcepub fn cancel<T: JobValue>(&mut self, resume: Resume<T>) -> Result<Cancelled>
pub fn cancel<T: JobValue>(&mut self, resume: Resume<T>) -> Result<Cancelled>
Drop the paused job without sending anything. After an order the
dialog is open for other jobs; after the login it has ended
(Dialog::end still sends HKEND).
The result says what is left at the bank. A read, the login and a
transfer at its payee check are Cancelled::NothingSent: the bank
lets the task expire (and a transfer’s VOP-ID: a corrected payee
name is a new transfer). A transfer waiting for its TAN is
Cancelled::OrderSubmitted: its order is at the bank, and a late
approval in the app may still execute it.
Sourcepub async fn end(self) -> Result<SessionState>
pub async fn end(self) -> Result<SessionState>
End the dialog (HKEND, unless the bank already ended it) and return
the updated session state: system ID, BPD/UPD, TAN method, codes
learned from 9075. A paused dialog ends the same way. When a
transfer’s request was dropped mid-flight, it fails with
FinTSError::PaymentOutcomeUnknown instead and sends nothing.
Sourcepub fn session_state(&self) -> SessionState
pub fn session_state(&self) -> SessionState
A snapshot of the session state as it is now: system ID, BPD/UPD, TAN method, codes learned from 9075. It sends nothing and changes nothing, so the dialog stays usable.
The host stores it after open and after each job. A crash then
keeps a freshly assigned system ID and the updated BPD/UPD, which
Dialog::end would only hand over at the end. The snapshot is the
state Dialog::end returns, minus whatever the dialog changes
later.
It also works while a transfer’s request is in flight (a dropped
future): it takes &self and sends nothing, and the pending
FinTSError::PaymentOutcomeUnknown stays for the next call that
sends, Dialog::end or Dialog::freeze.