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() ──► FailedVariants§
Created
AReq has been constructed and is ready to send.
Fields
areq: Box<AuthenticationRequest>AwaitingARes
AReq sent; waiting for the ARes from the DS.
AwaitingCRes
ARes received with transStatus=C; challenge must be presented.
Fields
AwaitingRReq
ARes received with transStatus=D; waiting for the ACS to send an RReq after completing decoupled out-of-band authentication.
Authenticated
Authentication completed successfully (frictionless Y/A or challenge Y).
Fields
NotAuthenticated
Authentication was rejected or failed (N, U, R, or challenge N).
Failed
A protocol error was received; the transaction cannot continue.
Implementations§
Source§impl TransactionState
impl TransactionState
Sourcepub fn new(areq: AuthenticationRequest) -> Self
pub fn new(areq: AuthenticationRequest) -> Self
Create a new transaction from a constructed AReq.
Sourcepub fn areq_sent(self) -> Result<(Self, AuthenticationRequest)>
pub fn areq_sent(self) -> Result<(Self, AuthenticationRequest)>
Mark the AReq as sent and transition to awaiting the ARes.
Sourcepub fn receive_ares(self, ares: AuthenticationResponse) -> Result<Self>
pub fn receive_ares(self, ares: AuthenticationResponse) -> Result<Self>
Process an incoming ARes and advance the state.
Sourcepub fn build_creq(
&self,
window_size: Option<ChallengeWindowSize>,
) -> Result<ChallengeRequest>
pub fn build_creq( &self, window_size: Option<ChallengeWindowSize>, ) -> Result<ChallengeRequest>
Build the CReq that should be submitted to the ACS challenge URL.
Sourcepub fn receive_cres(self, cres: ChallengeResponse) -> Result<Self>
pub fn receive_cres(self, cres: ChallengeResponse) -> Result<Self>
Process an incoming CRes and advance to a terminal state.
Sourcepub fn receive_rreq(self, rreq: ResultsRequest) -> Result<Self>
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.
Sourcepub fn receive_error(self, err: &ErrorMessage) -> Self
pub fn receive_error(self, err: &ErrorMessage) -> Self
Handle a protocol error; always transitions to Failed.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Returns true if the transaction reached a terminal state.
Trait Implementations§
Source§impl Clone for TransactionState
impl Clone for TransactionState
Source§fn clone(&self) -> TransactionState
fn clone(&self) -> TransactionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more