Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connectors): [authorizedotnet] handle psync server maintenance error and pass complete billing address (#10026)
AkshayaFoiger5600887665ce
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rsindex 4a0952d676..1ec9d414bd 100644--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs@@ -45,6 +45,7 @@ use crate::{};const MAX_ID_LENGTH: usize = 20;+const ADDRESS_MAX_LENGTH: usize = 60;fn get_random_string() -> String {Alphanumeric.sample_string(&mut rand::thread_rng(), MAX_ID_LENGTH)@@ -466,7 +467,7 @@ impl TryFrom<&SetupMandateRouterData> for CreateCustomerPaymentProfileRequest {.map(|address| BillTo {first_name: address.first_name.clone(),last_name: address.last_name.clone(),- address: address.line1.clone(),+ address: get_address_line(&address.line1, &address.line2, &address.line3),city: address.city.clone(),state: address.state.clone(),zip: address.zip.clone(),@@ -789,6 +790,14 @@ impl TryFrom<&AuthorizedotnetRouterData<&PaymentsAuthorizeRouterData>>fn try_from(item: &AuthorizedotnetRouterData<&PaymentsAuthorizeRouterData>,) -> Result<Self, Self::Error> {+ if item.router_data.is_three_ds() {+ return Err(errors::ConnectorError::NotSupported {+ message: "3DS flow".to_string(),+ connector: "Authorizedotnet",+ }+ .into());+ };+let merchant_authentication =AuthorizedotnetAuthType::try_from(&item.router_data.connector_auth_type)?;@@ -936,7 +945,7 @@ impl.map(|address| BillTo {first_name: address.first_name.clone(),last_name: address.last_name.clone(),- address: address.line1.clone(),+ address: get_address_line(&address.line1, &address.line2, &address.line3),city: address.city.clone(),state: address.state.clone(),zip: address.zip.clone(),@@ -964,6 +973,28 @@ impl})}}+fn get_address_line(+ address_line1: &Option<Secret<String>>,+ address_line2: &Option<Secret<String>>,+ address_line3: &Option<Secret<String>>,+) -> Option<Secret<String>> {+ for lines in [+ vec![address_line1, address_line2, address_line3],+ vec![address_line1, address_line2],+ ] {+ let combined: String = lines+ .into_iter()+ .flatten()+ .map(|s| s.clone().expose())+ .collect::<Vec<_>>()+ .join(" ");++ if !combined.is_empty() && combined.len() <= ADDRESS_MAX_LENGTH {+ return Some(Secret::new(combined));+ }+ }+ address_line1.clone()+}implTryFrom<(@@ -1112,7 +1143,7 @@ impl.map(|address| BillTo {first_name: address.first_name.clone(),last_name: address.last_name.clone(),- address: address.line1.clone(),+ address: get_address_line(&address.line1, &address.line2, &address.line3),city: address.city.clone(),state: address.state.clone(),zip: address.zip.clone(),@@ -1215,7 +1246,7 @@ impl.map(|address| BillTo {first_name: address.first_name.clone(),last_name: address.last_name.clone(),- address: address.line1.clone(),+ address: get_address_line(&address.line1, &address.line2, &address.line3),city: address.city.clone(),state: address.state.clone(),zip: address.zip.clone(),@@ -2033,13 +2064,14 @@ impl<F, Req> TryFrom<ResponseRouterData<F, AuthorizedotnetSyncResponse, Req, Pay}// E00053 indicates "server too busy"- // If the server is too busy, we return the already available data+ // E00104 indicates "Server in maintenance"+ // If the server is too busy or Server in maintenance, we return the already available dataNone => match item.response.messages.message.iter()- .find(|msg| msg.code == "E00053")+ .find(|msg| msg.code == "E00053" || msg.code == "E00104"){Some(_) => Ok(item.data),None => Ok(Self {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.js b/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.jsindex e81f4b6eff..eebc38d3d3 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Authorizedotnet.js@@ -133,10 +133,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",- payment_method_data: paymentMethodData,+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},@@ -152,10 +155,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",- payment_method_data: paymentMethodData,+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},@@ -326,10 +332,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",- payment_method_data: paymentMethodData,+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},@@ -344,10 +353,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",- payment_method_data: paymentMethodData,+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},@@ -433,10 +445,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",- payment_method_data: paymentMethodData,+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},@@ -451,10 +466,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",- payment_method_data: paymentMethodData,+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},@@ -573,9 +591,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},@@ -687,9 +709,13 @@ export const connectorDetails = {email: generateRandomEmail(),},Response: {- status: 200,+ status: 400,body: {- status: "requires_customer_action",+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_16",+ },},},},