mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
feat(router): add acquirer_country_code in acquirer_details and send it in netcetera authentication flow (#4835)
This commit is contained in:
committed by
GitHub
parent
e7acaa5716
commit
3077421cbd
@ -94,6 +94,7 @@ pub struct ApiModelMetaData {
|
||||
pub merchant_name: Option<String>,
|
||||
pub acquirer_bin: Option<String>,
|
||||
pub acquirer_merchant_id: Option<String>,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
pub three_ds_requestor_name: Option<String>,
|
||||
pub three_ds_requestor_id: Option<String>,
|
||||
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
|
||||
@ -209,6 +210,7 @@ pub struct DashboardMetaData {
|
||||
pub merchant_name: Option<String>,
|
||||
pub acquirer_bin: Option<String>,
|
||||
pub acquirer_merchant_id: Option<String>,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
pub three_ds_requestor_name: Option<String>,
|
||||
pub three_ds_requestor_id: Option<String>,
|
||||
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
|
||||
|
||||
@ -97,6 +97,7 @@ pub struct ConfigMetadata {
|
||||
pub merchant_name: Option<String>,
|
||||
pub acquirer_bin: Option<String>,
|
||||
pub acquirer_merchant_id: Option<String>,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
pub three_ds_requestor_name: Option<String>,
|
||||
pub three_ds_requestor_id: Option<String>,
|
||||
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
|
||||
|
||||
@ -329,6 +329,7 @@ impl From<ApiModelMetaData> for DashboardMetaData {
|
||||
merchant_name: api_model.merchant_name,
|
||||
acquirer_bin: api_model.acquirer_bin,
|
||||
acquirer_merchant_id: api_model.acquirer_merchant_id,
|
||||
acquirer_country_code: api_model.acquirer_country_code,
|
||||
three_ds_requestor_name: api_model.three_ds_requestor_name,
|
||||
three_ds_requestor_id: api_model.three_ds_requestor_id,
|
||||
pull_mechanism_for_external_3ds_enabled: api_model
|
||||
|
||||
@ -195,6 +195,7 @@ impl DashboardRequestPayload {
|
||||
merchant_name: None,
|
||||
acquirer_bin: None,
|
||||
acquirer_merchant_id: None,
|
||||
acquirer_country_code: None,
|
||||
three_ds_requestor_name: None,
|
||||
three_ds_requestor_id: None,
|
||||
pull_mechanism_for_external_3ds_enabled: None,
|
||||
@ -222,6 +223,7 @@ impl DashboardRequestPayload {
|
||||
let merchant_name = meta_data.merchant_name;
|
||||
let acquirer_bin = meta_data.acquirer_bin;
|
||||
let acquirer_merchant_id = meta_data.acquirer_merchant_id;
|
||||
let acquirer_country_code = meta_data.acquirer_country_code;
|
||||
let three_ds_requestor_name = meta_data.three_ds_requestor_name;
|
||||
let three_ds_requestor_id = meta_data.three_ds_requestor_id;
|
||||
let pull_mechanism_for_external_3ds_enabled =
|
||||
@ -246,6 +248,7 @@ impl DashboardRequestPayload {
|
||||
merchant_name,
|
||||
acquirer_bin,
|
||||
acquirer_merchant_id,
|
||||
acquirer_country_code,
|
||||
three_ds_requestor_name,
|
||||
three_ds_requestor_id,
|
||||
pull_mechanism_for_external_3ds_enabled,
|
||||
|
||||
@ -780,6 +780,7 @@ label="apple"
|
||||
[checkout.metadata]
|
||||
acquirer_bin = "Acquirer Bin"
|
||||
acquirer_merchant_id = "Acquirer Merchant ID"
|
||||
acquirer_country_code = "Acquirer Country Code"
|
||||
|
||||
[coinbase]
|
||||
[[coinbase.crypto]]
|
||||
@ -863,6 +864,11 @@ merchant_name="Google Pay Merchant Name"
|
||||
gateway_merchant_id="Google Pay Merchant Key"
|
||||
merchant_id="Google Pay Merchant ID"
|
||||
|
||||
[cybersource.metadata]
|
||||
acquirer_bin = "Acquirer Bin"
|
||||
acquirer_merchant_id = "Acquirer Merchant ID"
|
||||
acquirer_country_code = "Acquirer Country Code"
|
||||
|
||||
[cybersource_payout]
|
||||
[[cybersource_payout.credit]]
|
||||
payment_method_type = "Mastercard"
|
||||
@ -1374,6 +1380,7 @@ merchant_secret="Source verification key"
|
||||
[nmi.metadata]
|
||||
acquirer_bin = "Acquirer Bin"
|
||||
acquirer_merchant_id = "Acquirer Merchant ID"
|
||||
acquirer_country_code = "Acquirer Country Code"
|
||||
|
||||
[nmi.metadata.google_pay]
|
||||
merchant_name="Google Pay Merchant Name"
|
||||
|
||||
@ -780,6 +780,7 @@ label="apple"
|
||||
[checkout.metadata]
|
||||
acquirer_bin = "Acquirer Bin"
|
||||
acquirer_merchant_id = "Acquirer Merchant ID"
|
||||
acquirer_country_code = "Acquirer Country Code"
|
||||
|
||||
[coinbase]
|
||||
[[coinbase.crypto]]
|
||||
@ -863,6 +864,11 @@ merchant_name="Google Pay Merchant Name"
|
||||
gateway_merchant_id="Google Pay Merchant Key"
|
||||
merchant_id="Google Pay Merchant ID"
|
||||
|
||||
[cybersource.metadata]
|
||||
acquirer_bin = "Acquirer Bin"
|
||||
acquirer_merchant_id = "Acquirer Merchant ID"
|
||||
acquirer_country_code = "Acquirer Country Code"
|
||||
|
||||
[cybersource_payout]
|
||||
[[cybersource_payout.credit]]
|
||||
payment_method_type = "Mastercard"
|
||||
@ -1374,6 +1380,7 @@ merchant_secret="Source verification key"
|
||||
[nmi.metadata]
|
||||
acquirer_bin = "Acquirer Bin"
|
||||
acquirer_merchant_id = "Acquirer Merchant ID"
|
||||
acquirer_country_code = "Acquirer Country Code"
|
||||
|
||||
[nmi.metadata.google_pay]
|
||||
merchant_name="Google Pay Merchant Name"
|
||||
|
||||
@ -44,6 +44,7 @@ pub struct Authentication {
|
||||
pub merchant_connector_id: String,
|
||||
pub ds_trans_id: Option<String>,
|
||||
pub directory_server_id: Option<String>,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
}
|
||||
|
||||
impl Authentication {
|
||||
@ -90,6 +91,7 @@ pub struct AuthenticationNew {
|
||||
pub merchant_connector_id: String,
|
||||
pub ds_trans_id: Option<String>,
|
||||
pub directory_server_id: Option<String>,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -118,6 +120,7 @@ pub enum AuthenticationUpdate {
|
||||
acquirer_bin: Option<String>,
|
||||
acquirer_merchant_id: Option<String>,
|
||||
directory_server_id: Option<String>,
|
||||
acquirer_country_code: Option<String>,
|
||||
},
|
||||
AuthenticationUpdate {
|
||||
authentication_value: Option<String>,
|
||||
@ -180,6 +183,7 @@ pub struct AuthenticationUpdateInternal {
|
||||
pub acs_signed_content: Option<String>,
|
||||
pub ds_trans_id: Option<String>,
|
||||
pub directory_server_id: Option<String>,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for AuthenticationUpdateInternal {
|
||||
@ -212,6 +216,7 @@ impl Default for AuthenticationUpdateInternal {
|
||||
acs_signed_content: Default::default(),
|
||||
ds_trans_id: Default::default(),
|
||||
directory_server_id: Default::default(),
|
||||
acquirer_country_code: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -246,6 +251,7 @@ impl AuthenticationUpdateInternal {
|
||||
acs_signed_content,
|
||||
ds_trans_id,
|
||||
directory_server_id,
|
||||
acquirer_country_code,
|
||||
} = self;
|
||||
Authentication {
|
||||
connector_authentication_id: connector_authentication_id
|
||||
@ -279,6 +285,7 @@ impl AuthenticationUpdateInternal {
|
||||
acs_signed_content: acs_signed_content.or(source.acs_signed_content),
|
||||
ds_trans_id: ds_trans_id.or(source.ds_trans_id),
|
||||
directory_server_id: directory_server_id.or(source.directory_server_id),
|
||||
acquirer_country_code: acquirer_country_code.or(source.acquirer_country_code),
|
||||
..source
|
||||
}
|
||||
}
|
||||
@ -331,6 +338,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
|
||||
acquirer_bin,
|
||||
acquirer_merchant_id,
|
||||
directory_server_id,
|
||||
acquirer_country_code,
|
||||
} => Self {
|
||||
threeds_server_transaction_id: Some(threeds_server_transaction_id),
|
||||
maximum_supported_version: Some(maximum_supported_3ds_version),
|
||||
@ -343,6 +351,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
|
||||
acquirer_bin,
|
||||
acquirer_merchant_id,
|
||||
directory_server_id,
|
||||
acquirer_country_code,
|
||||
..Default::default()
|
||||
},
|
||||
AuthenticationUpdate::AuthenticationUpdate {
|
||||
|
||||
@ -119,6 +119,8 @@ diesel::table! {
|
||||
ds_trans_id -> Nullable<Varchar>,
|
||||
#[max_length = 128]
|
||||
directory_server_id -> Nullable<Varchar>,
|
||||
#[max_length = 64]
|
||||
acquirer_country_code -> Nullable<Varchar>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -110,6 +110,7 @@ pub struct PreAuthenticationData {
|
||||
pub message_version: common_utils::types::SemanticVersion,
|
||||
pub acquirer_bin: Option<String>,
|
||||
pub acquirer_merchant_id: Option<String>,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
pub connector_metadata: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
@ -136,6 +137,7 @@ impl TryFrom<&diesel_models::authentication::Authentication> for PreAuthenticati
|
||||
acquirer_bin: authentication.acquirer_bin.clone(),
|
||||
acquirer_merchant_id: authentication.acquirer_merchant_id.clone(),
|
||||
connector_metadata: authentication.connector_metadata.clone(),
|
||||
acquirer_country_code: authentication.acquirer_country_code.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -150,6 +152,7 @@ pub struct ThreeDsMethodData {
|
||||
pub struct AcquirerDetails {
|
||||
pub acquirer_bin: String,
|
||||
pub acquirer_merchant_id: String,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
|
||||
@ -516,7 +516,7 @@ impl TryFrom<&NetceteraRouterData<&types::authentication::ConnectorAuthenticatio
|
||||
let acquirer_details = netcetera_types::AcquirerData {
|
||||
acquirer_bin: request.pre_authentication_data.acquirer_bin,
|
||||
acquirer_merchant_id: request.pre_authentication_data.acquirer_merchant_id,
|
||||
acquirer_country_code: None,
|
||||
acquirer_country_code: request.pre_authentication_data.acquirer_country_code,
|
||||
};
|
||||
let connector_meta_data: NetceteraMetaData = item
|
||||
.router_data
|
||||
|
||||
@ -28,6 +28,7 @@ impl ForeignTryFrom<&storage::Authentication> for PreAuthenticationData {
|
||||
message_version,
|
||||
acquirer_bin: authentication.acquirer_bin.clone(),
|
||||
acquirer_merchant_id: authentication.acquirer_merchant_id.clone(),
|
||||
acquirer_country_code: authentication.acquirer_country_code.clone(),
|
||||
connector_metadata: authentication.connector_metadata.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -77,7 +77,10 @@ pub async fn update_trackers<F: Clone, Req>(
|
||||
.as_ref()
|
||||
.map(|acquirer_details| acquirer_details.acquirer_bin.clone()),
|
||||
acquirer_merchant_id: acquirer_details
|
||||
.map(|acquirer_details| acquirer_details.acquirer_merchant_id),
|
||||
.as_ref()
|
||||
.map(|acquirer_details| acquirer_details.acquirer_merchant_id.clone()),
|
||||
acquirer_country_code: acquirer_details
|
||||
.and_then(|acquirer_details| acquirer_details.acquirer_country_code),
|
||||
directory_server_id,
|
||||
},
|
||||
AuthenticationResponseData::AuthNResponse {
|
||||
@ -214,6 +217,7 @@ pub async fn create_new_authentication(
|
||||
merchant_connector_id,
|
||||
ds_trans_id: None,
|
||||
directory_server_id: None,
|
||||
acquirer_country_code: None,
|
||||
};
|
||||
state
|
||||
.store
|
||||
|
||||
@ -149,6 +149,7 @@ impl AuthenticationInterface for MockDb {
|
||||
merchant_connector_id: authentication.merchant_connector_id,
|
||||
ds_trans_id: authentication.ds_trans_id,
|
||||
directory_server_id: authentication.directory_server_id,
|
||||
acquirer_country_code: authentication.acquirer_country_code,
|
||||
};
|
||||
authentications.push(authentication.clone());
|
||||
Ok(authentication)
|
||||
|
||||
@ -25,6 +25,7 @@ use crate::{connector, services, types, types::storage};
|
||||
pub struct AcquirerDetails {
|
||||
pub acquirer_bin: String,
|
||||
pub acquirer_merchant_mid: String,
|
||||
pub acquirer_country_code: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, serde::Deserialize, Debug, serde::Serialize)]
|
||||
|
||||
@ -0,0 +1 @@
|
||||
ALTER TABLE authentication DROP COLUMN IF EXISTS acquirer_country_code;
|
||||
@ -0,0 +1,2 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE authentication ADD COLUMN IF NOT EXISTS acquirer_country_code VARCHAR(64);
|
||||
Reference in New Issue
Block a user