feat(router): send message_version and directory_server_id in next_action block of three_ds_data for external 3ds flow (#4715)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sai Harsha Vardhan
2024-05-23 12:42:14 +05:30
committed by GitHub
parent da2dc10f3d
commit 13f6efc7e8
12 changed files with 40 additions and 0 deletions

View File

@ -2963,6 +2963,10 @@ pub struct ThreeDsData {
pub three_ds_method_details: ThreeDsMethodData, pub three_ds_method_details: ThreeDsMethodData,
/// Poll config for a connector /// Poll config for a connector
pub poll_config: PollConfigResponse, pub poll_config: PollConfigResponse,
/// Message Version
pub message_version: Option<String>,
/// Directory Server ID
pub directory_server_id: Option<String>,
} }
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)] #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)]

View File

@ -42,6 +42,7 @@ pub struct Authentication {
pub profile_id: String, pub profile_id: String,
pub payment_id: Option<String>, pub payment_id: Option<String>,
pub merchant_connector_id: String, pub merchant_connector_id: String,
pub directory_server_id: Option<String>,
} }
impl Authentication { impl Authentication {
@ -86,6 +87,7 @@ pub struct AuthenticationNew {
pub profile_id: String, pub profile_id: String,
pub payment_id: Option<String>, pub payment_id: Option<String>,
pub merchant_connector_id: String, pub merchant_connector_id: String,
pub directory_server_id: Option<String>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -101,6 +103,7 @@ pub enum AuthenticationUpdate {
authentication_status: common_enums::AuthenticationStatus, authentication_status: common_enums::AuthenticationStatus,
acquirer_bin: Option<String>, acquirer_bin: Option<String>,
acquirer_merchant_id: Option<String>, acquirer_merchant_id: Option<String>,
directory_server_id: Option<String>,
}, },
AuthenticationUpdate { AuthenticationUpdate {
authentication_value: Option<String>, authentication_value: Option<String>,
@ -159,6 +162,7 @@ pub struct AuthenticationUpdateInternal {
pub acs_reference_number: Option<String>, pub acs_reference_number: Option<String>,
pub acs_trans_id: Option<String>, pub acs_trans_id: Option<String>,
pub acs_signed_content: Option<String>, pub acs_signed_content: Option<String>,
pub directory_server_id: Option<String>,
} }
impl Default for AuthenticationUpdateInternal { impl Default for AuthenticationUpdateInternal {
@ -189,6 +193,7 @@ impl Default for AuthenticationUpdateInternal {
acs_reference_number: Default::default(), acs_reference_number: Default::default(),
acs_trans_id: Default::default(), acs_trans_id: Default::default(),
acs_signed_content: Default::default(), acs_signed_content: Default::default(),
directory_server_id: Default::default(),
} }
} }
} }
@ -221,6 +226,7 @@ impl AuthenticationUpdateInternal {
acs_reference_number, acs_reference_number,
acs_trans_id, acs_trans_id,
acs_signed_content, acs_signed_content,
directory_server_id,
} = self; } = self;
Authentication { Authentication {
connector_authentication_id: connector_authentication_id connector_authentication_id: connector_authentication_id
@ -252,6 +258,7 @@ impl AuthenticationUpdateInternal {
acs_reference_number: acs_reference_number.or(source.acs_reference_number), acs_reference_number: acs_reference_number.or(source.acs_reference_number),
acs_trans_id: acs_trans_id.or(source.acs_trans_id), acs_trans_id: acs_trans_id.or(source.acs_trans_id),
acs_signed_content: acs_signed_content.or(source.acs_signed_content), acs_signed_content: acs_signed_content.or(source.acs_signed_content),
directory_server_id: directory_server_id.or(source.directory_server_id),
..source ..source
} }
} }
@ -304,6 +311,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
authentication_status, authentication_status,
acquirer_bin, acquirer_bin,
acquirer_merchant_id, acquirer_merchant_id,
directory_server_id,
} => Self { } => Self {
threeds_server_transaction_id: Some(threeds_server_transaction_id), threeds_server_transaction_id: Some(threeds_server_transaction_id),
maximum_supported_version: Some(maximum_supported_3ds_version), maximum_supported_version: Some(maximum_supported_3ds_version),
@ -315,6 +323,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
authentication_status: Some(authentication_status), authentication_status: Some(authentication_status),
acquirer_bin, acquirer_bin,
acquirer_merchant_id, acquirer_merchant_id,
directory_server_id,
..Default::default() ..Default::default()
}, },
AuthenticationUpdate::AuthenticationUpdate { AuthenticationUpdate::AuthenticationUpdate {

View File

@ -115,6 +115,8 @@ diesel::table! {
payment_id -> Nullable<Varchar>, payment_id -> Nullable<Varchar>,
#[max_length = 128] #[max_length = 128]
merchant_connector_id -> Varchar, merchant_connector_id -> Varchar,
#[max_length = 128]
directory_server_id -> Nullable<Varchar>,
} }
} }

