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(connector): [Trustpay] send billing address name as cardholder name (#1806)
Sai Harsha Vardhan71b75c653845
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rsindex 5ecdf376c4..0ef4030619 100644--- a/crates/router/src/connector/trustpay/transformers.rs+++ b/crates/router/src/connector/trustpay/transformers.rs@@ -3,7 +3,7 @@ use std::collections::HashMap;use api_models::payments::BankRedirectData;use common_utils::{errors::CustomResult, pii};use error_stack::{report, IntoReport, ResultExt};-use masking::Secret;+use masking::{PeekInterface, Secret};use reqwest::Url;use serde::{Deserialize, Serialize};@@ -182,6 +182,7 @@ pub struct TrustpayMandatoryParams {pub billing_country: api_models::enums::CountryAlpha2,pub billing_street1: Secret<String>,pub billing_postcode: Secret<String>,+ pub billing_first_name: Secret<String>,}impl TryFrom<&BankRedirectData> for TrustpayPaymentMethod {@@ -210,6 +211,7 @@ fn get_mandatory_fields(billing_country: billing_address.get_country()?.to_owned(),billing_street1: billing_address.get_line1()?.to_owned(),billing_postcode: billing_address.get_zip()?.to_owned(),+ billing_first_name: billing_address.get_first_name()?.to_owned(),})}@@ -223,6 +225,11 @@ fn get_card_request_data() -> Result<TrustpayPaymentsRequest, Error> {let email = item.request.get_email()?;let customer_ip_address = browser_info.get_ip_address()?;+ let billing_last_name = item+ .get_billing()?+ .address+ .as_ref()+ .map(|address| address.last_name.clone().unwrap_or_default());Ok(TrustpayPaymentsRequest::CardsPaymentRequest(Box::new(PaymentRequestCards {amount,@@ -230,7 +237,12 @@ fn get_card_request_data(pan: ccard.card_number.clone(),cvv: ccard.card_cvc.clone(),expiry_date: ccard.get_card_expiry_month_year_2_digit_with_delimiter("/".to_owned()),- cardholder: ccard.card_holder_name.clone(),+ cardholder: match billing_last_name {+ Some(last_name) => {+ format!("{} {}", params.billing_first_name.peek(), last_name.peek()).into()+ }+ None => params.billing_first_name,+ },reference: item.payment_id.clone(),redirect_url: return_url,billing_city: params.billing_city,