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
feat(customer_v2): added list customer v2 end point (#5517)
Sahkal Poddar8b4d0967ae3c
diff --git a/crates/diesel_models/src/query/customers.rs b/crates/diesel_models/src/query/customers.rsindex 337679484c..ddcaeafd31 100644--- a/crates/diesel_models/src/query/customers.rs+++ b/crates/diesel_models/src/query/customers.rs@@ -53,7 +53,6 @@ impl Customer {generics::generic_find_by_id::<<Self as HasTable>::Table, _, _>(conn, id.to_owned()).await}- #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]pub async fn list_by_merchant_id(conn: &PgPooledConn,merchant_id: &id_type::MerchantId,diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rsindex 4e45e48cfa..71e982031e 100644--- a/crates/router/src/core/customers.rs+++ b/crates/router/src/core/customers.rs@@ -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))}diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rsindex a54f00d6aa..f331639be5 100644--- a/crates/router/src/core/payouts.rs+++ b/crates/router/src/core/payouts.rs@@ -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 merchantdiff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rsindex f2688499cc..e7a317ce97 100644--- a/crates/router/src/db/customers.rs+++ b/crates/router/src/db/customers.rs@@ -1,6 +1,5 @@use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};use error_stack::ResultExt;-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]use futures::future::try_join_all;use hyperswitch_domain_models::customer;#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]@@ -84,7 +83,6 @@ wherestorage_scheme: MerchantStorageScheme,) -> CustomResult<customer::Customer, errors::StorageError>;- #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]async fn list_customers_by_merchant_id(&self,state: &KeyManagerState,@@ -129,7 +127,6 @@ mod storage {use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};use diesel_models::kv;use error_stack::{report, ResultExt};- #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]use futures::future::try_join_all;use hyperswitch_domain_models::customer;use masking::PeekInterface;@@ -511,7 +508,6 @@ mod storage {}}- #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]#[instrument(skip_all)]async fn list_customers_by_merchant_id(&self,@@ -919,6 +915,7 @@ mod storage {})}+ #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]#[instrument(skip_all)]#[cfg(all(feature = "v2", feature = "customer_v2"))]async fn find_optional_by_merchant_id_merchant_reference_id(@@ -1052,7 +1049,6 @@ mod storage {}}- #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]#[instrument(skip_all)]async fn list_customers_by_merchant_id(&self,@@ -1244,7 +1240,6 @@ impl CustomerInterface for MockDb {.transpose()}- #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]async fn list_customers_by_merchant_id(&self,state: &KeyManagerState,diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rsindex cb3f6db144..c02304c7b4 100644--- a/crates/router/src/db/kafka_store.rs+++ b/crates/router/src/db/kafka_store.rs@@ -443,7 +443,6 @@ impl CustomerInterface for KafkaStore {.await}- #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]async fn list_customers_by_merchant_id(&self,state: &KeyManagerState,diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rsindex 4fb171996e..06971f381a 100644--- a/crates/router/src/routes/app.rs+++ b/crates/router/src/routes/app.rs@@ -894,10 +894,14 @@ impl Customers {.service(web::resource("").route(web::post().to(customers_create))).service(web::resource("/{id}")- .route(web::put().to(customers_update))+ .route(web::post().to(customers_update)).route(web::post().to(customers_retrieve)),)}+ #[cfg(all(feature = "olap", feature = "v2", feature = "customer_v2"))]+ {+ route = route.service(web::resource("/list").route(web::get().to(customers_list)))+ }#[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2"))]{route = route.service(diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rsindex 20d6539bb0..b770f0ce23 100644--- a/crates/router/src/routes/customers.rs+++ b/crates/router/src/routes/customers.rs@@ -110,7 +110,6 @@ pub async fn customers_retrieve(.await}-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]#[instrument(skip_all, fields(flow = ?Flow::CustomersList))]pub async fn customers_list(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {let flow = Flow::CustomersList;diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rsindex 680d535a65..aee21771db 100644--- a/crates/storage_impl/src/payouts/payouts.rs+++ b/crates/storage_impl/src/payouts/payouts.rs@@ -5,10 +5,14 @@ use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl};#[cfg(feature = "olap")]use common_utils::errors::ReportSwitchExt;use common_utils::ext_traits::Encode;+#[cfg(all(+ feature = "olap",+ any(feature = "v1", feature = "v2"),+ not(feature = "customer_v2")+))]+use diesel::JoinOnDsl;#[cfg(feature = "olap")]-use diesel::{- associations::HasTable, ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl,-};+use diesel::{associations::HasTable, ExpressionMethods, NullableExpressionMethods, QueryDsl};#[cfg(all(feature = "olap",any(feature = "v1", feature = "v2"),