mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor(euclid): add logs for euclid routing (#8962)
This commit is contained in:
@ -8496,6 +8496,7 @@ where
|
|||||||
.attach_printable("Invalid connector name received in 'routed_through'")?;
|
.attach_printable("Invalid connector name received in 'routed_through'")?;
|
||||||
|
|
||||||
routing_data.routed_through = Some(connector_name.clone());
|
routing_data.routed_through = Some(connector_name.clone());
|
||||||
|
logger::debug!("euclid_routing: predetermined connector present in attempt");
|
||||||
return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
|
return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8515,6 +8516,7 @@ where
|
|||||||
.merchant_connector_id
|
.merchant_connector_id
|
||||||
.clone_from(&mandate_connector_details.merchant_connector_id);
|
.clone_from(&mandate_connector_details.merchant_connector_id);
|
||||||
|
|
||||||
|
logger::debug!("euclid_routing: predetermined mandate connector");
|
||||||
return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
|
return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8599,6 +8601,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger::debug!("euclid_routing: pre-routing connector present");
|
||||||
|
|
||||||
let first_pre_routing_connector_data_list = pre_routing_connector_data_list
|
let first_pre_routing_connector_data_list = pre_routing_connector_data_list
|
||||||
.first()
|
.first()
|
||||||
.ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?;
|
.ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?;
|
||||||
@ -8662,6 +8666,7 @@ where
|
|||||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||||
.attach_printable("Invalid connector name received")?;
|
.attach_printable("Invalid connector name received")?;
|
||||||
|
|
||||||
|
logger::debug!("euclid_routing: straight through connector present");
|
||||||
return decide_multiplex_connector_for_normal_or_recurring_payment(
|
return decide_multiplex_connector_for_normal_or_recurring_payment(
|
||||||
&state,
|
&state,
|
||||||
payment_data,
|
payment_data,
|
||||||
@ -8706,6 +8711,7 @@ where
|
|||||||
.attach_printable("failed eligibility analysis and fallback")?;
|
.attach_printable("failed eligibility analysis and fallback")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger::debug!("euclid_routing: single connector present in algorithm data");
|
||||||
let connector_data = connectors
|
let connector_data = connectors
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|conn| {
|
.map(|conn| {
|
||||||
@ -8793,7 +8799,7 @@ where
|
|||||||
Some(api::MandateTransactionType::RecurringMandateTransaction),
|
Some(api::MandateTransactionType::RecurringMandateTransaction),
|
||||||
)
|
)
|
||||||
| (None, Some(_), None, Some(true), _) => {
|
| (None, Some(_), None, Some(true), _) => {
|
||||||
logger::debug!("performing routing for token-based MIT flow");
|
logger::debug!("euclid_routing: performing routing for token-based MIT flow");
|
||||||
|
|
||||||
let payment_method_info = payment_data
|
let payment_method_info = payment_data
|
||||||
.get_payment_method_info()
|
.get_payment_method_info()
|
||||||
@ -8906,7 +8912,9 @@ where
|
|||||||
.into(),
|
.into(),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
logger::error!("no eligible connector found for the ppt_mandate payment");
|
logger::error!(
|
||||||
|
"euclid_routing: no eligible connector found for the ppt_mandate payment"
|
||||||
|
);
|
||||||
Err(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration.into())
|
Err(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8965,7 +8973,7 @@ where
|
|||||||
})
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
logger::info!("using connector_mandate_id for MIT flow");
|
logger::info!("euclid_routing: using connector_mandate_id for MIT flow");
|
||||||
if let Some(merchant_connector_id) = connector_data.merchant_connector_id.as_ref() {
|
if let Some(merchant_connector_id) = connector_data.merchant_connector_id.as_ref() {
|
||||||
if let Some(mandate_reference_record) = connector_mandate_details.clone()
|
if let Some(mandate_reference_record) = connector_mandate_details.clone()
|
||||||
.get_required_value("connector_mandate_details")
|
.get_required_value("connector_mandate_details")
|
||||||
|
|||||||
@ -441,6 +441,7 @@ pub async fn perform_static_routing_v1(
|
|||||||
Vec<routing_types::RoutableConnectorChoice>,
|
Vec<routing_types::RoutableConnectorChoice>,
|
||||||
Option<common_enums::RoutingApproach>,
|
Option<common_enums::RoutingApproach>,
|
||||||
)> {
|
)> {
|
||||||
|
logger::debug!("euclid_routing: performing routing for connector selection");
|
||||||
let get_merchant_fallback_config = || async {
|
let get_merchant_fallback_config = || async {
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
return routing::helpers::get_merchant_default_config(
|
return routing::helpers::get_merchant_default_config(
|
||||||
@ -459,6 +460,7 @@ pub async fn perform_static_routing_v1(
|
|||||||
id
|
id
|
||||||
} else {
|
} else {
|
||||||
let fallback_config = get_merchant_fallback_config().await?;
|
let fallback_config = get_merchant_fallback_config().await?;
|
||||||
|
logger::debug!("euclid_routing: active algorithm isn't present, default falling back");
|
||||||
return Ok((fallback_config, None));
|
return Ok((fallback_config, None));
|
||||||
};
|
};
|
||||||
let cached_algorithm = ensure_algorithm_cached_v1(
|
let cached_algorithm = ensure_algorithm_cached_v1(
|
||||||
@ -1038,6 +1040,7 @@ pub async fn perform_eligibility_analysis_with_fallback(
|
|||||||
eligible_connectors: Option<Vec<api_enums::RoutableConnectors>>,
|
eligible_connectors: Option<Vec<api_enums::RoutableConnectors>>,
|
||||||
business_profile: &domain::Profile,
|
business_profile: &domain::Profile,
|
||||||
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
|
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
|
||||||
|
logger::debug!("euclid_routing: performing eligibility");
|
||||||
let mut final_selection = perform_eligibility_analysis(
|
let mut final_selection = perform_eligibility_analysis(
|
||||||
state,
|
state,
|
||||||
key_store,
|
key_store,
|
||||||
@ -1072,7 +1075,7 @@ pub async fn perform_eligibility_analysis_with_fallback(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|item| item.connector)
|
.map(|item| item.connector)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
logger::debug!(final_selected_connectors_for_routing=?final_selected_connectors, "List of final selected connectors for routing");
|
logger::debug!(final_selected_connectors_for_routing=?final_selected_connectors, "euclid_routing: List of final selected connectors for routing");
|
||||||
|
|
||||||
Ok(final_selection)
|
Ok(final_selection)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user