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): fix payment status updation for 2xx error responses (#1457)

Sai Harsha Vardhana7ac4af5d916
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 5736d83978..feda3e1052 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -300,8 +300,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
Some(storage::PaymentAttemptUpdate::ErrorUpdate {
connector: None,
status: match err.status_code {
- 400..=499 => storage::enums::AttemptStatus::Failure,
- _ => storage::enums::AttemptStatus::Pending,
+ 500..=511 => storage::enums::AttemptStatus::Pending,
+ _ => storage::enums::AttemptStatus::Failure,
},
error_message: Some(Some(err.message)),
error_code: Some(Some(err.code)),
@@ -450,8 +450,8 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
let payment_intent_update = match &router_data.response {
Err(err) => storage::PaymentIntentUpdate::PGStatusUpdate {
status: match err.status_code {
- 400..=499 => enums::IntentStatus::Failed,
- _ => enums::IntentStatus::Processing,
+ 500..=511 => enums::IntentStatus::Processing,
+ _ => enums::IntentStatus::Failed,
},
},
Ok(_) => storage::PaymentIntentUpdate::ResponseUpdate {