Skip to content

Commit

Permalink
fix(core): make eci in AuthenticationData optional (juspay#4187)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrithikesh026 committed Mar 26, 2024
1 parent 0270806 commit 4f0c788
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/router/src/connector/checkout/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
enums::AuthenticationType::ThreeDs => CheckoutThreeDS {
enabled: true,
force_3ds: true,
eci: authentication_data.map(|auth| auth.eci.clone()),
eci: authentication_data.and_then(|auth| auth.eci.clone()),
cryptogram: authentication_data.map(|auth| auth.cavv.clone()),
xid: authentication_data.map(|auth| auth.threeds_server_transaction_id.clone()),
version: authentication_data.map(|auth| auth.message_version.clone()),
Expand Down
10 changes: 2 additions & 8 deletions crates/router/src/core/payments/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl SurchargeMetadata {

#[derive(Debug, Clone)]
pub struct AuthenticationData {
pub eci: String,
pub eci: Option<String>,
pub cavv: String,
pub threeds_server_transaction_id: String,
pub message_version: String,
Expand Down Expand Up @@ -409,14 +409,8 @@ impl ForeignTryFrom<&storage::Authentication> for AuthenticationData {
.get_required_value("cavv")
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("cavv must not be null when authentication_status is success")?;
let eci = authentication
.eci
.clone()
.get_required_value("eci")
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("eci must not be null when authentication_status is success")?;
Ok(Self {
eci,
eci: authentication.eci.clone(),
cavv,
threeds_server_transaction_id,
message_version: message_version.to_string(),
Expand Down

0 comments on commit 4f0c788

Please sign in to comment.