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): [Trustpay] handle errors fields as optional in TrustpayErrorResponse object (#1514)
Arjun Karthikefe1ed9b770d
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rsindex 3b6094c0c8..a38298eb44 100644--- a/crates/router/src/connector/trustpay.rs+++ b/crates/router/src/connector/trustpay.rs@@ -112,8 +112,16 @@ impl ConnectorCommon for Trustpay {Ok(ErrorResponse {status_code: res.status_code,code: response.status.to_string(),- message: format!("{:?}", response.errors.first().unwrap_or(&default_error)),- reason: Some(format!("{:?}", response.errors)),+ message: format!(+ "{:?}",+ response+ .errors+ .as_ref()+ .unwrap_or(&vec![])+ .first()+ .unwrap_or(&default_error)+ ),+ reason: response.errors.map(|errors| format!("{:?}", errors)),})}}diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rsindex ffb84059f1..011f6029ee 100644--- a/crates/router/src/connector/trustpay/transformers.rs+++ b/crates/router/src/connector/trustpay/transformers.rs@@ -1290,7 +1290,7 @@ pub struct Errors {pub struct TrustpayErrorResponse {pub status: i64,pub description: Option<String>,- pub errors: Vec<Errors>,+ pub errors: Option<Vec<Errors>>,}#[derive(Deserialize)]