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): [Volt] Error handling for auth response (#3187)
Sakil Mostaka51c54d39d36
diff --git a/crates/router/src/connector/volt.rs b/crates/router/src/connector/volt.rsindex f239f59801..bf36a7bff6 100644--- a/crates/router/src/connector/volt.rs+++ b/crates/router/src/connector/volt.rs@@ -223,7 +223,20 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t&self,res: Response,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- self.build_error_response(res)+ // auth error have different structure than common error+ let response: volt::VoltAuthErrorResponse = res+ .response+ .parse_struct("VoltAuthErrorResponse")+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;++ Ok(ErrorResponse {+ status_code: res.status_code,+ code: response.code.to_string(),+ message: response.message.clone(),+ reason: Some(response.message),+ attempt_status: None,+ connector_transaction_id: None,+ })}}diff --git a/crates/router/src/connector/volt/transformers.rs b/crates/router/src/connector/volt/transformers.rsindex cea56feb71..9ee2a3f012 100644--- a/crates/router/src/connector/volt/transformers.rs+++ b/crates/router/src/connector/volt/transformers.rs@@ -410,6 +410,12 @@ pub struct VoltErrorResponse {pub exception: VoltErrorException,}+#[derive(Debug, Deserialize)]+pub struct VoltAuthErrorResponse {+ pub code: u64,+ pub message: String,+}+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]#[serde(rename_all = "camelCase")]pub struct VoltErrorException {