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): Fix Dwolla Error Handling (#10344)

awasthi2122a935789b39
diff --git a/crates/hyperswitch_connectors/src/connectors/dwolla.rs b/crates/hyperswitch_connectors/src/connectors/dwolla.rs
index 9cd83ca887..3d8f8df4df 100644
--- a/crates/hyperswitch_connectors/src/connectors/dwolla.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dwolla.rs
@@ -154,11 +154,10 @@ impl ConnectorCommon for Dwolla {
code: response.code,
message: response.message,
reason: response
- ._embedded
+ .embedded
.as_ref()
- .and_then(|errors_vec| errors_vec.first())
- .and_then(|details| details.errors.first())
- .and_then(|err_detail| err_detail.message.clone()),
+ .and_then(|errors_vec| errors_vec.errors.first())
+ .and_then(|details| details.message.clone()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
@@ -466,11 +465,10 @@ impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, Pay
code: response.code,
message: response.message,
reason: response
- ._embedded
+ .embedded
.as_ref()
- .and_then(|errors_vec| errors_vec.first())
- .and_then(|details| details.errors.first())
- .and_then(|err_detail| err_detail.message.clone()),
+ .and_then(|errors_vec| errors_vec.errors.first())
+ .and_then(|details| details.message.clone()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
diff --git a/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs b/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs
index bcb32027bb..96093cc9f5 100644
--- a/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs
@@ -486,7 +486,8 @@ impl From<DwollaPaymentStatus> for enums::RefundStatus {
pub struct DwollaErrorResponse {
pub code: String,
pub message: String,
- pub _embedded: Option<Vec<DwollaErrorDetails>>,
+ #[serde(rename = "_embedded")]
+ pub embedded: Option<DwollaErrorDetails>,
pub reason: Option<String>,
}