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(revenue_recovery): count card retries only in production (#14916)

CHALLA NISHANTH BABUd0be1b17dc10
diff --git a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
index 69f1c3f55d..c84609a3ae 100644
--- a/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
+++ b/crates/router/src/types/storage/revenue_recovery_redis_operation.rs
@@ -508,6 +508,15 @@ impl RedisTokenManager {
token: &PaymentProcessorTokenStatus,
network_type: Option<CardNetwork>,
) -> TokenRetryInfo {
+ // The retries are still recorded in every environment, but the limits are enforced only
+ // in production: test traffic in the other environments must not exhaust a card.
+ if !matches!(router_env::env::which(), router_env::env::Env::Production) {
+ return TokenRetryInfo {
+ monthly_wait_hours: 0,
+ daily_wait_hours: 0,
+ total_30_day_retries: 0,
+ };
+ }
let card_config = &state.conf.revenue_recovery.card_config;
let card_network_config = card_config.get_network_config(network_type);