Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(core): Add Authorize flow as fallback flow while fetching GSM for refund errors (#7129)
Debarati Ghatak7ea630da002f
diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rsindex 585e894adf..d27ad5d601 100644--- a/crates/router/src/consts.rs+++ b/crates/router/src/consts.rs@@ -215,3 +215,6 @@ pub const AUTHENTICATION_SERVICE_ELIGIBLE_CONFIG: &str =/// Refund flow identifier used for performing GSM operationspub const REFUND_FLOW_STR: &str = "refund_flow";++/// Authorize flow identifier used for performing GSM operations+pub const AUTHORIZE_FLOW_STR: &str = "Authorize";diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rsindex 1e788b6ace..a6505f2363 100644--- a/crates/router/src/core/refunds.rs+++ b/crates/router/src/core/refunds.rs@@ -297,6 +297,21 @@ pub async fn trigger_refund_to_gateway(consts::REFUND_FLOW_STR.to_string(),).await;+ // Note: Some connectors do not have a separate list of refund errors+ // In such cases, the error codes and messages are stored under "Authorize" flow in GSM table+ // So we will have to fetch the GSM using Authorize flow in case GSM is not found using "refund_flow"+ let option_gsm = if option_gsm.is_none() {+ helpers::get_gsm_record(+ state,+ Some(err.code.clone()),+ Some(err.message.clone()),+ connector.connector_name.to_string(),+ consts::AUTHORIZE_FLOW_STR.to_string(),+ )+ .await+ } else {+ option_gsm+ };let gsm_unified_code = option_gsm.as_ref().and_then(|gsm| gsm.unified_code.clone());let gsm_unified_message = option_gsm.and_then(|gsm| gsm.unified_message);