feat(customer_v2): add customer create v2 endpoint (#5444)

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-07 13:12:10 +05:30
committed by GitHub
parent c6a960766d
commit 52cada015e
47 changed files with 1474 additions and 160 deletions

View File

@ -3,7 +3,7 @@ use common_utils::{
encryption::Encryption,
id_type,
pii::{self, EmailStrategy},
types::keymanager::ToEncryptable,
types::{keymanager::ToEncryptable, Description},
};
use euclid::dssa::graph::euclid_graph_prelude::FxHashMap;
use masking::{ExposeInterface, Secret, SwitchStrategy};
@ -33,8 +33,8 @@ pub struct CustomerRequest {
#[schema(value_type = Option<String>, max_length = 255, example = "9123456789")]
pub phone: Option<Secret<String>>,
/// An arbitrary string that you can attach to a customer object.
#[schema(max_length = 255, example = "First Customer")]
pub description: Option<String>,
#[schema(max_length = 255, example = "First Customer", value_type = Option<String>)]
pub description: Option<Description>,
/// The country code for the customer phone number
#[schema(max_length = 255, example = "+65")]
pub phone_country_code: Option<String>,
@ -82,8 +82,8 @@ pub struct CustomerRequest {
#[schema(value_type = Option<String>, max_length = 255, example = "9123456789")]
pub phone: Option<Secret<String>>,
/// An arbitrary string that you can attach to a customer object.
#[schema(max_length = 255, example = "First Customer")]
pub description: Option<String>,
#[schema(max_length = 255, example = "First Customer", value_type = Option<String>)]
pub description: Option<Description>,
/// The country code for the customer phone number
#[schema(max_length = 255, example = "+65")]
pub phone_country_code: Option<String>,
@ -217,8 +217,8 @@ pub struct CustomerResponse {
#[schema(max_length = 255, example = "+65")]
pub phone_country_code: Option<String>,
/// An arbitrary string that you can attach to a customer object.
#[schema(max_length = 255, example = "First Customer")]
pub description: Option<String>,
#[schema(max_length = 255, example = "First Customer", value_type = Option<String>)]
pub description: Option<Description>,
/// The address for the customer
#[schema(value_type = Option<AddressDetails>)]
pub address: Option<payments::AddressDetails>,
@ -262,8 +262,8 @@ pub struct CustomerResponse {
#[schema(max_length = 255, example = "+65")]
pub phone_country_code: Option<String>,
/// An arbitrary string that you can attach to a customer object.
#[schema(max_length = 255, example = "First Customer")]
pub description: Option<String>,
#[schema(max_length = 255, example = "First Customer", value_type = Option<String>)]
pub description: Option<Description>,
/// The default billing address for the customer
#[schema(value_type = Option<AddressDetails>)]
pub default_billing_address: Option<payments::AddressDetails>,

View File

@ -14,7 +14,7 @@ impl ApiEventMetric for CustomerRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
self.get_merchant_reference_id()
.clone()
.map(|customer_id| ApiEventsType::Customer { customer_id })
.map(|cid| ApiEventsType::Customer { customer_id: cid })
}
}