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

fix(router): allow dashboard (JWT) access to legacy customer/payment-method routes (#13279)

Shankar Singh C5d6c2b7a3e38
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index ee6e444643..03f2b85356 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -125,18 +125,29 @@ pub async fn validate_legacy_endpoint_access<E>(
where
E: From<errors::ApiErrorResponse> + error_stack::Context,
{
+ // The dashboard authenticates via JWT and still relies on these legacy
+ // endpoints, so only merchant (API key) traffic is blocked from deprecated
+ // routes.
+ let is_dashboard_access = matches!(
+ platform.get_initiator(),
+ Some(domain::Initiator::Jwt { .. })
+ );
+
let dimensions = dimension_state::Dimensions::new()
.with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
.with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
let feature_config = get_feature_config(state, platform, &dimensions).await;
- common_utils::fp_utils::when(feature_config.is_payment_method_modular_allowed, || {
- Err(error_stack::report!(E::from(
- errors::ApiErrorResponse::AccessForbidden {
- resource: "Deprecated route".to_string(),
- },
- )))
- })?;
+ common_utils::fp_utils::when(
+ feature_config.is_payment_method_modular_allowed && !is_dashboard_access,
+ || {
+ Err(error_stack::report!(E::from(
+ errors::ApiErrorResponse::AccessForbidden {
+ resource: "Deprecated route".to_string(),
+ },
+ )))
+ },
+ )?;
Ok(())
}