feat(customer_v2): added list customer v2 end point (#5517)

Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in>
Co-authored-by: Prajjwal Kumar <prajjwal.kumar@juspay.in>
Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sahkal Poddar
2024-08-26 14:58:57 +05:30
committed by GitHub
parent 963a2547e8
commit 8b4d0967ae
8 changed files with 20 additions and 16 deletions

View File

@ -490,7 +490,6 @@ pub async fn retrieve_customer(
))
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[instrument(skip(state))]
pub async fn list_customers(
state: SessionState,
@ -499,17 +498,23 @@ pub async fn list_customers(
key_store: domain::MerchantKeyStore,
) -> errors::CustomerResponse<Vec<customers::CustomerResponse>> {
let db = state.store.as_ref();
let domain_customers = db
.list_customers_by_merchant_id(&(&state).into(), &merchant_id, &key_store)
.await
.switch()?;
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
let customers = domain_customers
.into_iter()
.map(|domain_customer| customers::CustomerResponse::foreign_from((domain_customer, None)))
.collect();
#[cfg(all(feature = "v2", feature = "customer_v2"))]
let customers = domain_customers
.into_iter()
.map(customers::CustomerResponse::foreign_from)
.collect();
Ok(services::ApplicationResponse::Json(customers))
}

View File

@ -2450,7 +2450,6 @@ pub async fn make_payout_data(
.await
.transpose()?
.and_then(|c| c);
let profile_id = payout_attempt.profile_id.clone();
// Validate whether profile_id passed in request is valid and is linked to the merchant