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(connector): [noon] Fail the payment for specific error_response (#3674)

SamraatBansaldf739a302b06
diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rs
index 33cb94da18..d9e9417df8 100644
--- a/crates/router/src/connector/noon.rs
+++ b/crates/router/src/connector/noon.rs
@@ -137,12 +137,18 @@ impl ConnectorCommon for Noon {
Ok(noon_error_response) => {
event_builder.map(|i| i.set_error_response_body(&noon_error_response));
router_env::logger::info!(connector_response=?noon_error_response);
+ // Adding in case of timeouts, if psync gives 4xx with this code, fail the payment
+ let attempt_status = if noon_error_response.result_code == 19001 {
+ Some(enums::AttemptStatus::Failure)
+ } else {
+ None
+ };
Ok(ErrorResponse {
status_code: res.status_code,
- code: consts::NO_ERROR_CODE.to_string(),
+ code: noon_error_response.result_code.to_string(),
message: noon_error_response.class_description,
reason: Some(noon_error_response.message),
- attempt_status: None,
+ attempt_status,
connector_transaction_id: None,
})
}