Skip to content

Commit

Permalink
refactor(connector): [BOA/CYBS] add customer token for mandates and r…
Browse files Browse the repository at this point in the history
…efactor psync (#4815)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
AkshayaFoiger and hyperswitch-bot[bot] authored Jun 5, 2024
1 parent 377d6ea commit 3d53fd0
Show file tree
Hide file tree
Showing 7 changed files with 649 additions and 331 deletions.
7 changes: 7 additions & 0 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ debit = { currency = "USD" }
apple_pay = { currency = "USD" }
google_pay = { currency = "USD" }


[pm_filters.cybersource]
credit = { currency = "USD" }
debit = { currency = "USD" }
apple_pay = { currency = "USD" }
google_pay = { currency = "USD" }

[pm_filters.braintree]
paypal.currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,NOK,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD"

Expand Down
6 changes: 6 additions & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ debit = { currency = "USD" }
apple_pay = { currency = "USD" }
google_pay = { currency = "USD" }

[pm_filters.cybersource]
credit = { currency = "USD" }
debit = { currency = "USD" }
apple_pay = { currency = "USD" }
google_pay = { currency = "USD" }

[pm_filters.braintree]
paypal.currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,NOK,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD"

Expand Down
7 changes: 7 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ debit = { currency = "USD" }
apple_pay = { currency = "USD" }
google_pay = { currency = "USD" }


[pm_filters.cybersource]
credit = { currency = "USD" }
debit = { currency = "USD" }
apple_pay = { currency = "USD" }
google_pay = { currency = "USD" }

[pm_filters.braintree]
paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,NOK,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }
credit = { not_available_flows = { capture_method = "manual" } }
Expand Down
66 changes: 45 additions & 21 deletions crates/router/src/connector/bankofamerica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,33 +211,57 @@ impl ConnectorCommon for Bankofamerica {
};
match response {
transformers::BankOfAmericaErrorResponse::StandardError(response) => {
let (code, connector_reason) = match response.error_information {
Some(ref error_info) => (error_info.reason.clone(), error_info.message.clone()),
None => (
response
.reason
.map_or(consts::NO_ERROR_CODE.to_string(), |reason| {
reason.to_string()
}),
response
.message
.map_or(error_message.to_string(), |message| message),
),
};
let message = match response.details {
Some(details) => details
.iter()
.map(|det| format!("{} : {}", det.field, det.reason))
.collect::<Vec<_>>()
.join(", "),
None => connector_reason.clone(),
let (code, message, reason) = match response.error_information {
Some(ref error_info) => {
let detailed_error_info = error_info.details.as_ref().map(|details| {
details
.iter()
.map(|det| format!("{} : {}", det.field, det.reason))
.collect::<Vec<_>>()
.join(", ")
});
(
error_info.reason.clone(),
error_info.reason.clone(),
transformers::get_error_reason(
Some(error_info.message.clone()),
detailed_error_info,
None,
),
)
}
None => {
let detailed_error_info = response.details.map(|details| {
details
.iter()
.map(|det| format!("{} : {}", det.field, det.reason))
.collect::<Vec<_>>()
.join(", ")
});
(
response
.reason
.clone()
.map_or(consts::NO_ERROR_CODE.to_string(), |reason| {
reason.to_string()
}),
response
.reason
.map_or(error_message.to_string(), |reason| reason.to_string()),
transformers::get_error_reason(
response.message,
detailed_error_info,
None,
),
)
}
};

Ok(ErrorResponse {
status_code: res.status_code,
code,
message,
reason: Some(connector_reason),
reason,
attempt_status: None,
connector_transaction_id: None,
})
Expand Down
Loading

0 comments on commit 3d53fd0

Please sign in to comment.