mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
fix(connector): [BOA] throw unsupported error incase of 3DS cards and limit administrative area length to 20 characters (#7174)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -510,17 +510,26 @@ fn build_bill_to(
|
||||
country: None,
|
||||
email: email.clone(),
|
||||
};
|
||||
|
||||
Ok(address_details
|
||||
.and_then(|addr| {
|
||||
addr.address.as_ref().map(|addr| BillTo {
|
||||
first_name: addr.first_name.clone(),
|
||||
last_name: addr.last_name.clone(),
|
||||
address1: addr.line1.clone(),
|
||||
locality: addr.city.clone(),
|
||||
administrative_area: addr.to_state_code_as_optional().ok().flatten(),
|
||||
postal_code: addr.zip.clone(),
|
||||
country: addr.country,
|
||||
email,
|
||||
addr.address.as_ref().map(|addr| {
|
||||
let administrative_area = addr.to_state_code_as_optional().unwrap_or_else(|_| {
|
||||
addr.state
|
||||
.clone()
|
||||
.map(|state| Secret::new(format!("{:.20}", state.expose())))
|
||||
});
|
||||
|
||||
BillTo {
|
||||
first_name: addr.first_name.clone(),
|
||||
last_name: addr.last_name.clone(),
|
||||
address1: addr.line1.clone(),
|
||||
locality: addr.city.clone(),
|
||||
administrative_area,
|
||||
postal_code: addr.zip.clone(),
|
||||
country: addr.country,
|
||||
email,
|
||||
}
|
||||
})
|
||||
})
|
||||
.unwrap_or(default_address))
|
||||
@ -813,6 +822,13 @@ impl
|
||||
hyperswitch_domain_models::payment_method_data::Card,
|
||||
),
|
||||
) -> Result<Self, Self::Error> {
|
||||
if item.router_data.is_three_ds() {
|
||||
Err(errors::ConnectorError::NotSupported {
|
||||
message: "Card 3DS".to_string(),
|
||||
connector: "BankOfAmerica",
|
||||
})?
|
||||
};
|
||||
|
||||
let email = item.router_data.request.get_email()?;
|
||||
let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
|
||||
let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
|
||||
@ -2242,6 +2258,13 @@ impl
|
||||
hyperswitch_domain_models::payment_method_data::Card,
|
||||
),
|
||||
) -> Result<Self, Self::Error> {
|
||||
if item.is_three_ds() {
|
||||
Err(errors::ConnectorError::NotSupported {
|
||||
message: "Card 3DS".to_string(),
|
||||
connector: "BankOfAmerica",
|
||||
})?
|
||||
};
|
||||
|
||||
let order_information = OrderInformationWithBill::try_from(item)?;
|
||||
let client_reference_information = ClientReferenceInformation::from(item);
|
||||
let merchant_defined_information =
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { getCustomExchange } from "./Modifiers";
|
||||
|
||||
const successfulNo3DSCardDetails = {
|
||||
card_number: "4242424242424242",
|
||||
card_exp_month: "01",
|
||||
@ -112,7 +114,7 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
"3DSManualCapture": {
|
||||
"3DSManualCapture": getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -122,14 +124,8 @@ export const connectorDetails = {
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
"3DSAutoCapture": {
|
||||
}),
|
||||
"3DSAutoCapture": getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -139,13 +135,7 @@ export const connectorDetails = {
|
||||
customer_acceptance: null,
|
||||
setup_future_usage: "on_session",
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
No3DSManualCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
@ -301,7 +291,7 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSAutoCapture: {
|
||||
MandateSingleUse3DSAutoCapture: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -310,14 +300,8 @@ export const connectorDetails = {
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "succeeded",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateSingleUse3DSManualCapture: {
|
||||
}),
|
||||
MandateSingleUse3DSManualCapture: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -326,13 +310,7 @@ export const connectorDetails = {
|
||||
currency: "USD",
|
||||
mandate_data: singleUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
MandateSingleUseNo3DSAutoCapture: {
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
@ -397,7 +375,7 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSAutoCapture: {
|
||||
MandateMultiUse3DSAutoCapture: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -406,14 +384,8 @@ export const connectorDetails = {
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
MandateMultiUse3DSManualCapture: {
|
||||
}),
|
||||
MandateMultiUse3DSManualCapture: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -422,13 +394,7 @@ export const connectorDetails = {
|
||||
currency: "USD",
|
||||
mandate_data: multiUseMandateData,
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_capture",
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
MITAutoCapture: {
|
||||
Request: {},
|
||||
Response: {
|
||||
@ -659,7 +625,7 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
PaymentMethodIdMandate3DSAutoCapture: {
|
||||
PaymentMethodIdMandate3DSAutoCapture: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -677,14 +643,8 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
PaymentMethodIdMandate3DSManualCapture: {
|
||||
}),
|
||||
PaymentMethodIdMandate3DSManualCapture: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "card",
|
||||
payment_method_data: {
|
||||
@ -701,13 +661,7 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
pm_list: {
|
||||
PmListResponse: {
|
||||
|
||||
Reference in New Issue
Block a user