Skip to main content

Dialog

Struct Dialog 

Source
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

Source

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.

Source

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

Source

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

Source

pub fn phase(&self) -> &Phase

Where the dialog is.

Source

pub fn pending(&self) -> Option<&PendingJob>

The paused job, if any.

Source

pub fn last_message_at(&self) -> Timestamp

Wall clock of the bank’s last response.

Source

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.

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for Dialog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Dialog

§

impl !UnwindSafe for Dialog

§

impl Forget for Dialog

§

impl Freeze for Dialog

§

impl Move for Dialog

§

impl Send for Dialog

§

impl Sync for Dialog

§

impl Unpin for Dialog

§

impl UnsafeUnpin for Dialog

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more