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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connector): [Zen][ACI] Error handling and Mapping (#1436)
SamraatBansal8a4f4a4c307d
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rsindex cdda109caa..01782f8ae1 100644--- a/crates/router/src/connector/aci/transformers.rs+++ b/crates/router/src/connector/aci/transformers.rs@@ -405,7 +405,7 @@ pub struct ResultCode {#[derive(Default, Debug, Clone, Deserialize, PartialEq, Eq)]pub struct ErrorParameters {pub(super) name: String,- pub(super) value: String,+ pub(super) value: Option<String>,pub(super) message: String,}diff --git a/crates/router/src/connector/zen.rs b/crates/router/src/connector/zen.rsindex c5824ad1ed..e6429bde56 100644--- a/crates/router/src/connector/zen.rs+++ b/crates/router/src/connector/zen.rs@@ -12,6 +12,7 @@ use super::utils::RefundsRequestData;use crate::{configs::settings,connector::utils as conn_utils,+ consts,core::{errors::{self, CustomResult},payments,@@ -110,8 +111,18 @@ impl ConnectorCommon for Zen {Ok(ErrorResponse {status_code: res.status_code,- code: response.error.code,- message: response.error.message,+ code: response+ .error+ .clone()+ .map_or(consts::NO_ERROR_CODE.to_string(), |error| error.code),+ message: response.error.map_or_else(+ || {+ response+ .message+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string())+ },+ |error| error.message,+ ),reason: None,})}diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rsindex 2d228cf393..10fed2a2c8 100644--- a/crates/router/src/connector/zen/transformers.rs+++ b/crates/router/src/connector/zen/transformers.rs@@ -725,10 +725,11 @@ pub enum ZenWebhookTxnType {#[derive(Debug, Deserialize)]pub struct ZenErrorResponse {- pub error: ZenErrorBody,+ pub error: Option<ZenErrorBody>,+ pub message: Option<String>,}-#[derive(Debug, Deserialize)]+#[derive(Debug, Deserialize, Clone)]pub struct ZenErrorBody {pub message: String,pub code: String,