mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor(router): nest the straight through algorithm column in payment attempt (#1040)
This commit is contained in:
@ -1079,8 +1079,8 @@ where
|
||||
.attach_printable("Invalid straight through algorithm format in payment attempt")?,
|
||||
};
|
||||
|
||||
let request_straight_through: Option<api::RoutingAlgorithm> = request_straight_through
|
||||
.map(|val| val.parse_value("RoutingAlgorithm"))
|
||||
let request_straight_through: Option<api::StraightThroughAlgorithm> = request_straight_through
|
||||
.map(|val| val.parse_value("StraightThroughAlgorithm"))
|
||||
.transpose()
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Invalid straight through routing rules format")?;
|
||||
@ -1108,7 +1108,7 @@ where
|
||||
pub fn decide_connector(
|
||||
state: &AppState,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
request_straight_through: Option<api::RoutingAlgorithm>,
|
||||
request_straight_through: Option<api::StraightThroughAlgorithm>,
|
||||
routing_data: &mut storage::RoutingData,
|
||||
) -> RouterResult<api::ConnectorCallType> {
|
||||
if let Some(ref connector_name) = routing_data.routed_through {
|
||||
@ -1125,7 +1125,7 @@ pub fn decide_connector(
|
||||
|
||||
if let Some(routing_algorithm) = request_straight_through {
|
||||
let connector_name = match &routing_algorithm {
|
||||
api::RoutingAlgorithm::Single(conn) => conn.to_string(),
|
||||
api::StraightThroughAlgorithm::Single(conn) => conn.to_string(),
|
||||
};
|
||||
|
||||
let connector_data = api::ConnectorData::get_connector_by_name(
|
||||
@ -1143,7 +1143,7 @@ pub fn decide_connector(
|
||||
|
||||
if let Some(ref routing_algorithm) = routing_data.algorithm {
|
||||
let connector_name = match routing_algorithm {
|
||||
api::RoutingAlgorithm::Single(conn) => conn.to_string(),
|
||||
api::StraightThroughAlgorithm::Single(conn) => conn.to_string(),
|
||||
};
|
||||
|
||||
let connector_data = api::ConnectorData::get_connector_by_name(
|
||||
|
||||
@ -2,8 +2,8 @@ pub use api_models::admin::{
|
||||
MerchantAccountCreate, MerchantAccountDeleteResponse, MerchantAccountResponse,
|
||||
MerchantAccountUpdate, MerchantConnectorCreate, MerchantConnectorDeleteResponse,
|
||||
MerchantConnectorDetails, MerchantConnectorDetailsWrap, MerchantConnectorId, MerchantDetails,
|
||||
MerchantId, PaymentMethodsEnabled, RoutingAlgorithm, ToggleKVRequest, ToggleKVResponse,
|
||||
WebhookDetails,
|
||||
MerchantId, PaymentMethodsEnabled, RoutingAlgorithm, StraightThroughAlgorithm, ToggleKVRequest,
|
||||
ToggleKVResponse, WebhookDetails,
|
||||
};
|
||||
use common_utils::ext_traits::ValueExt;
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ pub use storage_models::payment_attempt::{
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct RoutingData {
|
||||
pub routed_through: Option<String>,
|
||||
pub algorithm: Option<api_models::admin::RoutingAlgorithm>,
|
||||
pub algorithm: Option<api_models::admin::StraightThroughAlgorithm>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "kv_store")]
|
||||
|
||||
Reference in New Issue
Block a user