mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
feat(router): add merchant_configuration_id in netcetera metadata and make other merchant configurations optional (#7347)
This commit is contained in:
committed by
GitHub
parent
049fcdb3fb
commit
57ab8693e2
@ -253,12 +253,13 @@ pub struct NetceteraErrorDetails {
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct NetceteraMetaData {
|
||||
pub mcc: String,
|
||||
pub merchant_country_code: String,
|
||||
pub merchant_name: String,
|
||||
pub mcc: Option<String>,
|
||||
pub merchant_country_code: Option<String>,
|
||||
pub merchant_name: Option<String>,
|
||||
pub endpoint_prefix: String,
|
||||
pub three_ds_requestor_name: String,
|
||||
pub three_ds_requestor_id: String,
|
||||
pub three_ds_requestor_name: Option<String>,
|
||||
pub three_ds_requestor_id: Option<String>,
|
||||
pub merchant_configuration_id: Option<String>,
|
||||
}
|
||||
|
||||
impl TryFrom<&Option<common_utils::pii::SecretSerdeValue>> for NetceteraMetaData {
|
||||
@ -515,13 +516,13 @@ impl TryFrom<&NetceteraRouterData<&types::authentication::ConnectorAuthenticatio
|
||||
.parse_value("NetceteraMetaData")
|
||||
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
|
||||
let merchant_data = netcetera_types::MerchantData {
|
||||
merchant_configuration_id: None,
|
||||
mcc: Some(connector_meta_data.mcc),
|
||||
merchant_country_code: Some(connector_meta_data.merchant_country_code),
|
||||
merchant_name: Some(connector_meta_data.merchant_name),
|
||||
merchant_configuration_id: connector_meta_data.merchant_configuration_id,
|
||||
mcc: connector_meta_data.mcc,
|
||||
merchant_country_code: connector_meta_data.merchant_country_code,
|
||||
merchant_name: connector_meta_data.merchant_name,
|
||||
notification_url: request.return_url.clone(),
|
||||
three_ds_requestor_id: Some(connector_meta_data.three_ds_requestor_id),
|
||||
three_ds_requestor_name: Some(connector_meta_data.three_ds_requestor_name),
|
||||
three_ds_requestor_id: connector_meta_data.three_ds_requestor_id,
|
||||
three_ds_requestor_name: connector_meta_data.three_ds_requestor_name,
|
||||
white_list_status: None,
|
||||
trust_list_status: None,
|
||||
seller_info: None,
|
||||
|
||||
@ -6539,7 +6539,7 @@ pub fn validate_mandate_data_and_future_usage(
|
||||
pub enum UnifiedAuthenticationServiceFlow {
|
||||
ClickToPayInitiate,
|
||||
ExternalAuthenticationInitiate {
|
||||
acquirer_details: authentication::types::AcquirerDetails,
|
||||
acquirer_details: Option<authentication::types::AcquirerDetails>,
|
||||
card_number: ::cards::CardNumber,
|
||||
token: String,
|
||||
},
|
||||
@ -6613,7 +6613,7 @@ pub async fn decide_action_for_unified_authentication_service<F: Clone>(
|
||||
|
||||
pub enum PaymentExternalAuthenticationFlow {
|
||||
PreAuthenticationFlow {
|
||||
acquirer_details: authentication::types::AcquirerDetails,
|
||||
acquirer_details: Option<authentication::types::AcquirerDetails>,
|
||||
card_number: ::cards::CardNumber,
|
||||
token: String,
|
||||
},
|
||||
@ -6690,17 +6690,27 @@ pub async fn get_payment_external_authentication_flow_during_confirm<F: Clone>(
|
||||
connector_data.merchant_connector_id.as_ref(),
|
||||
)
|
||||
.await?;
|
||||
let acquirer_details: authentication::types::AcquirerDetails = payment_connector_mca
|
||||
let acquirer_details = payment_connector_mca
|
||||
.get_metadata()
|
||||
.get_required_value("merchant_connector_account.metadata")?
|
||||
.peek()
|
||||
.clone()
|
||||
.parse_value("AcquirerDetails")
|
||||
.change_context(errors::ApiErrorResponse::PreconditionFailed {
|
||||
message:
|
||||
"acquirer_bin and acquirer_merchant_id not found in Payment Connector's Metadata"
|
||||
.to_string(),
|
||||
})?;
|
||||
.and_then(|metadata| {
|
||||
metadata
|
||||
.peek()
|
||||
.clone()
|
||||
.parse_value::<authentication::types::AcquirerDetails>("AcquirerDetails")
|
||||
.change_context(errors::ApiErrorResponse::PreconditionFailed {
|
||||
message:
|
||||
"acquirer_bin and acquirer_merchant_id not found in Payment Connector's Metadata"
|
||||
.to_string(),
|
||||
})
|
||||
.inspect_err(|err| {
|
||||
logger::error!(
|
||||
"Failed to parse acquirer details from Payment Connector's Metadata: {:?}",
|
||||
err
|
||||
);
|
||||
})
|
||||
.ok()
|
||||
});
|
||||
Some(PaymentExternalAuthenticationFlow::PreAuthenticationFlow {
|
||||
card_number,
|
||||
token,
|
||||
|
||||
@ -983,7 +983,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
|
||||
card_number,
|
||||
token,
|
||||
business_profile,
|
||||
Some(acquirer_details),
|
||||
acquirer_details,
|
||||
Some(payment_data.payment_attempt.payment_id.clone()),
|
||||
payment_data.payment_attempt.organization_id.clone(),
|
||||
)
|
||||
@ -1267,7 +1267,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
|
||||
state,
|
||||
pre_auth_response,
|
||||
authentication.clone(),
|
||||
Some(acquirer_details),
|
||||
acquirer_details,
|
||||
).await?;
|
||||
payment_data.authentication = Some(updated_authentication.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user