feat(connector): [BANKOFAMERICA] PSYNC Bugfix (#2897)

This commit is contained in:
DEEPANSHU BANSAL
2023-11-17 21:38:52 +05:30
committed by GitHub
parent 0a88336b44
commit bdcc138e8d

View File

@ -273,7 +273,8 @@ pub enum BankofamericaPaymentStatus {
impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus { impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
fn foreign_from((status, auto_capture): (BankofamericaPaymentStatus, bool)) -> Self { fn foreign_from((status, auto_capture): (BankofamericaPaymentStatus, bool)) -> Self {
match status { match status {
BankofamericaPaymentStatus::Authorized => { BankofamericaPaymentStatus::Authorized
| BankofamericaPaymentStatus::AuthorizedPendingReview => {
if auto_capture { if auto_capture {
// Because BankOfAmerica will return Payment Status as Authorized even in AutoCapture Payment // Because BankOfAmerica will return Payment Status as Authorized even in AutoCapture Payment
Self::Pending Self::Pending
@ -281,7 +282,6 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
Self::Authorized Self::Authorized
} }
} }
BankofamericaPaymentStatus::AuthorizedPendingReview => Self::Authorized,
BankofamericaPaymentStatus::Succeeded | BankofamericaPaymentStatus::Transmitted => { BankofamericaPaymentStatus::Succeeded | BankofamericaPaymentStatus::Transmitted => {
Self::Charged Self::Charged
} }
@ -321,7 +321,7 @@ pub struct BankOfAmericaErrorInformationResponse {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct BankOfAmericaErrorInformation { pub struct BankOfAmericaErrorInformation {
reason: Option<String>, reason: Option<String>,
message: String, message: Option<String>,
} }
impl<F> impl<F>
@ -369,7 +369,10 @@ impl<F>
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self { BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
response: Err(types::ErrorResponse { response: Err(types::ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(), 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, reason: error_response.error_information.reason,
status_code: item.http_code, status_code: item.http_code,
attempt_status: None, attempt_status: None,
@ -422,7 +425,10 @@ impl<F>
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self { BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
response: Err(types::ErrorResponse { response: Err(types::ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(), 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, reason: error_response.error_information.reason,
status_code: item.http_code, status_code: item.http_code,
attempt_status: None, attempt_status: None,
@ -475,7 +481,10 @@ impl<F>
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self { BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
response: Err(types::ErrorResponse { response: Err(types::ErrorResponse {
code: consts::NO_ERROR_CODE.to_string(), 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, reason: error_response.error_information.reason,
status_code: item.http_code, status_code: item.http_code,
attempt_status: None, attempt_status: None,