Skip to content

Commit bdcc138

Browse files
feat(connector): [BANKOFAMERICA] PSYNC Bugfix (#2897)
1 parent 0a88336 commit bdcc138

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

crates/router/src/connector/bankofamerica/transformers.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,15 @@ pub enum BankofamericaPaymentStatus {
273273
impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
274274
fn foreign_from((status, auto_capture): (BankofamericaPaymentStatus, bool)) -> Self {
275275
match status {
276-
BankofamericaPaymentStatus::Authorized => {
276+
BankofamericaPaymentStatus::Authorized
277+
| BankofamericaPaymentStatus::AuthorizedPendingReview => {
277278
if auto_capture {
278279
// Because BankOfAmerica will return Payment Status as Authorized even in AutoCapture Payment
279280
Self::Pending
280281
} else {
281282
Self::Authorized
282283
}
283284
}
284-
BankofamericaPaymentStatus::AuthorizedPendingReview => Self::Authorized,
285285
BankofamericaPaymentStatus::Succeeded | BankofamericaPaymentStatus::Transmitted => {
286286
Self::Charged
287287
}
@@ -321,7 +321,7 @@ pub struct BankOfAmericaErrorInformationResponse {
321321
#[derive(Debug, Deserialize)]
322322
pub struct BankOfAmericaErrorInformation {
323323
reason: Option<String>,
324-
message: String,
324+
message: Option<String>,
325325
}
326326

327327
impl<F>
@@ -369,7 +369,10 @@ impl<F>
369369
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
370370
response: Err(types::ErrorResponse {
371371
code: consts::NO_ERROR_CODE.to_string(),
372-
message: error_response.error_information.message,
372+
message: error_response
373+
.error_information
374+
.message
375+
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
373376
reason: error_response.error_information.reason,
374377
status_code: item.http_code,
375378
attempt_status: None,
@@ -422,7 +425,10 @@ impl<F>
422425
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
423426
response: Err(types::ErrorResponse {
424427
code: consts::NO_ERROR_CODE.to_string(),
425-
message: error_response.error_information.message,
428+
message: error_response
429+
.error_information
430+
.message
431+
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
426432
reason: error_response.error_information.reason,
427433
status_code: item.http_code,
428434
attempt_status: None,
@@ -475,7 +481,10 @@ impl<F>
475481
BankOfAmericaPaymentsResponse::ErrorInformation(error_response) => Ok(Self {
476482
response: Err(types::ErrorResponse {
477483
code: consts::NO_ERROR_CODE.to_string(),
478-
message: error_response.error_information.message,
484+
message: error_response
485+
.error_information
486+
.message
487+
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
479488
reason: error_response.error_information.reason,
480489
status_code: item.http_code,
481490
attempt_status: None,

0 commit comments

Comments
 (0)