Skip to content

Commit

Permalink
feat(connector): [BOA/CYBERSOURCE] Fix Status Mapping for Terminal St… (
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshu-iiitu authored and SanchithHegde committed Dec 6, 2023
1 parent 29b2e4c commit cb08ca1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions crates/router/src/connector/bankofamerica/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -291,7 +298,6 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
BankofamericaPaymentStatus::Failed | BankofamericaPaymentStatus::Declined => {
Self::Failure
}
BankofamericaPaymentStatus::Pending => Self::Pending,
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions crates/router/src/connector/cybersource/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit cb08ca1

Please sign in to comment.