diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 80be635da6..60952ee501 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -2963,6 +2963,10 @@ pub struct ThreeDsData { pub three_ds_method_details: ThreeDsMethodData, /// Poll config for a connector pub poll_config: PollConfigResponse, + /// Message Version + pub message_version: Option, + /// Directory Server ID + pub directory_server_id: Option, } #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)] diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rs index ce2f02d087..9b7c4c96ee 100644 --- a/crates/diesel_models/src/authentication.rs +++ b/crates/diesel_models/src/authentication.rs @@ -42,6 +42,7 @@ pub struct Authentication { pub profile_id: String, pub payment_id: Option, pub merchant_connector_id: String, + pub directory_server_id: Option, } impl Authentication { @@ -86,6 +87,7 @@ pub struct AuthenticationNew { pub profile_id: String, pub payment_id: Option, pub merchant_connector_id: String, + pub directory_server_id: Option, } #[derive(Debug)] @@ -101,6 +103,7 @@ pub enum AuthenticationUpdate { authentication_status: common_enums::AuthenticationStatus, acquirer_bin: Option, acquirer_merchant_id: Option, + directory_server_id: Option, }, AuthenticationUpdate { authentication_value: Option, @@ -159,6 +162,7 @@ pub struct AuthenticationUpdateInternal { pub acs_reference_number: Option, pub acs_trans_id: Option, pub acs_signed_content: Option, + pub directory_server_id: Option, } impl Default for AuthenticationUpdateInternal { @@ -189,6 +193,7 @@ impl Default for AuthenticationUpdateInternal { acs_reference_number: Default::default(), acs_trans_id: Default::default(), acs_signed_content: Default::default(), + directory_server_id: Default::default(), } } } @@ -221,6 +226,7 @@ impl AuthenticationUpdateInternal { acs_reference_number, acs_trans_id, acs_signed_content, + directory_server_id, } = self; Authentication { connector_authentication_id: connector_authentication_id @@ -252,6 +258,7 @@ impl AuthenticationUpdateInternal { acs_reference_number: acs_reference_number.or(source.acs_reference_number), acs_trans_id: acs_trans_id.or(source.acs_trans_id), acs_signed_content: acs_signed_content.or(source.acs_signed_content), + directory_server_id: directory_server_id.or(source.directory_server_id), ..source } } @@ -304,6 +311,7 @@ impl From for AuthenticationUpdateInternal { authentication_status, acquirer_bin, acquirer_merchant_id, + directory_server_id, } => Self { threeds_server_transaction_id: Some(threeds_server_transaction_id), maximum_supported_version: Some(maximum_supported_3ds_version), @@ -315,6 +323,7 @@ impl From for AuthenticationUpdateInternal { authentication_status: Some(authentication_status), acquirer_bin, acquirer_merchant_id, + directory_server_id, ..Default::default() }, AuthenticationUpdate::AuthenticationUpdate { diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 813fdd1f12..ba540f7f0b 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -115,6 +115,8 @@ diesel::table! { payment_id -> Nullable, #[max_length = 128] merchant_connector_id -> Varchar, + #[max_length = 128] + directory_server_id -> Nullable, } } diff --git a/crates/router/src/connector/netcetera/transformers.rs b/crates/router/src/connector/netcetera/transformers.rs index 90cf465e82..fffacc3ea4 100644 --- a/crates/router/src/connector/netcetera/transformers.rs +++ b/crates/router/src/connector/netcetera/transformers.rs @@ -96,6 +96,9 @@ impl three_ds_method_url, message_version: maximum_supported_3ds_version, connector_metadata: None, + directory_server_id: card_range + .as_ref() + .and_then(|card_range| card_range.directory_server_id.clone()), }, ) } diff --git a/crates/router/src/connector/threedsecureio/transformers.rs b/crates/router/src/connector/threedsecureio/transformers.rs index d6a77fef31..fe26e509c1 100644 --- a/crates/router/src/connector/threedsecureio/transformers.rs +++ b/crates/router/src/connector/threedsecureio/transformers.rs @@ -108,6 +108,7 @@ impl ) .change_context(errors::ConnectorError::ParsingFailed)?, connector_metadata: Some(connector_metadata), + directory_server_id: None, }, ) } diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs index e29c8b1023..0152fb4321 100644 --- a/crates/router/src/core/authentication/utils.rs +++ b/crates/router/src/core/authentication/utils.rs @@ -63,6 +63,7 @@ pub async fn update_trackers( three_ds_method_url, message_version, connector_metadata, + directory_server_id, } => storage::AuthenticationUpdate::PreAuthenticationUpdate { threeds_server_transaction_id, maximum_supported_3ds_version, @@ -77,6 +78,7 @@ pub async fn update_trackers( .map(|acquirer_details| acquirer_details.acquirer_bin.clone()), acquirer_merchant_id: acquirer_details .map(|acquirer_details| acquirer_details.acquirer_merchant_id), + directory_server_id, }, AuthenticationResponseData::AuthNResponse { authn_flow_type, @@ -181,6 +183,7 @@ pub async fn create_new_authentication( profile_id, payment_id, merchant_connector_id, + directory_server_id: None, }; state .store diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index bcc71f82bc..ca068f1d59 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -603,6 +603,9 @@ where 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}, + message_version: authentication.message_version.as_ref() + .map(|version| version.to_string()), + directory_server_id: authentication.directory_server_id.clone(), }, }) }else{ diff --git a/crates/router/src/db/authentication.rs b/crates/router/src/db/authentication.rs index 398af72f8b..4eff3dfdbf 100644 --- a/crates/router/src/db/authentication.rs +++ b/crates/router/src/db/authentication.rs @@ -147,6 +147,7 @@ impl AuthenticationInterface for MockDb { profile_id: authentication.profile_id, payment_id: authentication.payment_id, merchant_connector_id: authentication.merchant_connector_id, + directory_server_id: authentication.directory_server_id, }; authentications.push(authentication.clone()); Ok(authentication) diff --git a/crates/router/src/types/authentication.rs b/crates/router/src/types/authentication.rs index 91ab768e28..97ad8506d4 100644 --- a/crates/router/src/types/authentication.rs +++ b/crates/router/src/types/authentication.rs @@ -18,6 +18,7 @@ pub enum AuthenticationResponseData { three_ds_method_url: Option, message_version: common_utils::types::SemanticVersion, connector_metadata: Option, + directory_server_id: Option, }, AuthNResponse { authn_flow_type: AuthNFlowType, diff --git a/migrations/2024-05-21-075556_add_directory_server_id_in_authentication/down.sql b/migrations/2024-05-21-075556_add_directory_server_id_in_authentication/down.sql new file mode 100644 index 0000000000..7025236fe8 --- /dev/null +++ b/migrations/2024-05-21-075556_add_directory_server_id_in_authentication/down.sql @@ -0,0 +1 @@ +ALTER TABLE authentication DROP COLUMN IF EXISTS directory_server_id; \ No newline at end of file diff --git a/migrations/2024-05-21-075556_add_directory_server_id_in_authentication/up.sql b/migrations/2024-05-21-075556_add_directory_server_id_in_authentication/up.sql new file mode 100644 index 0000000000..ecad9d16f6 --- /dev/null +++ b/migrations/2024-05-21-075556_add_directory_server_id_in_authentication/up.sql @@ -0,0 +1,2 @@ +-- Your SQL goes here +ALTER TABLE authentication ADD COLUMN IF NOT EXISTS directory_server_id VARCHAR(128); \ No newline at end of file diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 2fca38a3b8..26eb8997c1 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -18340,6 +18340,16 @@ }, "poll_config": { "$ref": "#/components/schemas/PollConfigResponse" + }, + "message_version": { + "type": "string", + "description": "Message Version", + "nullable": true + }, + "directory_server_id": { + "type": "string", + "description": "Directory Server ID", + "nullable": true } } },