From cb08ca1b21ad3ad6b423a70b00730ec27b1b74ab Mon Sep 17 00:00:00 2001 From: DEEPANSHU BANSAL <41580413+deepanshu-iiitu@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:48:40 +0530 Subject: [PATCH] =?UTF-8?q?feat(connector):=20[BOA/CYBERSOURCE]=20Fix=20St?= =?UTF-8?q?atus=20Mapping=20for=20Terminal=20St=E2=80=A6=20(#3031)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../router/src/connector/bankofamerica/transformers.rs | 10 ++++++++-- .../router/src/connector/cybersource/transformers.rs | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs index a6fa8652b27d..7456895c8a49 100644 --- a/crates/router/src/connector/bankofamerica/transformers.rs +++ b/crates/router/src/connector/bankofamerica/transformers.rs @@ -277,11 +277,18 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus { | BankofamericaPaymentStatus::AuthorizedPendingReview => { if auto_capture { // Because BankOfAmerica will return Payment Status as Authorized even in AutoCapture Payment - Self::Pending + Self::Charged } else { Self::Authorized } } + BankofamericaPaymentStatus::Pending => { + if auto_capture { + Self::Charged + } else { + Self::Pending + } + } BankofamericaPaymentStatus::Succeeded | BankofamericaPaymentStatus::Transmitted => { Self::Charged } @@ -291,7 +298,6 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus { BankofamericaPaymentStatus::Failed | BankofamericaPaymentStatus::Declined => { Self::Failure } - BankofamericaPaymentStatus::Pending => Self::Pending, } } } diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 0f721a054614..89b9e9111b56 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -660,8 +660,9 @@ pub struct ApplicationInformation { fn get_payment_status(is_capture: bool, status: enums::AttemptStatus) -> enums::AttemptStatus { let is_authorized = matches!(status, enums::AttemptStatus::Authorized); - if is_capture && is_authorized { - return enums::AttemptStatus::Pending; + let is_pending = matches!(status, enums::AttemptStatus::Pending); + if is_capture && (is_authorized || is_pending) { + return enums::AttemptStatus::Charged; } status }