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): [CYBERSOURCE] fix incorrect consumer authentication information fields (#8927)
Debarati Ghatak07a6271b76f6
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rsindex f080a76b05..ca41d12e9b 100644--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs@@ -335,7 +335,6 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {))?}};- let cavv_algorithm = Some("2".to_string());let processing_information = ProcessingInformation {capture: Some(false),@@ -345,7 +344,6 @@ impl TryFrom<&SetupMandateRouterData> for CybersourceZeroMandateRequest {authorization_options,commerce_indicator: String::from("internet"),payment_solution: solution.map(String::from),- cavv_algorithm,};Ok(Self {processing_information,@@ -379,7 +377,6 @@ pub struct ProcessingInformation {capture: Option<bool>,capture_options: Option<CaptureOptions>,payment_solution: Option<String>,- cavv_algorithm: Option<String>,}#[derive(Debug, Serialize)]@@ -425,13 +422,15 @@ pub struct CybersourceConsumerAuthInformation {/// This field indicates the authentication type or challenge presented to the cardholder at checkout.challenge_code: Option<String>,/// This field indicates the reason for payer authentication response status. It is only supported for secure transactions in France.- pares_status_reason: Option<String>,+ signed_pares_status_reason: Option<String>,/// This field indicates the reason why strong authentication was cancelled. It is only supported for secure transactions in France.challenge_cancel_code: Option<String>,/// This field indicates the score calculated by the 3D Securing platform. It is only supported for secure transactions in France.network_score: Option<u32>,/// This is the transaction ID generated by the access control server. This field is supported only for secure transactions in France.acs_transaction_id: Option<String>,+ /// This is the algorithm for generating a cardholder authentication verification value (CAVV) or universal cardholder authentication field (UCAF) data.+ cavv_algorithm: Option<String>,}#[derive(Debug, Serialize)]@@ -1007,11 +1006,6 @@ impl.map(|eci| get_commerce_indicator_for_external_authentication(network, eci))});- // The 3DS Server might not include the `cavvAlgorithm` field in the challenge response.- // In such cases, we default to "2", which represents the CVV with Authentication Transaction Number (ATN) algorithm.- // This is the most commonly used value for 3DS 2.0 transactions (e.g., Visa, Mastercard).- let cavv_algorithm = Some("2".to_string());-Ok(Self {capture: Some(matches!(item.router_data.request.capture_method,@@ -1024,7 +1018,6 @@ implcapture_options: None,commerce_indicator: commerce_indicator_for_external_authentication.unwrap_or(commerce_indicator),- cavv_algorithm,})}}@@ -1121,7 +1114,6 @@ impl} else {(None, None, None)};- let cavv_algorithm = Some("2".to_string());Ok(Self {capture: Some(matches!(@@ -1137,7 +1129,6 @@ impl.indicator.to_owned().unwrap_or(String::from("internet")),- cavv_algorithm,})}}@@ -1456,6 +1447,11 @@ impl.and_then(|exts| extract_score_id(&exts))});+ // The 3DS Server might not include the `cavvAlgorithm` field in the challenge response.+ // In such cases, we default to "2", which represents the CVV with Authentication Transaction Number (ATN) algorithm.+ // This is the most commonly used value for 3DS 2.0 transactions (e.g., Visa, Mastercard).+ let cavv_algorithm = Some("2".to_string());+CybersourceConsumerAuthInformation {pares_status,ucaf_collection_indicator,@@ -1473,10 +1469,11 @@ implauthentication_date,effective_authentication_type,challenge_code: authn_data.challenge_code.clone(),- pares_status_reason: authn_data.challenge_code_reason.clone(),+ signed_pares_status_reason: authn_data.challenge_code_reason.clone(),challenge_cancel_code: authn_data.challenge_cancel.clone(),network_score,acs_transaction_id: authn_data.acs_trans_id.clone(),+ cavv_algorithm,}});@@ -1577,6 +1574,8 @@ impl.and_then(|exts| extract_score_id(&exts))});+ let cavv_algorithm = Some("2".to_string());+CybersourceConsumerAuthInformation {pares_status,ucaf_collection_indicator,@@ -1594,10 +1593,11 @@ implauthentication_date,effective_authentication_type,challenge_code: authn_data.challenge_code.clone(),- pares_status_reason: authn_data.challenge_code_reason.clone(),+ signed_pares_status_reason: authn_data.challenge_code_reason.clone(),challenge_cancel_code: authn_data.challenge_cancel.clone(),network_score,acs_transaction_id: authn_data.acs_trans_id.clone(),+ cavv_algorithm,}});@@ -1702,6 +1702,8 @@ impl.and_then(|exts| extract_score_id(&exts))});+ let cavv_algorithm = Some("2".to_string());+CybersourceConsumerAuthInformation {pares_status,ucaf_collection_indicator,@@ -1719,10 +1721,11 @@ implauthentication_date,effective_authentication_type,challenge_code: authn_data.challenge_code.clone(),- pares_status_reason: authn_data.challenge_code_reason.clone(),+ signed_pares_status_reason: authn_data.challenge_code_reason.clone(),challenge_cancel_code: authn_data.challenge_cancel.clone(),network_score,acs_transaction_id: authn_data.acs_trans_id.clone(),+ cavv_algorithm,}});@@ -1907,10 +1910,11 @@ implauthentication_date: None,effective_authentication_type: None,challenge_code: None,- pares_status_reason: None,+ signed_pares_status_reason: None,challenge_cancel_code: None,network_score: None,acs_transaction_id: None,+ cavv_algorithm: None,});let merchant_defined_information = item@@ -2014,10 +2018,11 @@ implauthentication_date: None,effective_authentication_type: None,challenge_code: None,- pares_status_reason: None,+ signed_pares_status_reason: None,challenge_cancel_code: None,network_score: None,acs_transaction_id: None,+ cavv_algorithm: None,}),merchant_defined_information,})@@ -2166,10 +2171,11 @@ implauthentication_date: None,effective_authentication_type: None,challenge_code: None,- pares_status_reason: None,+ signed_pares_status_reason: None,challenge_cancel_code: None,network_score: None,acs_transaction_id: None,+ cavv_algorithm: None,}),merchant_defined_information,})@@ -2384,10 +2390,11 @@ impl TryFrom<&CybersourceRouterData<&PaymentsAuthorizeRouterData>> for Cybersourauthentication_date: None,effective_authentication_type: None,challenge_code: None,- pares_status_reason: None,+ signed_pares_status_reason: None,challenge_cancel_code: None,network_score: None,acs_transaction_id: None,+ cavv_algorithm: None,},),})@@ -2658,7 +2665,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>).then_some(true);- let cavv_algorithm = Some("2".to_string());Ok(Self {processing_information: ProcessingInformation {capture_options: Some(CaptureOptions {@@ -2672,7 +2678,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsCaptureRouterData>>capture: None,commerce_indicator: String::from("internet"),payment_solution: None,- cavv_algorithm,},order_information: OrderInformationWithBill {amount_details: Amount {@@ -2698,7 +2703,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>) -> Result<Self, Self::Error> {let connector_merchant_config =CybersourceConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?;- let cavv_algorithm = Some("2".to_string());Ok(Self {processing_information: ProcessingInformation {@@ -2722,7 +2726,6 @@ impl TryFrom<&CybersourceRouterData<&PaymentsIncrementalAuthorizationRouterData>capture: None,capture_options: None,payment_solution: None,- cavv_algorithm,},order_information: OrderInformationIncrementalAuthorization {amount_details: AdditionalAmount {