mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
feat(customer_v2): add route for customer retrieve v2 (#5516)
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> Co-authored-by: Sahkal Poddar <sahkalpoddar@Sahkals-MacBook-Air.local>
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
|
||||
use crate::customers::{
|
||||
CustomerDeleteResponse, CustomerId, CustomerRequest, CustomerResponse, CustomerUpdateRequest,
|
||||
};
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
use crate::customers::GlobalId;
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
use crate::customers::{CustomerDeleteResponse, CustomerId};
|
||||
use crate::customers::{CustomerRequest, CustomerResponse, CustomerUpdateRequest};
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
impl ApiEventMetric for CustomerDeleteResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Customer {
|
||||
@ -12,6 +15,7 @@ impl ApiEventMetric for CustomerDeleteResponse {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
impl ApiEventMetric for CustomerRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
self.get_merchant_reference_id()
|
||||
@ -20,6 +24,16 @@ impl ApiEventMetric for CustomerRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
impl ApiEventMetric for CustomerRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Customer {
|
||||
id: "temp_id".to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
impl ApiEventMetric for CustomerResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
self.get_merchant_reference_id()
|
||||
@ -28,6 +42,16 @@ impl ApiEventMetric for CustomerResponse {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
impl ApiEventMetric for CustomerResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Customer {
|
||||
id: self.id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
impl ApiEventMetric for CustomerId {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Customer {
|
||||
@ -36,6 +60,16 @@ impl ApiEventMetric for CustomerId {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
impl ApiEventMetric for GlobalId {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Customer {
|
||||
id: self.id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
impl ApiEventMetric for CustomerUpdateRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
self.get_merchant_reference_id()
|
||||
@ -43,4 +77,13 @@ impl ApiEventMetric for CustomerUpdateRequest {
|
||||
.map(|cid| ApiEventsType::Customer { customer_id: cid })
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
impl ApiEventMetric for CustomerUpdateRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Customer {
|
||||
id: "temo_id".to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
// These needs to be fixed for v2
|
||||
|
||||
Reference in New Issue
Block a user