Skip to content

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

fix(router): restricted unknown customer_id to be pass in payment confirm and update call (#1758)

Sahkal Poddar32c73243c06d
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 66e9a30570..17b39af344 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2615,17 +2615,8 @@ pub fn validate_customer_access(
request: &api::PaymentsRequest,
) -> Result<(), errors::ApiErrorResponse> {
if auth_flow == services::AuthFlow::Client && request.customer_id.is_some() {
- let is_not_same_customer = request
- .clone()
- .customer_id
- .and_then(|customer| {
- payment_intent
- .clone()
- .customer_id
- .map(|payment_customer| payment_customer != customer)
- })
- .unwrap_or(false);
- if is_not_same_customer {
+ let is_same_customer = request.customer_id == payment_intent.customer_id;
+ if !is_same_customer {
Err(errors::ApiErrorResponse::GenericUnauthorized {
message: "Unauthorised access to update customer".to_string(),
})?;