mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	fix(connector): skip 3DS in network_transaction_id flow for cybersource (#5781)
				
					
				
			This commit is contained in:
		| @ -901,7 +901,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P | |||||||
|     ) -> CustomResult<String, errors::ConnectorError> { |     ) -> CustomResult<String, errors::ConnectorError> { | ||||||
|         if req.is_three_ds() |         if req.is_three_ds() | ||||||
|             && req.request.is_card() |             && req.request.is_card() | ||||||
|             && req.request.connector_mandate_id().is_none() |             && (req.request.connector_mandate_id().is_none() | ||||||
|  |                 && req.request.get_optional_network_transaction_id().is_none()) | ||||||
|             && req.request.authentication_data.is_none() |             && req.request.authentication_data.is_none() | ||||||
|         { |         { | ||||||
|             Ok(format!( |             Ok(format!( | ||||||
| @ -929,7 +930,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P | |||||||
|         ))?; |         ))?; | ||||||
|         if req.is_three_ds() |         if req.is_three_ds() | ||||||
|             && req.request.is_card() |             && req.request.is_card() | ||||||
|             && req.request.connector_mandate_id().is_none() |             && (req.request.connector_mandate_id().is_none() | ||||||
|  |                 && req.request.get_optional_network_transaction_id().is_none()) | ||||||
|             && req.request.authentication_data.is_none() |             && req.request.authentication_data.is_none() | ||||||
|         { |         { | ||||||
|             let connector_req = |             let connector_req = | ||||||
| @ -970,7 +972,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P | |||||||
|     ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> { |     ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> { | ||||||
|         if data.is_three_ds() |         if data.is_three_ds() | ||||||
|             && data.request.is_card() |             && data.request.is_card() | ||||||
|             && data.request.connector_mandate_id().is_none() |             && (data.request.connector_mandate_id().is_none() | ||||||
|  |                 && data.request.get_optional_network_transaction_id().is_none()) | ||||||
|             && data.request.authentication_data.is_none() |             && data.request.authentication_data.is_none() | ||||||
|         { |         { | ||||||
|             let response: cybersource::CybersourceAuthSetupResponse = res |             let response: cybersource::CybersourceAuthSetupResponse = res | ||||||
|  | |||||||
| @ -1043,12 +1043,23 @@ impl | |||||||
|             Err(_) => None, |             Err(_) => None, | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|  |         let security_code = if item | ||||||
|  |             .router_data | ||||||
|  |             .request | ||||||
|  |             .get_optional_network_transaction_id() | ||||||
|  |             .is_some() | ||||||
|  |         { | ||||||
|  |             None | ||||||
|  |         } else { | ||||||
|  |             Some(ccard.card_cvc) | ||||||
|  |         }; | ||||||
|  |  | ||||||
|         let payment_information = PaymentInformation::Cards(Box::new(CardPaymentInformation { |         let payment_information = PaymentInformation::Cards(Box::new(CardPaymentInformation { | ||||||
|             card: Card { |             card: Card { | ||||||
|                 number: ccard.card_number, |                 number: ccard.card_number, | ||||||
|                 expiration_month: ccard.card_exp_month, |                 expiration_month: ccard.card_exp_month, | ||||||
|                 expiration_year: ccard.card_exp_year, |                 expiration_year: ccard.card_exp_year, | ||||||
|                 security_code: Some(ccard.card_cvc), |                 security_code, | ||||||
|                 card_type: card_type.clone(), |                 card_type: card_type.clone(), | ||||||
|             }, |             }, | ||||||
|         })); |         })); | ||||||
|  | |||||||
| @ -763,6 +763,7 @@ pub trait PaymentsAuthorizeRequestData { | |||||||
|     fn get_card(&self) -> Result<domain::Card, Error>; |     fn get_card(&self) -> Result<domain::Card, Error>; | ||||||
|     fn get_return_url(&self) -> Result<String, Error>; |     fn get_return_url(&self) -> Result<String, Error>; | ||||||
|     fn connector_mandate_id(&self) -> Option<String>; |     fn connector_mandate_id(&self) -> Option<String>; | ||||||
|  |     fn get_optional_network_transaction_id(&self) -> Option<String>; | ||||||
|     fn is_mandate_payment(&self) -> bool; |     fn is_mandate_payment(&self) -> bool; | ||||||
|     fn is_customer_initiated_mandate_payment(&self) -> bool; |     fn is_customer_initiated_mandate_payment(&self) -> bool; | ||||||
|     fn get_webhook_url(&self) -> Result<String, Error>; |     fn get_webhook_url(&self) -> Result<String, Error>; | ||||||
| @ -843,6 +844,18 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { | |||||||
|                 Some(payments::MandateReferenceId::NetworkMandateId(_)) | None => None, |                 Some(payments::MandateReferenceId::NetworkMandateId(_)) | None => None, | ||||||
|             }) |             }) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     fn get_optional_network_transaction_id(&self) -> Option<String> { | ||||||
|  |         self.mandate_id | ||||||
|  |             .as_ref() | ||||||
|  |             .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id { | ||||||
|  |                 Some(payments::MandateReferenceId::NetworkMandateId(network_transaction_id)) => { | ||||||
|  |                     Some(network_transaction_id.clone()) | ||||||
|  |                 } | ||||||
|  |                 Some(payments::MandateReferenceId::ConnectorMandateId(_)) | None => None, | ||||||
|  |             }) | ||||||
|  |     } | ||||||
|  |  | ||||||
|     fn is_mandate_payment(&self) -> bool { |     fn is_mandate_payment(&self) -> bool { | ||||||
|         ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) |         ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) | ||||||
|             && self.setup_future_usage.map_or(false, |setup_future_usage| { |             && self.setup_future_usage.map_or(false, |setup_future_usage| { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Shankar Singh C
					Shankar Singh C