mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
fix(connector): [AUTHORIZEDOTNET] customer id population fixed in authorize flow (#9079)
This commit is contained in:
@ -903,13 +903,15 @@ impl
|
||||
|
||||
description: item.router_data.connector_request_reference_id.clone(),
|
||||
},
|
||||
customer: Some(CustomerDetails {
|
||||
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH {
|
||||
item.router_data.payment_id.clone()
|
||||
customer: item.router_data.customer_id.as_ref().and_then(|cid| {
|
||||
if cid.get_string_repr().len() <= MAX_ID_LENGTH {
|
||||
Some(CustomerDetails {
|
||||
id: cid.get_string_repr().to_string(),
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
})
|
||||
} else {
|
||||
get_random_string()
|
||||
},
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
None
|
||||
}
|
||||
}),
|
||||
bill_to: item
|
||||
.router_data
|
||||
@ -992,13 +994,15 @@ impl
|
||||
|
||||
description: item.router_data.connector_request_reference_id.clone(),
|
||||
},
|
||||
customer: Some(CustomerDetails {
|
||||
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH {
|
||||
item.router_data.payment_id.clone()
|
||||
customer: item.router_data.customer_id.as_ref().and_then(|cid| {
|
||||
if cid.get_string_repr().len() <= MAX_ID_LENGTH {
|
||||
Some(CustomerDetails {
|
||||
id: cid.get_string_repr().to_string(),
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
})
|
||||
} else {
|
||||
get_random_string()
|
||||
},
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
None
|
||||
}
|
||||
}),
|
||||
bill_to: None,
|
||||
user_fields: match item.router_data.request.metadata.clone() {
|
||||
@ -1034,21 +1038,19 @@ impl
|
||||
&Card,
|
||||
),
|
||||
) -> Result<Self, Self::Error> {
|
||||
let (profile, customer) = (
|
||||
Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
|
||||
create_profile: true,
|
||||
})),
|
||||
Some(CustomerDetails {
|
||||
//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.
|
||||
//If the length exceeds 20 characters, a random alphanumeric string is used instead.
|
||||
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH {
|
||||
item.router_data.payment_id.clone()
|
||||
} else {
|
||||
get_random_string()
|
||||
},
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
}),
|
||||
);
|
||||
let profile = Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
|
||||
create_profile: true,
|
||||
}));
|
||||
let customer = item.router_data.customer_id.as_ref().and_then(|cid| {
|
||||
if cid.get_string_repr().len() <= MAX_ID_LENGTH {
|
||||
Some(CustomerDetails {
|
||||
id: cid.get_string_repr().to_string(),
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
Ok(Self {
|
||||
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
|
||||
amount: item.amount,
|
||||
@ -1118,19 +1120,19 @@ impl
|
||||
&WalletData,
|
||||
),
|
||||
) -> Result<Self, Self::Error> {
|
||||
let (profile, customer) = (
|
||||
Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
|
||||
create_profile: true,
|
||||
})),
|
||||
Some(CustomerDetails {
|
||||
id: if item.router_data.payment_id.len() <= MAX_ID_LENGTH {
|
||||
item.router_data.payment_id.clone()
|
||||
} else {
|
||||
get_random_string()
|
||||
},
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
}),
|
||||
);
|
||||
let profile = Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails {
|
||||
create_profile: true,
|
||||
}));
|
||||
let customer = item.router_data.customer_id.as_ref().and_then(|cid| {
|
||||
if cid.get_string_repr().len() <= MAX_ID_LENGTH {
|
||||
Some(CustomerDetails {
|
||||
id: cid.get_string_repr().to_string(),
|
||||
email: item.router_data.request.get_optional_email(),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
Ok(Self {
|
||||
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
|
||||
amount: item.amount,
|
||||
|
||||
Reference in New Issue
Block a user