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): [Adyen] Revert adyen fix mit (#10211)
Mrudul Vajpayeea80f25975666
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rsindex ad73e802a9..cbb6309c4e 100644--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs@@ -1928,28 +1928,17 @@ fn get_shopper_statement(item: &PaymentsAuthorizeRouterData) -> Option<String> {fn get_recurring_processing_model(item: &PaymentsAuthorizeRouterData,) -> Result<RecurringDetails, Error> {- // is_migrated_card to be changed intto is_migrated_payment_method to cover all migrated payment methods.- let shopper_reference = Some(match item.is_migrated_card {- Some(true) => match item.get_connector_customer_id() {- Ok(connector_customer_id) => connector_customer_id,- Err(_) => {- let customer_id = item.get_customer_id()?;- format!(- "{}_{}",- item.merchant_id.get_string_repr(),- customer_id.get_string_repr()- )- }- },- _ => {+ let shopper_reference = match item.get_connector_customer_id() {+ Ok(connector_customer_id) => Some(connector_customer_id),+ Err(_) => {let customer_id = item.get_customer_id()?;- format!(+ Some(format!("{}_{}",item.merchant_id.get_string_repr(),customer_id.get_string_repr()- )+ ))}- });+ };match (item.request.setup_future_usage, item.request.off_session) {(Some(storage_enums::FutureUsage::OffSession), _) => {@@ -2133,6 +2122,20 @@ fn get_social_security_number(voucher_data: &VoucherData) -> Option<Secret<Strin}}+fn build_shopper_reference(item: &PaymentsAuthorizeRouterData) -> Option<String> {+ match item.get_connector_customer_id() {+ Ok(connector_customer_id) => Some(connector_customer_id),+ Err(_) => match item.get_customer_id() {+ Ok(customer_id) => Some(format!(+ "{}_{}",+ item.merchant_id.get_string_repr(),+ customer_id.get_string_repr()+ )),+ Err(_) => None,+ },+ }+}+impl TryFrom<(&BankDebitData, &PaymentsAuthorizeRouterData)> for AdyenPaymentMethod<'_> {type Error = Error;fn try_from(@@ -3117,7 +3120,8 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &Card)> for AdyenPlet amount = get_amount_data(item);let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;let shopper_interaction = AdyenShopperInteraction::from(item.router_data);- let (recurring_processing_model, store_payment_method, shopper_reference) =+ let shopper_reference = build_shopper_reference(item.router_data);+ let (recurring_processing_model, store_payment_method, _) =get_recurring_processing_model(item.router_data)?;let browser_info = get_browser_info(item.router_data)?;let billing_address =@@ -3814,7 +3818,8 @@ impllet additional_data = get_additional_data(item.router_data);let country_code = get_country_code(item.router_data.get_optional_billing());let shopper_interaction = AdyenShopperInteraction::from(item.router_data);- let (recurring_processing_model, store_payment_method, shopper_reference) =+ let shopper_reference = build_shopper_reference(item.router_data);+ let (recurring_processing_model, store_payment_method, _) =get_recurring_processing_model(item.router_data)?;let return_url = item.router_data.request.get_router_return_url()?;let shopper_name = get_shopper_name(item.router_data.get_optional_billing());@@ -6433,7 +6438,8 @@ impllet amount = get_amount_data(item);let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;let shopper_interaction = AdyenShopperInteraction::from(item.router_data);- let (recurring_processing_model, store_payment_method, shopper_reference) =+ let shopper_reference = build_shopper_reference(item.router_data);+ let (recurring_processing_model, store_payment_method, _) =get_recurring_processing_model(item.router_data)?;let browser_info = get_browser_info(item.router_data)?;let billing_address =diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rsindex 621775ea76..745107d831 100644--- a/crates/hyperswitch_connectors/src/utils.rs+++ b/crates/hyperswitch_connectors/src/utils.rs@@ -7035,7 +7035,6 @@ pub(crate) fn convert_payment_authorize_router_response<F1, F2, T1, T2>(l2_l3_data: data.l2_l3_data.clone(),minor_amount_capturable: data.minor_amount_capturable,authorized_amount: data.authorized_amount,- is_migrated_card: data.is_migrated_card,}}diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rsindex ea23a04231..59aead2007 100644--- a/crates/hyperswitch_domain_models/src/payment_methods.rs+++ b/crates/hyperswitch_domain_models/src/payment_methods.rs@@ -243,20 +243,6 @@ impl PaymentMethod {}}- #[cfg(feature = "v1")]- pub fn is_migrated_card(&self) -> bool {- self.get_payment_method_type() == Some(storage_enums::PaymentMethod::Card)- && self.locker_id.is_none()- && self.connector_mandate_details.is_some()- }-- #[cfg(feature = "v2")]- pub fn is_migrated_card(&self) -> bool {- self.get_payment_method_type() == Some(storage_enums::PaymentMethod::Card)- && self.locker_id.is_none()- && self.connector_mandate_details.is_some()- }-#[cfg(feature = "v2")]pub fn set_payment_method_type(&mut self, payment_method_type: common_enums::PaymentMethod) {self.payment_method_type = Some(payment_method_type);diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rsindex 3abeb68977..fc9deb950f 100644--- a/crates/hyperswitch_domain_models/src/router_data.rs+++ b/crates/hyperswitch_domain_models/src/router_data.rs@@ -89,7 +89,6 @@ pub struct RouterData<Flow, Request, Response> {/// This field is used to store various data regarding the response from connectorpub connector_response: Option<ConnectorResponseData>,pub payment_method_status: Option<common_enums::PaymentMethodStatus>,- pub is_migrated_card: Option<bool>,// minor amount for amount frameworkpub minor_amount_captured: Option<MinorUnit>,diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rsindex d6cf701317..884803940d 100644--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs@@ -80,7 +80,6 @@ fn get_default_router_data<F, Req, Resp>(refund_id: None,connector_response: None,payment_method_status: None,- is_migrated_card: None,minor_amount_captured: None,integrity_check: Ok(()),additional_merchant_data: None,diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rsindex 220f1f09c8..fb74955ab6 100644--- a/crates/router/src/core/authentication/transformers.rs+++ b/crates/router/src/core/authentication/transformers.rs@@ -212,7 +212,6 @@ pub fn construct_router_data<F: Clone, Req, Res>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,})}diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rsindex e539785104..ec6b014f6a 100644--- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs+++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs@@ -166,7 +166,6 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudCl2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)diff --git a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rsindex 63337eef4a..78f7140822 100644--- a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs+++ b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs@@ -137,7 +137,6 @@ pub async fn construct_fulfillment_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rsindex ca4185d042..a1dbf4d210 100644--- a/crates/router/src/core/fraud_check/flows/record_return.rs+++ b/crates/router/src/core/fraud_check/flows/record_return.rs@@ -137,7 +137,6 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudChl2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rsindex 73b9e59187..f564125314 100644--- a/crates/router/src/core/fraud_check/flows/sale_flow.rs+++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs@@ -145,7 +145,6 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckRespl2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rsindex 3c7ec23c9a..084c7b6aa7 100644--- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs+++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs@@ -155,7 +155,6 @@ impll2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rsindex 43a7844ace..3981db1a67 100644--- a/crates/router/src/core/mandate/utils.rs+++ b/crates/router/src/core/mandate/utils.rs@@ -91,7 +91,6 @@ pub async fn construct_mandate_revoke_router_data(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex 20a3349a52..578302d7e7 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -3834,7 +3834,6 @@ async fn create_single_use_tokenization_flow(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};let payment_method_token_response = Box::pin(tokenization::add_token_for_payment_method(diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex 3b1808a2ac..76c41f6410 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -4594,7 +4594,6 @@ pub fn router_data_type_conversion<F1, F2, Req1, Req2, Res1, Res2>(l2_l3_data: router_data.l2_l3_data,minor_amount_capturable: router_data.minor_amount_capturable,authorized_amount: router_data.authorized_amount,- is_migrated_card: router_data.is_migrated_card,}}diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 95f6722a7e..072b5420f9 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -199,7 +199,6 @@ wherel2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}@@ -545,7 +544,6 @@ pub async fn construct_payment_router_data_for_authorize<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -893,7 +891,6 @@ pub async fn construct_payment_router_data_for_capture<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -1027,7 +1024,6 @@ pub async fn construct_router_data_for_psync<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -1393,7 +1389,6 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -1622,7 +1617,6 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -1874,14 +1868,7 @@ whereaccess_token: None,session_token: None,reference_id: None,- payment_method_status: payment_data- .payment_method_info- .as_ref()- .map(|info| info.status),- is_migrated_card: payment_data- .payment_method_info- .as_ref()- .map(|info| info.is_migrated_card()),+ payment_method_status: payment_data.payment_method_info.map(|info| info.status),payment_method_token: payment_data.pm_token.map(|token| types::PaymentMethodToken::Token(Secret::new(token))),@@ -2079,11 +2066,7 @@ pub async fn construct_payment_router_data_for_update_metadata<'a>(access_token: None,session_token: None,reference_id: None,- payment_method_status: payment_data- .payment_method_info- .as_ref()- .map(|info| info.status),- is_migrated_card: None,+ payment_method_status: payment_data.payment_method_info.map(|info| info.status),payment_method_token: payment_data.pm_token.map(|token| types::PaymentMethodToken::Token(Secret::new(token))),diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rsindex 8c6505cc0d..b372f903ad 100644--- a/crates/router/src/core/relay/utils.rs+++ b/crates/router/src/core/relay/utils.rs@@ -149,7 +149,6 @@ pub async fn construct_relay_refund_router_data<F>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rsindex 185c8c3ca3..3cfb2d31fa 100644--- a/crates/router/src/core/unified_authentication_service/utils.rs+++ b/crates/router/src/core/unified_authentication_service/utils.rs@@ -132,7 +132,6 @@ pub fn construct_uas_router_data<F: Clone, Req, Res>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,})}diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rsindex f1a6a12e44..4da8c7197f 100644--- a/crates/router/src/core/utils.rs+++ b/crates/router/src/core/utils.rs@@ -231,7 +231,6 @@ pub async fn construct_payout_router_data<'a, F>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -407,7 +406,6 @@ pub async fn construct_refund_router_data<'a, F>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -599,7 +597,6 @@ pub async fn construct_refund_router_data<'a, F>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)@@ -1045,7 +1042,6 @@ pub async fn construct_accept_dispute_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}@@ -1152,7 +1148,6 @@ pub async fn construct_submit_evidence_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}@@ -1268,7 +1263,6 @@ pub async fn construct_upload_file_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}@@ -1344,7 +1338,6 @@ pub async fn construct_dispute_list_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,})}@@ -1453,7 +1446,6 @@ pub async fn construct_dispute_sync_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}@@ -1584,7 +1576,6 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<F: Clone>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}@@ -1694,7 +1685,6 @@ pub async fn construct_defend_dispute_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}@@ -1797,7 +1787,6 @@ pub async fn construct_retrieve_file_router_data<'a>(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rsindex fa970d199e..c892adead5 100644--- a/crates/router/src/core/webhooks/utils.rs+++ b/crates/router/src/core/webhooks/utils.rs@@ -145,7 +145,6 @@ pub async fn construct_webhook_router_data(l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,};Ok(router_data)}diff --git a/crates/router/src/types.rs b/crates/router/src/types.rsindex ea318511d3..aeb71d9955 100644--- a/crates/router/src/types.rs+++ b/crates/router/src/types.rs@@ -1386,7 +1386,6 @@ impl<F1, F2, T1, T2> ForeignFrom<(&RouterData<F1, T1, PaymentsResponseData>, T2)l2_l3_data: data.l2_l3_data.clone(),minor_amount_capturable: data.minor_amount_capturable,authorized_amount: data.authorized_amount,- is_migrated_card: data.is_migrated_card,}}}@@ -1459,7 +1458,6 @@ impl<F1, F2>l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,}}}diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rsindex 0aad63be84..0177f19d63 100644--- a/crates/router/src/types/api/verify_connector.rs+++ b/crates/router/src/types/api/verify_connector.rs@@ -138,7 +138,6 @@ impl VerifyConnectorData {l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,}}}diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rsindex 67f150ee78..c59a1fa500 100644--- a/crates/router/tests/connectors/utils.rs+++ b/crates/router/tests/connectors/utils.rs@@ -565,7 +565,6 @@ pub trait ConnectorActions: Connector {l2_l3_data: None,minor_amount_capturable: None,authorized_amount: None,- is_migrated_card: None,}}