From 6f786abca3689dcf9ae33078b36a83b3a80072d3 Mon Sep 17 00:00:00 2001 From: Pratik Prajapati Date: Sun, 9 Nov 2025 12:52:22 +0530 Subject: [PATCH] fix: remove redundant commas and improve code formatting --- src/decider/gatewaydecider/flow_new.rs | 46 +++++++++++---------- src/decider/gatewaydecider/gw_filter_new.rs | 14 +++---- src/feedback/gateway_scoring_service.rs | 8 ++-- src/feedback/utils.rs | 2 +- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/src/decider/gatewaydecider/flow_new.rs b/src/decider/gatewaydecider/flow_new.rs index 97b315d9..15e3b4f6 100644 --- a/src/decider/gatewaydecider/flow_new.rs +++ b/src/decider/gatewaydecider/flow_new.rs @@ -474,28 +474,30 @@ pub async fn run_decider_flow( Some(decideGatewayOutput) => { let cpu_time = cpu_start.elapsed().as_millis() as u64; Ok(T::DecidedGateway { - decided_gateway: decideGatewayOutput, - gateway_priority_map: gatewayPriorityMap, - filter_wise_gateways: None, - priority_logic_tag: updatedPriorityLogicOutput - .priority_logic_tag - .clone(), - routing_approach: finalDeciderApproach.clone(), - gateway_before_evaluation: topGatewayBeforeSRDowntimeEvaluation.clone(), - priority_logic_output: Some(updatedPriorityLogicOutput), - reset_approach: decider_flow.writer.reset_approach.clone(), - routing_dimension: decider_flow.writer.routing_dimension.clone(), - routing_dimension_level: decider_flow - .writer - .routing_dimension_level - .clone(), - is_scheduled_outage: decider_flow.writer.isScheduledOutage, - is_dynamic_mga_enabled: decider_flow.writer.is_dynamic_mga_enabled, - gateway_mga_id_map: None, - debit_routing_output: None, - is_rust_based_decider: true, - latency: Some(cpu_time), - })}, + decided_gateway: decideGatewayOutput, + gateway_priority_map: gatewayPriorityMap, + filter_wise_gateways: None, + priority_logic_tag: updatedPriorityLogicOutput + .priority_logic_tag + .clone(), + routing_approach: finalDeciderApproach.clone(), + gateway_before_evaluation: topGatewayBeforeSRDowntimeEvaluation + .clone(), + priority_logic_output: Some(updatedPriorityLogicOutput), + reset_approach: decider_flow.writer.reset_approach.clone(), + routing_dimension: decider_flow.writer.routing_dimension.clone(), + routing_dimension_level: decider_flow + .writer + .routing_dimension_level + .clone(), + is_scheduled_outage: decider_flow.writer.isScheduledOutage, + is_dynamic_mga_enabled: decider_flow.writer.is_dynamic_mga_enabled, + gateway_mga_id_map: None, + debit_routing_output: None, + is_rust_based_decider: true, + latency: Some(cpu_time), + }) + } None => Err(( decider_flow.writer.debugFilterList.clone(), decider_flow.writer.debugScoringList.clone(), diff --git a/src/decider/gatewaydecider/gw_filter_new.rs b/src/decider/gatewaydecider/gw_filter_new.rs index 832e2231..2b6ee1f0 100644 --- a/src/decider/gatewaydecider/gw_filter_new.rs +++ b/src/decider/gatewaydecider/gw_filter_new.rs @@ -295,7 +295,7 @@ pub async fn filterFunctionalGateways(this: &mut DeciderFlow<'_>) -> GatewayList let mPmEntryDB = ETP::get_by_name(brand).await; if let Some(cardPaymentMethod) = mPmEntryDB { let uniqueGwLs: Vec = st.into_iter().collect(); - let allGPMfEntries = GPMF::find_all_gpmf_by_gateway_payment_flow_payment_method(uniqueGwLs.clone(), cardPaymentMethod.id, PaymentFlow::CVVLESS,).await; + let allGPMfEntries = GPMF::find_all_gpmf_by_gateway_payment_flow_payment_method(uniqueGwLs.clone(), cardPaymentMethod.id, PaymentFlow::CVVLESS).await; let gmpfGws: Vec = allGPMfEntries.iter() .map(|gpmf| gpmf.gateway.clone()) .collect(); @@ -2323,7 +2323,7 @@ fn get_zero_auth_supported_gateways(txn_type: &str, txn_detail_type_restricted_g .map_or_else(Vec::new, |mapping| mapping.1.clone()) } -pub async fn filterGatewaysForTxnDetailType(this: &mut DeciderFlow<'_>,) -> Vec { +pub async fn filterGatewaysForTxnDetailType(this: &mut DeciderFlow<'_>) -> Vec { let st = getGws(this); let m_txn_type = this.get().dpTxnDetail.txnType.clone(); let txn_type: &str = m_txn_type.as_str(); @@ -2341,7 +2341,7 @@ pub async fn filterGatewaysForTxnDetailType(this: &mut DeciderFlow<'_>,) -> Vec< returnGwListWithLog(this, DeciderFilterName::FilterFunctionalGatewaysForTxnDetailType, true) } -pub async fn filterGatewaysForReward(this: &mut DeciderFlow<'_>,) -> Vec { +pub async fn filterGatewaysForReward(this: &mut DeciderFlow<'_>) -> Vec { let st = getGws(this) ; let payment_method_type = this.get().dpTxnCardInfo.paymentMethodType.clone(); let card_type = this.get().dpTxnCardInfo.card_type.clone(); @@ -2368,7 +2368,7 @@ pub async fn filterGatewaysForReward(this: &mut DeciderFlow<'_>,) -> Vec,) -> Vec { +pub async fn filterGatewaysForCash(this: &mut DeciderFlow<'_>) -> Vec { let st = getGws(this); let payment_method_type = this.get().dpTxnCardInfo.paymentMethodType.clone(); if payment_method_type != ETP::PaymentMethodType::Cash { @@ -2382,7 +2382,7 @@ pub async fn filterGatewaysForCash(this: &mut DeciderFlow<'_>,) -> Vec,) -> Vec { +pub async fn filterFunctionalGatewaysForSplitSettlement(this: &mut DeciderFlow<'_>) -> Vec { let oref = this.get().dpOrder.clone(); let txn_id = this.get().dpTxnDetail.clone(); let e_split_settlement_details = Utils::get_split_settlement_details(this).await; @@ -2491,11 +2491,11 @@ pub async fn filterFunctionalGatewaysForSplitSettlement(this: &mut DeciderFlow<' returnGwListWithLog(this, DeciderFilterName::FilterFunctionalGatewaysForSplitSettlement, true) } - pub fn log_final_functional_gateways(this: &mut DeciderFlow<'_>,) -> Vec { + pub fn log_final_functional_gateways(this: &mut DeciderFlow<'_>) -> Vec { returnGwListWithLog(this, DeciderFilterName::FinalFunctionalGateways, false) } -pub async fn filterGatewaysForPaymentMethod (this: &mut DeciderFlow<'_>,) -> Vec { +pub async fn filterGatewaysForPaymentMethod (this: &mut DeciderFlow<'_>) -> Vec { let st = getGws(this) ; let txn = this.get().dpTxnDetail.clone(); let merchant_acc = this.get().dpMerchantAccount.clone(); diff --git a/src/feedback/gateway_scoring_service.rs b/src/feedback/gateway_scoring_service.rs index 551ff6e5..1bf88425 100644 --- a/src/feedback/gateway_scoring_service.rs +++ b/src/feedback/gateway_scoring_service.rs @@ -368,14 +368,14 @@ pub fn update_gateway_score_lock( txn_uuid: String, gateway: String, ) -> String { - match (gateway_scoring_type) { - (GatewayScoringType::Penalise) => { + match gateway_scoring_type { + GatewayScoringType::Penalise => { format!("gateway_scores_lock_PENALISE_{}_{}", txn_uuid, gateway) } - (GatewayScoringType::PenaliseSrv3) => { + GatewayScoringType::PenaliseSrv3 => { format!("gateway_scores_lock_PENALISE_SRV3_{}_{}", txn_uuid, gateway) } - (GatewayScoringType::Reward) => { + GatewayScoringType::Reward => { format!("gateway_scores_lock_REWARD_{}_{}", txn_uuid, gateway) } _ => String::new(), diff --git a/src/feedback/utils.rs b/src/feedback/utils.rs index b8f86799..03c4ba41 100644 --- a/src/feedback/utils.rs +++ b/src/feedback/utils.rs @@ -873,7 +873,7 @@ pub fn getTxnTypeFromInternalMetadata(internal_metadata: Option>) tag = "APP_DEBUG", "FETCH_TXN_TYPE_FROM_IM_FLOW" ); - (MandateTxnType::Default) + MandateTxnType::Default } Some(internal_metadata) => { match serde_json::from_str::(internal_metadata.peek()) {