mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +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:
@ -282,6 +282,8 @@ pub struct CustomerResponse {
|
||||
/// The identifier for the default payment method.
|
||||
#[schema(max_length = 64, example = "pm_djh2837dwduh890123")]
|
||||
pub default_payment_method_id: Option<String>,
|
||||
/// Global id
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
@ -308,6 +310,19 @@ impl CustomerId {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct GlobalId {
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
impl GlobalId {
|
||||
pub fn new(id: String) -> Self {
|
||||
Self { id }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct CustomerId {
|
||||
|
||||
@ -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