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,
|
country: None,
|
||||||
email: email.clone(),
|
email: email.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(address_details
|
Ok(address_details
|
||||||
.and_then(|addr| {
|
.and_then(|addr| {
|
||||||
addr.address.as_ref().map(|addr| BillTo {
|
addr.address.as_ref().map(|addr| {
|
||||||
first_name: addr.first_name.clone(),
|
let administrative_area = addr.to_state_code_as_optional().unwrap_or_else(|_| {
|
||||||
last_name: addr.last_name.clone(),
|
addr.state
|
||||||
address1: addr.line1.clone(),
|
.clone()
|
||||||
locality: addr.city.clone(),
|
.map(|state| Secret::new(format!("{:.20}", state.expose())))
|
||||||
administrative_area: addr.to_state_code_as_optional().ok().flatten(),
|
});
|
||||||
postal_code: addr.zip.clone(),
|
|
||||||
country: addr.country,
|
BillTo {
|
||||||
email,
|
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))
|
.unwrap_or(default_address))
|
||||||
@ -813,6 +822,13 @@ impl
|
|||||||
hyperswitch_domain_models::payment_method_data::Card,
|
hyperswitch_domain_models::payment_method_data::Card,
|
||||||
),
|
),
|
||||||
) -> Result<Self, Self::Error> {
|
) -> 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 email = item.router_data.request.get_email()?;
|
||||||
let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
|
let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
|
||||||
let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
|
let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
|
||||||
@ -2242,6 +2258,13 @@ impl
|
|||||||
hyperswitch_domain_models::payment_method_data::Card,
|
hyperswitch_domain_models::payment_method_data::Card,
|
||||||
),
|
),
|
||||||
) -> Result<Self, Self::Error> {
|
) -> 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 order_information = OrderInformationWithBill::try_from(item)?;
|
||||||
let client_reference_information = ClientReferenceInformation::from(item);
|
let client_reference_information = ClientReferenceInformation::from(item);
|
||||||
let merchant_defined_information =
|
let merchant_defined_information =
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import { getCustomExchange } from "./Modifiers";
|
||||||
|
|
||||||
const successfulNo3DSCardDetails = {
|
const successfulNo3DSCardDetails = {
|
||||||
card_number: "4242424242424242",
|
card_number: "4242424242424242",
|
||||||
card_exp_month: "01",
|
card_exp_month: "01",
|
||||||
@ -112,7 +114,7 @@ export const connectorDetails = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"3DSManualCapture": {
|
"3DSManualCapture": getCustomExchange({
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -122,14 +124,8 @@ export const connectorDetails = {
|
|||||||
customer_acceptance: null,
|
customer_acceptance: null,
|
||||||
setup_future_usage: "on_session",
|
setup_future_usage: "on_session",
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
"3DSAutoCapture": getCustomExchange({
|
||||||
body: {
|
|
||||||
status: "requires_capture",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"3DSAutoCapture": {
|
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -139,13 +135,7 @@ export const connectorDetails = {
|
|||||||
customer_acceptance: null,
|
customer_acceptance: null,
|
||||||
setup_future_usage: "on_session",
|
setup_future_usage: "on_session",
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
|
||||||
body: {
|
|
||||||
status: "requires_customer_action",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
No3DSManualCapture: {
|
No3DSManualCapture: {
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
@ -301,7 +291,7 @@ export const connectorDetails = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
MandateSingleUse3DSAutoCapture: {
|
MandateSingleUse3DSAutoCapture: getCustomExchange({
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -310,14 +300,8 @@ export const connectorDetails = {
|
|||||||
currency: "USD",
|
currency: "USD",
|
||||||
mandate_data: singleUseMandateData,
|
mandate_data: singleUseMandateData,
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
MandateSingleUse3DSManualCapture: getCustomExchange({
|
||||||
body: {
|
|
||||||
status: "succeeded",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MandateSingleUse3DSManualCapture: {
|
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -326,13 +310,7 @@ export const connectorDetails = {
|
|||||||
currency: "USD",
|
currency: "USD",
|
||||||
mandate_data: singleUseMandateData,
|
mandate_data: singleUseMandateData,
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
|
||||||
body: {
|
|
||||||
status: "requires_customer_action",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MandateSingleUseNo3DSAutoCapture: {
|
MandateSingleUseNo3DSAutoCapture: {
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
@ -397,7 +375,7 @@ export const connectorDetails = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
MandateMultiUse3DSAutoCapture: {
|
MandateMultiUse3DSAutoCapture: getCustomExchange({
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -406,14 +384,8 @@ export const connectorDetails = {
|
|||||||
currency: "USD",
|
currency: "USD",
|
||||||
mandate_data: multiUseMandateData,
|
mandate_data: multiUseMandateData,
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
MandateMultiUse3DSManualCapture: getCustomExchange({
|
||||||
body: {
|
|
||||||
status: "requires_capture",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MandateMultiUse3DSManualCapture: {
|
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -422,13 +394,7 @@ export const connectorDetails = {
|
|||||||
currency: "USD",
|
currency: "USD",
|
||||||
mandate_data: multiUseMandateData,
|
mandate_data: multiUseMandateData,
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
|
||||||
body: {
|
|
||||||
status: "requires_capture",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MITAutoCapture: {
|
MITAutoCapture: {
|
||||||
Request: {},
|
Request: {},
|
||||||
Response: {
|
Response: {
|
||||||
@ -659,7 +625,7 @@ export const connectorDetails = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PaymentMethodIdMandate3DSAutoCapture: {
|
PaymentMethodIdMandate3DSAutoCapture: getCustomExchange({
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -677,14 +643,8 @@ export const connectorDetails = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
PaymentMethodIdMandate3DSManualCapture: getCustomExchange({
|
||||||
body: {
|
|
||||||
status: "requires_customer_action",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
PaymentMethodIdMandate3DSManualCapture: {
|
|
||||||
Request: {
|
Request: {
|
||||||
payment_method: "card",
|
payment_method: "card",
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
@ -701,13 +661,7 @@ export const connectorDetails = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Response: {
|
}),
|
||||||
status: 200,
|
|
||||||
body: {
|
|
||||||
status: "requires_customer_action",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
pm_list: {
|
pm_list: {
|
||||||
PmListResponse: {
|
PmListResponse: {
|
||||||
|
|||||||
Reference in New Issue
Block a user