View File

@ -96,6 +96,9 @@ impl
three_ds_method_url, three_ds_method_url,
message_version: maximum_supported_3ds_version, message_version: maximum_supported_3ds_version,
connector_metadata: None, connector_metadata: None,
directory_server_id: card_range
.as_ref()
.and_then(|card_range| card_range.directory_server_id.clone()),
}, },
) )
} }

View File

@ -108,6 +108,7 @@ impl
) )
.change_context(errors::ConnectorError::ParsingFailed)?, .change_context(errors::ConnectorError::ParsingFailed)?,
connector_metadata: Some(connector_metadata), connector_metadata: Some(connector_metadata),
directory_server_id: None,
}, },
) )
} }

View File

@ -63,6 +63,7 @@ pub async fn update_trackers<F: Clone, Req>(
three_ds_method_url, three_ds_method_url,
message_version, message_version,
connector_metadata, connector_metadata,
directory_server_id,
} => storage::AuthenticationUpdate::PreAuthenticationUpdate { } => storage::AuthenticationUpdate::PreAuthenticationUpdate {
threeds_server_transaction_id, threeds_server_transaction_id,
maximum_supported_3ds_version, maximum_supported_3ds_version,
@ -77,6 +78,7 @@ pub async fn update_trackers<F: Clone, Req>(
.map(|acquirer_details| acquirer_details.acquirer_bin.clone()), .map(|acquirer_details| acquirer_details.acquirer_bin.clone()),
acquirer_merchant_id: acquirer_details acquirer_merchant_id: acquirer_details
.map(|acquirer_details| acquirer_details.acquirer_merchant_id), .map(|acquirer_details| acquirer_details.acquirer_merchant_id),
directory_server_id,
}, },
AuthenticationResponseData::AuthNResponse { AuthenticationResponseData::AuthNResponse {
authn_flow_type, authn_flow_type,
@ -181,6 +183,7 @@ pub async fn create_new_authentication(
profile_id, profile_id,
payment_id, payment_id,
merchant_connector_id, merchant_connector_id,
directory_server_id: None,
}; };
state state
.store .store

View File

@ -603,6 +603,9 @@ where
three_ds_method_url: None, three_ds_method_url: None,
}), }),
poll_config: api_models::payments::PollConfigResponse {poll_id: request_poll_id, delay_in_secs: poll_config.delay_in_secs, frequency: poll_config.frequency}, poll_config: api_models::payments::PollConfigResponse {poll_id: request_poll_id, delay_in_secs: poll_config.delay_in_secs, frequency: poll_config.frequency},
message_version: authentication.message_version.as_ref()
.map(|version| version.to_string()),
directory_server_id: authentication.directory_server_id.clone(),
}, },
}) })
}else{ }else{

View File

@ -147,6 +147,7 @@ impl AuthenticationInterface for MockDb {
profile_id: authentication.profile_id, profile_id: authentication.profile_id,
payment_id: authentication.payment_id, payment_id: authentication.payment_id,
merchant_connector_id: authentication.merchant_connector_id, merchant_connector_id: authentication.merchant_connector_id,
directory_server_id: authentication.directory_server_id,
}; };
authentications.push(authentication.clone()); authentications.push(authentication.clone());
Ok(authentication) Ok(authentication)

View File

@ -18,6 +18,7 @@ pub enum AuthenticationResponseData {
three_ds_method_url: Option<String>, three_ds_method_url: Option<String>,
message_version: common_utils::types::SemanticVersion, message_version: common_utils::types::SemanticVersion,
connector_metadata: Option<serde_json::Value>, connector_metadata: Option<serde_json::Value>,
directory_server_id: Option<String>,
}, },
AuthNResponse { AuthNResponse {
authn_flow_type: AuthNFlowType, authn_flow_type: AuthNFlowType,

View File

@ -0,0 +1 @@
ALTER TABLE authentication DROP COLUMN IF EXISTS directory_server_id;

View File

@ -0,0 +1,2 @@
-- Your SQL goes here
ALTER TABLE authentication ADD COLUMN IF NOT EXISTS directory_server_id VARCHAR(128);

View File

@ -18340,6 +18340,16 @@
}, },
"poll_config": { "poll_config": {
"$ref": "#/components/schemas/PollConfigResponse" "$ref": "#/components/schemas/PollConfigResponse"
},
"message_version": {
"type": "string",
"description": "Message Version",
"nullable": true
},
"directory_server_id": {
"type": "string",
"description": "Directory Server ID",
"nullable": true
} }
} }
}, },