refactor(schema): add a new column for storing large customer user agents in mandate table (#8616)

This commit is contained in:
Pa1NarK
2025-07-25 14:58:37 +05:30
committed by GitHub
parent dbdf7579d2
commit b74c1e9188
8 changed files with 29 additions and 4 deletions

View File

@ -3439,7 +3439,7 @@ pub fn generate_mandate(
.get_ip_address()
.map(masking::Secret::new),
)
.set_customer_user_agent(customer_acceptance.get_user_agent())
.set_customer_user_agent_extended(customer_acceptance.get_user_agent())
.set_customer_accepted_at(Some(customer_acceptance.get_accepted_at()))
.set_metadata(payment_method_data_option.map(|payment_method_data| {
pii::SecretSerdeValue::new(

View File

@ -671,7 +671,7 @@ impl MandateInterface for MockDb {
mandate_type: mandate_new.mandate_type,
customer_accepted_at: mandate_new.customer_accepted_at,
customer_ip_address: mandate_new.customer_ip_address,
customer_user_agent: mandate_new.customer_user_agent,
customer_user_agent: None,
network_transaction_id: mandate_new.network_transaction_id,
previous_attempt_id: mandate_new.previous_attempt_id,
created_at: mandate_new
@ -688,6 +688,10 @@ impl MandateInterface for MockDb {
connector_mandate_ids: mandate_new.connector_mandate_ids,
merchant_connector_id: mandate_new.merchant_connector_id,
updated_by: mandate_new.updated_by,
// Using customer_user_agent as a fallback
customer_user_agent_extended: mandate_new
.customer_user_agent_extended
.or_else(|| mandate_new.customer_user_agent.clone()),
};
mandates.push(mandate.clone());
Ok(mandate)

View File

@ -106,7 +106,11 @@ impl MandateResponseExt for MandateResponse {
accepted_at: mandate.customer_accepted_at,
online: Some(api::payments::OnlineMandate {
ip_address: mandate.customer_ip_address,
user_agent: mandate.customer_user_agent.unwrap_or_default(),
// Using customer_user_agent as a fallback
user_agent: mandate
.customer_user_agent_extended
.or(mandate.customer_user_agent)
.unwrap_or_default(),
}),
}),
card,