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
refactor(connector): [noon] enhance response status mapping (#2575)
SamraatBansal053c79d248df
diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rsindex a8800ebcbe..156e10928d 100644--- a/crates/router/src/connector/noon.rs+++ b/crates/router/src/connector/noon.rs@@ -134,8 +134,8 @@ impl ConnectorCommon for Noon {Ok(ErrorResponse {status_code: res.status_code,code: response.result_code.to_string(),- message: response.message,- reason: Some(response.class_description),+ message: response.class_description,+ reason: Some(response.message),})}}diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rsindex 21a6501bb5..9d727d3ce8 100644--- a/crates/router/src/connector/noon/transformers.rs+++ b/crates/router/src/connector/noon/transformers.rs@@ -9,7 +9,7 @@ use crate::{},core::errors,services,- types::{self, api, storage::enums, ErrorResponse},+ types::{self, api, storage::enums, transformers::ForeignFrom, ErrorResponse},utils,};@@ -356,35 +356,53 @@ impl TryFrom<&types::ConnectorAuthType> for NoonAuthType {#[serde(rename_all = "SCREAMING_SNAKE_CASE")]#[strum(serialize_all = "UPPERCASE")]pub enum NoonPaymentStatus {+ Initiated,Authorized,Captured,PartiallyCaptured,- Reversed,- Cancelled,+ PartiallyRefunded,+ PaymentInfoAdded,#[serde(rename = "3DS_ENROLL_INITIATED")]ThreeDsEnrollInitiated,#[serde(rename = "3DS_ENROLL_CHECKED")]ThreeDsEnrollChecked,- Failed,+ #[serde(rename = "3DS_RESULT_VERIFIED")]+ ThreeDsResultVerified,+ MarkedForReview,+ Authenticated,+ PartiallyReversed,#[default]Pending,+ Cancelled,+ Failed,+ Refunded,Expired,+ Reversed,Rejected,+ Locked,}-impl From<NoonPaymentStatus> for enums::AttemptStatus {- fn from(item: NoonPaymentStatus) -> Self {+impl ForeignFrom<(NoonPaymentStatus, Self)> for enums::AttemptStatus {+ fn foreign_from(data: (NoonPaymentStatus, Self)) -> Self {+ let (item, current_status) = data;match item {NoonPaymentStatus::Authorized => Self::Authorized,- NoonPaymentStatus::Captured => Self::Charged,- NoonPaymentStatus::PartiallyCaptured => Self::PartialCharged,- NoonPaymentStatus::Reversed => Self::Voided,+ NoonPaymentStatus::Captured+ | NoonPaymentStatus::PartiallyCaptured+ | NoonPaymentStatus::PartiallyRefunded+ | NoonPaymentStatus::Refunded => Self::Charged,+ NoonPaymentStatus::Reversed | NoonPaymentStatus::PartiallyReversed => Self::Voided,NoonPaymentStatus::Cancelled | NoonPaymentStatus::Expired => Self::AuthenticationFailed,NoonPaymentStatus::ThreeDsEnrollInitiated | NoonPaymentStatus::ThreeDsEnrollChecked => {Self::AuthenticationPending}+ NoonPaymentStatus::ThreeDsResultVerified => Self::AuthenticationSuccessful,NoonPaymentStatus::Failed | NoonPaymentStatus::Rejected => Self::Failure,- NoonPaymentStatus::Pending => Self::Pending,+ NoonPaymentStatus::Pending | NoonPaymentStatus::MarkedForReview => Self::Pending,+ NoonPaymentStatus::Initiated+ | NoonPaymentStatus::PaymentInfoAdded+ | NoonPaymentStatus::Authenticated => Self::Started,+ NoonPaymentStatus::Locked => current_status,}}}@@ -448,7 +466,7 @@ impl<F, T>});let order = item.response.result.order;Ok(Self {- status: enums::AttemptStatus::from(order.status),+ status: enums::AttemptStatus::foreign_from((order.status, item.data.status)),response: match order.error_message {Some(error_message) => Err(ErrorResponse {code: order.error_code.to_string(),