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
feat(connector): [Noon] add error response handling in payments response (#1494)
SamraatBansal82545555d79d
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rsindex d98ad9c135..020aa23188 100644--- a/crates/router/src/connector/noon/transformers.rs+++ b/crates/router/src/connector/noon/transformers.rs@@ -7,7 +7,7 @@ use crate::{},core::errors,services,- types::{self, api, storage::enums},+ types::{self, api, storage::enums, ErrorResponse},};// These needs to be accepted from SDK, need to be done after 1.0.0 stability as API contract will change@@ -280,6 +280,8 @@ pub struct NoonSubscriptionResponse {pub struct NoonPaymentsOrderResponse {status: NoonPaymentStatus,id: u64,+ error_code: u64,+ error_message: Option<String>,}#[derive(Debug, Deserialize)]@@ -324,17 +326,24 @@ impl<F, T>connector_mandate_id: Some(subscription_data.identifier),payment_method_id: None,});+ let order = item.response.result.order;Ok(Self {- status: enums::AttemptStatus::from(item.response.result.order.status),- response: Ok(types::PaymentsResponseData::TransactionResponse {- resource_id: types::ResponseId::ConnectorTransactionId(- item.response.result.order.id.to_string(),- ),- redirection_data,- mandate_reference,- connector_metadata: None,- network_txn_id: None,- }),+ status: enums::AttemptStatus::from(order.status),+ response: match order.error_message {+ Some(error_message) => Err(ErrorResponse {+ code: order.error_code.to_string(),+ message: error_message.clone(),+ reason: Some(error_message),+ status_code: item.http_code,+ }),+ _ => Ok(types::PaymentsResponseData::TransactionResponse {+ resource_id: types::ResponseId::ConnectorTransactionId(order.id.to_string()),+ redirection_data,+ mandate_reference,+ connector_metadata: None,+ network_txn_id: None,+ }),+ },..item.data})}