Skip to main content

TransactionState

Enum TransactionState 

Source
pub enum TransactionState {
    Created {
        areq: Box<AuthenticationRequest>,
    },
    AwaitingARes {
        three_ds_server_trans_id: String,
    },
    AwaitingCRes {
        three_ds_server_trans_id: String,
        acs_trans_id: String,
        acs_url: Option<String>,
    },
    AwaitingRReq {
        three_ds_server_trans_id: String,
        acs_trans_id: String,
    },
    Authenticated {
        three_ds_server_trans_id: String,
        acs_trans_id: String,
        ds_trans_id: Option<String>,
        eci: Option<Eci>,
        authentication_value: Option<String>,
    },
    NotAuthenticated {
        three_ds_server_trans_id: String,
        trans_status: TransStatus,
        reason_code: Option<String>,
    },
    Failed {
        error: String,
    },
}
Expand description

The lifecycle of a single 3DS transaction as seen by the 3DS Server.

Transitions are driven by sending an AReq and receiving subsequent messages. Terminal states are Authenticated, NotAuthenticated, and Failed.

 Created
   │  send_areq()
   ▼
 AwaitingARes
   │  receive_ares()
   ├─(Y/A)──────────────────────► Authenticated
   ├─(N/U/R)────────────────────► NotAuthenticated
   ├─(C)
   │    │
   │    ▼
   │  AwaitingCRes
   │    │  receive_cres()
   │    ├─(Y/A)────────────────► Authenticated
   │    └─(N/U)────────────────► NotAuthenticated
   └─(D)
        │
        ▼
      AwaitingRReq
        │  receive_rreq()
        ├─(Y/A)──────────────────► Authenticated
        └─(N/U/R)────────────────► NotAuthenticated

 Any state + receive_error() ──► Failed

Variants§

§

Created

AReq has been constructed and is ready to send.

§

AwaitingARes

AReq sent; waiting for the ARes from the DS.

Fields

§three_ds_server_trans_id: String
§

AwaitingCRes

ARes received with transStatus=C; challenge must be presented.

Fields

§three_ds_server_trans_id: String
§acs_trans_id: String
§acs_url: Option<String>

ACS URL to redirect/embed (browser channel), or None for app/decoupled.

§

AwaitingRReq

ARes received with transStatus=D; waiting for the ACS to send an RReq after completing decoupled out-of-band authentication.

Fields

§three_ds_server_trans_id: String
§acs_trans_id: String
§

Authenticated

Authentication completed successfully (frictionless Y/A or challenge Y).

Fields

§three_ds_server_trans_id: String
§acs_trans_id: String
§ds_trans_id: Option<String>
§authentication_value: Option<String>

CAVV / AAV value to include in the authorization request.

§

NotAuthenticated

Authentication was rejected or failed (N, U, R, or challenge N).

Fields

§three_ds_server_trans_id: String
§trans_status: TransStatus
§reason_code: Option<String>
§

Failed

A protocol error was received; the transaction cannot continue.

Fields

§error: String

Implementations§

Source§

impl TransactionState

Source

pub fn new(areq: AuthenticationRequest) -> Self

Create a new transaction from a constructed AReq.

Source

pub fn areq_sent(self) -> Result<(Self, AuthenticationRequest)>

Mark the AReq as sent and transition to awaiting the ARes.

Source

pub fn receive_ares(self, ares: AuthenticationResponse) -> Result<Self>

Process an incoming ARes and advance the state.

Source

pub fn build_creq( &self, window_size: Option<ChallengeWindowSize>, ) -> Result<ChallengeRequest>

Build the CReq that should be submitted to the ACS challenge URL.

Source

pub fn receive_cres(self, cres: ChallengeResponse) -> Result<Self>

Process an incoming CRes and advance to a terminal state.

Source

pub fn receive_rreq(self, rreq: ResultsRequest) -> Result<Self>

Process an incoming RReq and advance to a terminal state. The caller must send ResultsResponse::acknowledge(&rreq) to the ACS.

Source

pub fn receive_error(self, err: &ErrorMessage) -> Self

Handle a protocol error; always transitions to Failed.

Source

pub fn is_terminal(&self) -> bool

Returns true if the transaction reached a terminal state.

Trait Implementations§

Source§

impl Clone for TransactionState

Source§

fn clone(&self) -> TransactionState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransactionState

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.