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(connector): [AUTHORIZEDOTNET] error for customer already exists refactored (#8866)
sweta-sharma76d275e51818
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rsindex c032b78f45..db05933e9e 100644--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs@@ -592,7 +592,7 @@ pub struct AuthorizedotnetSetupMandateResponse {#[derive(Debug, Clone, Deserialize, Serialize)]#[serde(rename_all = "camelCase")]pub struct AuthorizedotnetCustomerResponse {- customer_profile_id: String,+ customer_profile_id: Option<String>,#[serde(default, skip_serializing_if = "Vec::is_empty")]customer_payment_profile_id_list: Vec<String>,#[serde(default, skip_serializing_if = "Vec::is_empty")]@@ -607,14 +607,21 @@ impl<F, T> TryFrom<ResponseRouterData<F, AuthorizedotnetCustomerResponse, T, Payfn try_from(item: ResponseRouterData<F, AuthorizedotnetCustomerResponse, T, PaymentsResponseData>,) -> Result<Self, Self::Error> {- let connector_customer_id = item.response.customer_profile_id.clone();match item.response.messages.result_code {- ResultCode::Ok => Ok(Self {- response: Ok(PaymentsResponseData::ConnectorCustomerResponse {- connector_customer_id,+ ResultCode::Ok => match item.response.customer_profile_id.clone() {+ Some(connector_customer_id) => Ok(Self {+ response: Ok(PaymentsResponseData::ConnectorCustomerResponse {+ connector_customer_id,+ }),+ ..item.data}),- ..item.data- }),+ None => Err(+ errors::ConnectorError::UnexpectedResponseError(bytes::Bytes::from(+ "Missing customer profile id from Authorizedotnet".to_string(),+ ))+ .into(),+ ),+ },ResultCode::Error => {let error_message = item.response.messages.message.first();let error_code = error_message.map(|error| error.code.clone());