Skip to content

Commit

Permalink
feat(connector): [BANKOFAMERICA] PSYNC Bugfix (#2897)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshu-iiitu authored Nov 17, 2023
1 parent 0a88336 commit bdcc138
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions crates/router/src/connector/bankofamerica/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ pub enum BankofamericaPaymentStatus {
impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
fn foreign_from((status, auto_capture): (BankofamericaPaymentStatus, bool)) -> Self {
match status {
BankofamericaPaymentStatus::Authorized => {
BankofamericaPaymentStatus::Authorized
| BankofamericaPaymentStatus::AuthorizedPendingReview => {
if auto_capture {
// Because BankOfAmerica will return Payment Status as Authorized even in AutoCapture Payment
Self::Pending
} else {
Self::Authorized
}
}
BankofamericaPaymentStatus::AuthorizedPendingReview => Self::Authorized,
BankofamericaPaymentStatus::Succeeded | BankofamericaPaymentStatus::Transmitted => {
Self::Charged
}
Expand Down Expand Up @@ -321,7 +321,7 @@ pub struct BankOfAmericaErrorInformationResponse {
#[derive(Debug, Deserialize)]
pub struct BankOfAmericaErrorInformation {
reason: Option<String>,
message: String,
message: Option<String>,
}

impl<F>
Expand Down Expand Up @@ -369,7 +369,10 @@ impl<F>
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
response: Err(types::ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(),
message: error_response.error_information.message,
message: error_response
.error_information
.message
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
reason: error_response.error_information.reason,
status_code: item.http_code,
attempt_status: None,
Expand Down Expand Up @@ -422,7 +425,10 @@ impl<F>
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
response: Err(types::ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(),
message: error_response.error_information.message,
message: error_response
.error_information
.message
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
reason: error_response.error_information.reason,
status_code: item.http_code,
attempt_status: None,
Expand Down Expand Up @@ -475,7 +481,10 @@ impl<F>
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
response: Err(types::ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(),
message: error_response.error_information.message,
message: error_response
.error_information
.message
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
reason: error_response.error_information.reason,
status_code: item.http_code,
attempt_status: None,
Expand Down

0 comments on commit bdcc138

Please sign in to comment.