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

refactor(customer): return redacted customer instead of error (#7122)

Amey Wale97e9270ed445
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 4f69cf4196..dabc9d3708 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -463,7 +463,7 @@ pub async fn retrieve_customer(
let key_manager_state = &(&state).into();
let response = db
- .find_customer_by_customer_id_merchant_id(
+ .find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
key_manager_state,
&customer_id,
merchant_account.get_id(),
@@ -471,7 +471,9 @@ pub async fn retrieve_customer(
merchant_account.storage_scheme,
)
.await
- .switch()?;
+ .switch()?
+ .ok_or(errors::CustomersErrorResponse::CustomerNotFound)?;
+
let address = match &response.address_id {
Some(address_id) => Some(api_models::payments::AddressDetails::from(
db.find_address_by_address_id(key_manager_state, address_id, &key_store)