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(payments): resolve customer ID mismatch in payment method validation and remove todo from generate_pm_vaulting_req_from_update_request (#11400)
Gaurav Rawat85e9d79ed199
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex a6239cd955..ef93607e23 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -5701,6 +5701,10 @@ impl<'a> pm_types::PaymentMethodUpdateHandler<'a> {payment_method_data,)})+ .transpose()+ .change_context(errors::ApiErrorResponse::NotSupported {+ message: "Payment method type not supported for update".to_string(),+ })?.ok_or(errors::ApiErrorResponse::MissingRequiredField {field_name: "payment_method_data",})?;diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rsindex 527f993f31..2cadfe2225 100644--- a/crates/router/src/core/payment_methods/transformers.rs+++ b/crates/router/src/core/payment_methods/transformers.rs@@ -553,12 +553,12 @@ pub fn mk_add_card_response_hs(pub fn generate_pm_vaulting_req_from_update_request(pm_create: domain::PaymentMethodVaultingData,pm_update: api::PaymentMethodUpdateData,-) -> domain::PaymentMethodVaultingData {+) -> CustomResult<domain::PaymentMethodVaultingData, errors::VaultError> {match (pm_create, pm_update) {(domain::PaymentMethodVaultingData::Card(card_create),api::PaymentMethodUpdateData::Card(update_card),- ) => domain::PaymentMethodVaultingData::Card(api::CardDetail {+ ) => Ok(domain::PaymentMethodVaultingData::Card(api::CardDetail {card_number: card_create.card_number,card_exp_month: card_create.card_exp_month,card_exp_year: card_create.card_exp_year,@@ -571,8 +571,9 @@ pub fn generate_pm_vaulting_req_from_update_request(.or(card_create.card_holder_name),nick_name: update_card.nick_name.or(card_create.nick_name),card_cvc: None,- }),- _ => todo!(), //todo! - since support for network tokenization is not added PaymentMethodUpdateData. should be handled later.+ })),+ _ => Err(errors::VaultError::PaymentMethodNotSupported)+ .attach_printable("Payment method type not supported for update"),}}diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex 7b8e1b96f3..d1509f2515 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -1225,7 +1225,10 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forutils::when(pm_info.payment_method.0.customer_id- != req.customer_id.clone().get_required_value("customer_id")?,+ != req+ .get_customer_id()+ .get_required_value("customer_id")?+ .clone(),|| {logger::info!("Payment method id does not belong to the customer id provided in the request.");Err(errors::ApiErrorResponse::PaymentMethodNotFound)diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex b7d23b1f4e..cde4ab973d 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -881,7 +881,10 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forutils::when(pm_info.payment_method.0.customer_id- != req.customer_id.clone().get_required_value("customer_id")?,+ != req+ .get_customer_id()+ .get_required_value("customer_id")?+ .clone(),|| {logger::info!("Payment method id does not belong to the customer id provided in the request.");Err(errors::ApiErrorResponse::PaymentMethodNotFound)