refactor: [Netcetera] Handle response deserialization error (#8988)

This commit is contained in:
Swangi Kumari
2025-08-19 16:30:59 +05:30
committed by GitHub
parent 72eb25f074
commit 08166991f8

View File

@ -163,7 +163,10 @@ impl
.authentication_request .authentication_request
.as_ref() .as_ref()
.and_then(|req| req.three_ds_requestor_challenge_ind.as_ref()) .and_then(|req| req.three_ds_requestor_challenge_ind.as_ref())
.and_then(|v| v.first().cloned()); .and_then(|ind| match ind {
ThreedsRequestorChallengeInd::Single(s) => Some(s.clone()),
ThreedsRequestorChallengeInd::Multiple(v) => v.first().cloned(),
});
let message_extension = response let message_extension = response
.authentication_request .authentication_request
@ -680,10 +683,17 @@ pub struct NetceteraAuthenticationFailureResponse {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AuthenticationRequest { pub struct AuthenticationRequest {
#[serde(rename = "threeDSRequestorChallengeInd")] #[serde(rename = "threeDSRequestorChallengeInd")]
pub three_ds_requestor_challenge_ind: Option<Vec<String>>, pub three_ds_requestor_challenge_ind: Option<ThreedsRequestorChallengeInd>,
pub message_extension: Option<serde_json::Value>, pub message_extension: Option<serde_json::Value>,
} }
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ThreedsRequestorChallengeInd {
Single(String),
Multiple(Vec<String>),
}
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AuthenticationResponse { pub struct AuthenticationResponse {