Skip to content

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

fix(connectors): [Adyen] use single source of shopper ref (#10161)

Mrudul Vajpayee73d627f084a8
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index e5ae3a399b..e4d4f604f4 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -2080,20 +2080,6 @@ 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(
@@ -3083,8 +3069,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &Card)> for AdyenP
let 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 shopper_reference = build_shopper_reference(item.router_data);
- let (recurring_processing_model, store_payment_method, _) =
+ let (recurring_processing_model, store_payment_method, shopper_reference) =
get_recurring_processing_model(item.router_data)?;
let browser_info = get_browser_info(item.router_data)?;
let billing_address =
@@ -3806,8 +3791,7 @@ impl
let 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 shopper_reference = build_shopper_reference(item.router_data);
- let (recurring_processing_model, store_payment_method, _) =
+ let (recurring_processing_model, store_payment_method, shopper_reference) =
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());
@@ -6427,8 +6411,7 @@ impl
let 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 shopper_reference = build_shopper_reference(item.router_data);
- let (recurring_processing_model, store_payment_method, _) =
+ let (recurring_processing_model, store_payment_method, shopper_reference) =
get_recurring_processing_model(item.router_data)?;
let browser_info = get_browser_info(item.router_data)?;
let billing_address =