fix(connector): [AUTHORIZEDOTNET] customer id population fixed in authorize flow (#9079)

This commit is contained in:
sweta-sharma
2025-08-29 15:58:33 +05:30
committed by GitHub
parent 23cf4376f5
commit 60ef06e8ff

View File

@ -903,13 +903,15 @@ impl
description: item.router_data.connector_request_reference_id.clone(), description: item.router_data.connector_request_reference_id.clone(),
}, },
customer: Some(CustomerDetails { customer: item.router_data.customer_id.as_ref().and_then(|cid| {
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH { if cid.get_string_repr().len() <= MAX_ID_LENGTH {
item.router_data.payment_id.clone() Some(CustomerDetails {
id: cid.get_string_repr().to_string(),
email: item.router_data.request.get_optional_email(),
})
} else { } else {
get_random_string() None
}, }
email: item.router_data.request.get_optional_email(),
}), }),
bill_to: item bill_to: item
.router_data .router_data
@ -992,13 +994,15 @@ impl
description: item.router_data.connector_request_reference_id.clone(), description: item.router_data.connector_request_reference_id.clone(),
}, },
customer: Some(CustomerDetails { customer: item.router_data.customer_id.as_ref().and_then(|cid| {
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH { if cid.get_string_repr().len() <= MAX_ID_LENGTH {
item.router_data.payment_id.clone() Some(CustomerDetails {
id: cid.get_string_repr().to_string(),
email: item.router_data.request.get_optional_email(),
})
} else { } else {
get_random_string() None
}, }
email: item.router_data.request.get_optional_email(),
}), }),
bill_to: None, bill_to: None,
user_fields: match item.router_data.request.metadata.clone() { user_fields: match item.router_data.request.metadata.clone() {
@ -1034,21 +1038,19 @@ impl
&Card, &Card,
), ),
) -> Result<Self, Self::Error> { ) -> Result<Self, Self::Error> {
let (profile, customer) = ( let profile = Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails { create_profile: true,
create_profile: true, }));
})), let customer = item.router_data.customer_id.as_ref().and_then(|cid| {
Some(CustomerDetails { if cid.get_string_repr().len() <= MAX_ID_LENGTH {
//The payment ID is included in the customer details because the connector requires unique customer information with a length of fewer than 20 characters when creating a mandate. Some(CustomerDetails {
//If the length exceeds 20 characters, a random alphanumeric string is used instead. id: cid.get_string_repr().to_string(),
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH { email: item.router_data.request.get_optional_email(),
item.router_data.payment_id.clone() })
} else { } else {
get_random_string() None
}, }
email: item.router_data.request.get_optional_email(), });
}),
);
Ok(Self { Ok(Self {
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?, transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
amount: item.amount, amount: item.amount,
@ -1118,19 +1120,19 @@ impl
&WalletData, &WalletData,
), ),
) -> Result<Self, Self::Error> { ) -> Result<Self, Self::Error> {
let (profile, customer) = ( let profile = Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails { create_profile: true,
create_profile: true, }));
})), let customer = item.router_data.customer_id.as_ref().and_then(|cid| {
Some(CustomerDetails { if cid.get_string_repr().len() <= MAX_ID_LENGTH {
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH { Some(CustomerDetails {
item.router_data.payment_id.clone() id: cid.get_string_repr().to_string(),
} else { email: item.router_data.request.get_optional_email(),
get_random_string() })
}, } else {
email: item.router_data.request.get_optional_email(), None
}), }
); });
Ok(Self { Ok(Self {
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?, transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
amount: item.amount, amount: item.amount,