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(transformers): update error reason handling in response transformations (#10313)

Ayush Anand9172d64c872d
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index b7a1634a14..6bd5ef906c 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -1589,7 +1589,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePreAuthenticateRe
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: connector_response_reference_id,
@@ -1709,7 +1709,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthorizeResponse
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: connector_response_reference_id,
@@ -1811,7 +1811,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCaptureResponse>
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: connector_response_reference_id,
@@ -1920,7 +1920,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRegisterResponse>
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: connector_response_reference_id,
@@ -2045,7 +2045,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRepeatEverythingR
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: transaction_id,
@@ -2657,7 +2657,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePostAuthenticateR
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: connector_response_reference_id,
@@ -2936,7 +2936,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthenticateRespo
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: connector_response_reference_id,
@@ -3394,7 +3394,7 @@ impl transformers::ForeignTryFrom<payments_grpc::RefundResponse>
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status: None,
connector_transaction_id: connector_response_reference_id,
@@ -3537,7 +3537,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceVoidResponse>
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: connector_response_reference_id,