Skip to content

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

feat(sdk_config): added bank redirect for empty payment experience in sdk config api (#12992)

Sahkal Poddar40808d7c9644
diff --git a/crates/router/src/core/superposition_sdk_config.rs b/crates/router/src/core/superposition_sdk_config.rs
index b49de5f6f7..5061c2fc4f 100644
--- a/crates/router/src/core/superposition_sdk_config.rs
+++ b/crates/router/src/core/superposition_sdk_config.rs
@@ -558,11 +558,13 @@ fn translate_to_sdk_payment_methods(
for (payment_method_type, connectors) in &pms_ctx.banks_consolidated_hm {
let bank_names = get_banks(state, *payment_method_type, connectors.clone())
.change_context(errors::ApiErrorResponse::InternalServerError)?;
- let (_, rules) = consolidated_rules
+ let (criteria, rules) = consolidated_rules
.entry((api_enums::PaymentMethod::BankRedirect, *payment_method_type))
.or_insert_with(|| (Some(PaymentMethodCriteria::BankName), Vec::new()));
+ let mut has_banks = false;
for bank_code_res in bank_names {
for bank_name in bank_code_res.bank_name {
+ has_banks = true;
let criteria_value = format_criteria_value(None, Some(bank_name.to_string()), None);
rules.push(SdkCriteriaRule {
criteria_value,
@@ -570,6 +572,14 @@ fn translate_to_sdk_payment_methods(
});
}
}
+ if !has_banks {
+ *criteria = None;
+ let criteria_value = format_criteria_value(None, None, None);
+ rules.push(SdkCriteriaRule {
+ criteria_value,
+ eligible_connectors: connectors.clone(),
+ });
+ }
}
// 4. Bank debits