mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
feat(core): add support for consuming eci for AuthNResponse in Authentication flow (#8225)
Co-authored-by: Debarati Ghatak <debarati.ghatak@Debarati-Ghatak-FW569NC29L.local>
This commit is contained in:
@ -139,6 +139,7 @@ pub enum AuthenticationUpdate {
|
|||||||
connector_metadata: Option<serde_json::Value>,
|
connector_metadata: Option<serde_json::Value>,
|
||||||
authentication_status: common_enums::AuthenticationStatus,
|
authentication_status: common_enums::AuthenticationStatus,
|
||||||
ds_trans_id: Option<String>,
|
ds_trans_id: Option<String>,
|
||||||
|
eci: Option<String>,
|
||||||
},
|
},
|
||||||
PostAuthenticationUpdate {
|
PostAuthenticationUpdate {
|
||||||
trans_status: common_enums::TransactionStatus,
|
trans_status: common_enums::TransactionStatus,
|
||||||
@ -373,6 +374,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
|
|||||||
connector_metadata,
|
connector_metadata,
|
||||||
authentication_status,
|
authentication_status,
|
||||||
ds_trans_id,
|
ds_trans_id,
|
||||||
|
eci,
|
||||||
} => Self {
|
} => Self {
|
||||||
trans_status: Some(trans_status),
|
trans_status: Some(trans_status),
|
||||||
authentication_type: Some(authentication_type),
|
authentication_type: Some(authentication_type),
|
||||||
@ -384,6 +386,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
|
|||||||
connector_metadata,
|
connector_metadata,
|
||||||
authentication_status: Some(authentication_status),
|
authentication_status: Some(authentication_status),
|
||||||
ds_trans_id,
|
ds_trans_id,
|
||||||
|
eci,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
AuthenticationUpdate::PostAuthenticationUpdate {
|
AuthenticationUpdate::PostAuthenticationUpdate {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use common_enums::{
|
|||||||
self, AttemptStatus, AuthorizationStatus, CaptureMethod, Currency, FutureUsage,
|
self, AttemptStatus, AuthorizationStatus, CaptureMethod, Currency, FutureUsage,
|
||||||
PaymentMethodStatus, RefundStatus,
|
PaymentMethodStatus, RefundStatus,
|
||||||
};
|
};
|
||||||
use common_utils::{ext_traits::Encode, pii, types::MinorUnit};
|
use common_utils::{date_time, ext_traits::Encode, pii, types::MinorUnit};
|
||||||
use error_stack::ResultExt;
|
use error_stack::ResultExt;
|
||||||
use hyperswitch_domain_models::{
|
use hyperswitch_domain_models::{
|
||||||
address::AddressDetails,
|
address::AddressDetails,
|
||||||
@ -163,23 +163,24 @@ pub struct Archipel3DS {
|
|||||||
three_ds_version: Option<common_utils::types::SemanticVersion>,
|
three_ds_version: Option<common_utils::types::SemanticVersion>,
|
||||||
authentication_value: Secret<String>,
|
authentication_value: Secret<String>,
|
||||||
authentication_method: Option<Secret<String>>,
|
authentication_method: Option<Secret<String>>,
|
||||||
eci: Option<Secret<String>>,
|
eci: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<AuthenticationData> for Archipel3DS {
|
impl From<AuthenticationData> for Archipel3DS {
|
||||||
fn from(three_ds_data: AuthenticationData) -> Self {
|
fn from(three_ds_data: AuthenticationData) -> Self {
|
||||||
|
let now = date_time::date_as_yyyymmddthhmmssmmmz().ok();
|
||||||
Self {
|
Self {
|
||||||
acs_trans_id: None,
|
acs_trans_id: None,
|
||||||
ds_trans_id: three_ds_data.ds_trans_id.map(Secret::new),
|
ds_trans_id: three_ds_data.ds_trans_id.map(Secret::new),
|
||||||
three_ds_requestor_name: None,
|
three_ds_requestor_name: None,
|
||||||
three_ds_auth_date: None,
|
three_ds_auth_date: now,
|
||||||
three_ds_auth_amt: None,
|
three_ds_auth_amt: None,
|
||||||
three_ds_auth_status: None,
|
three_ds_auth_status: None,
|
||||||
three_ds_max_supported_version: THREE_DS_MAX_SUPPORTED_VERSION.into(),
|
three_ds_max_supported_version: THREE_DS_MAX_SUPPORTED_VERSION.into(),
|
||||||
three_ds_version: three_ds_data.message_version,
|
three_ds_version: three_ds_data.message_version,
|
||||||
authentication_value: three_ds_data.cavv,
|
authentication_value: three_ds_data.cavv,
|
||||||
authentication_method: None,
|
authentication_method: None,
|
||||||
eci: three_ds_data.eci.map(Secret::new),
|
eci: three_ds_data.eci,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -294,6 +294,7 @@ impl
|
|||||||
authentication_value: response_auth.authentication_value,
|
authentication_value: response_auth.authentication_value,
|
||||||
ds_trans_id: Some(response_auth.ds_trans_id),
|
ds_trans_id: Some(response_auth.ds_trans_id),
|
||||||
connector_metadata: None,
|
connector_metadata: None,
|
||||||
|
eci: None,
|
||||||
});
|
});
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
response,
|
response,
|
||||||
|
|||||||
@ -163,6 +163,7 @@ impl
|
|||||||
trans_status: response.trans_status,
|
trans_status: response.trans_status,
|
||||||
connector_metadata: None,
|
connector_metadata: None,
|
||||||
ds_trans_id: response.authentication_response.ds_trans_id,
|
ds_trans_id: response.authentication_response.ds_trans_id,
|
||||||
|
eci: response.eci,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
NetceteraAuthenticationResponse::Error(error_response) => Err(ErrorResponse {
|
NetceteraAuthenticationResponse::Error(error_response) => Err(ErrorResponse {
|
||||||
|
|||||||
@ -183,6 +183,7 @@ impl
|
|||||||
authentication_value: response.authentication_value,
|
authentication_value: response.authentication_value,
|
||||||
connector_metadata: None,
|
connector_metadata: None,
|
||||||
ds_trans_id: Some(response.ds_trans_id),
|
ds_trans_id: Some(response.ds_trans_id),
|
||||||
|
eci: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ThreedsecureioAuthenticationResponse::Error(err_response) => match *err_response {
|
ThreedsecureioAuthenticationResponse::Error(err_response) => match *err_response {
|
||||||
|
|||||||
@ -110,6 +110,7 @@ pub struct AuthenticationDetails {
|
|||||||
pub trans_status: common_enums::TransactionStatus,
|
pub trans_status: common_enums::TransactionStatus,
|
||||||
pub connector_metadata: Option<serde_json::Value>,
|
pub connector_metadata: Option<serde_json::Value>,
|
||||||
pub ds_trans_id: Option<String>,
|
pub ds_trans_id: Option<String>,
|
||||||
|
pub eci: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
||||||
|
|||||||
@ -542,6 +542,7 @@ pub enum AuthenticationResponseData {
|
|||||||
trans_status: common_enums::TransactionStatus,
|
trans_status: common_enums::TransactionStatus,
|
||||||
connector_metadata: Option<serde_json::Value>,
|
connector_metadata: Option<serde_json::Value>,
|
||||||
ds_trans_id: Option<String>,
|
ds_trans_id: Option<String>,
|
||||||
|
eci: Option<String>,
|
||||||
},
|
},
|
||||||
PostAuthNResponse {
|
PostAuthNResponse {
|
||||||
trans_status: common_enums::TransactionStatus,
|
trans_status: common_enums::TransactionStatus,
|
||||||
|
|||||||
@ -95,6 +95,7 @@ pub async fn update_trackers<F: Clone, Req>(
|
|||||||
trans_status,
|
trans_status,
|
||||||
connector_metadata,
|
connector_metadata,
|
||||||
ds_trans_id,
|
ds_trans_id,
|
||||||
|
eci,
|
||||||
} => {
|
} => {
|
||||||
authentication_value
|
authentication_value
|
||||||
.async_map(|auth_val| {
|
.async_map(|auth_val| {
|
||||||
@ -123,6 +124,7 @@ pub async fn update_trackers<F: Clone, Req>(
|
|||||||
authentication_status,
|
authentication_status,
|
||||||
connector_metadata,
|
connector_metadata,
|
||||||
ds_trans_id,
|
ds_trans_id,
|
||||||
|
eci,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AuthenticationResponseData::PostAuthNResponse {
|
AuthenticationResponseData::PostAuthNResponse {
|
||||||
|
|||||||
@ -217,6 +217,7 @@ pub async fn external_authentication_update_trackers<F: Clone, Req>(
|
|||||||
authentication_status,
|
authentication_status,
|
||||||
connector_metadata: authentication_details.connector_metadata,
|
connector_metadata: authentication_details.connector_metadata,
|
||||||
ds_trans_id: authentication_details.ds_trans_id,
|
ds_trans_id: authentication_details.ds_trans_id,
|
||||||
|
eci: authentication_details.eci,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user