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): [Powertranz] Fix response handling for https status code other than 200 (#1775)
Arjun Karthik4805a94ab905
diff --git a/crates/router/src/connector/powertranz.rs b/crates/router/src/connector/powertranz.rsindex bab02f5e23..252f847988 100644--- a/crates/router/src/connector/powertranz.rs+++ b/crates/router/src/connector/powertranz.rs@@ -110,26 +110,13 @@ impl ConnectorCommon for Powertranz {&self,res: Response,) -> CustomResult<ErrorResponse, errors::ConnectorError> {- let response: powertranz::PowertranzErrorResponse = res- .response- .parse_struct("PowertranzErrorResponse")- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;- let first_error = response.errors.first();- let code = first_error.map(|error| error.code.clone());- let message = first_error.map(|error| error.message.clone());-+ // For error scenerios connector respond with 200 http status code and error response object in response+ // For http status code other than 200 they send empty response backOk(ErrorResponse {status_code: res.status_code,- code: code.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),- message: message.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),- reason: Some(- response- .errors- .iter()- .map(|error| format!("{} : {}", error.code, error.message))- .collect::<Vec<_>>()- .join(", "),- ),+ code: consts::NO_ERROR_CODE.to_string(),+ message: consts::NO_ERROR_MESSAGE.to_string(),+ reason: None,})}}