feat: add a domain type for customer_id (#4705)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-05-30 16:19:10 +05:30
committed by GitHub
parent f192fa3866
commit 93d61d1053
106 changed files with 1150 additions and 490 deletions

View File

@ -4,7 +4,7 @@ use cards::CardNumber;
use common_utils::{
consts::SURCHARGE_PERCENTAGE_PRECISION_LENGTH,
crypto::OptionalEncryptableName,
pii,
id_type, pii,
types::{MinorUnit, Percentage, Surcharge},
};
use serde::de;
@ -49,8 +49,8 @@ pub struct PaymentMethodCreate {
pub metadata: Option<pii::SecretSerdeValue>,
/// The unique identifier of the customer.
#[schema(example = "cus_meowerunwiuwiwqw")]
pub customer_id: Option<String>,
#[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub customer_id: Option<id_type::CustomerId>,
/// The card network
#[schema(example = "Visa")]
@ -194,8 +194,8 @@ pub struct PaymentMethodResponse {
pub merchant_id: String,
/// The unique identifier of the customer.
#[schema(example = "cus_meowerunwiuwiwqw")]
pub customer_id: Option<String>,
#[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub customer_id: Option<id_type::CustomerId>,
/// The unique identifier of the Payment method
#[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")]
@ -846,8 +846,8 @@ pub struct CustomerDefaultPaymentMethodResponse {
#[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")]
pub default_payment_method_id: Option<String>,
/// The unique identifier of the customer.
#[schema(example = "cus_meowerunwiuwiwqw")]
pub customer_id: String,
#[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub customer_id: id_type::CustomerId,
/// The type of payment method use for the payment.
#[schema(value_type = PaymentMethod,example = "card")]
pub payment_method: api_enums::PaymentMethod,
@ -866,8 +866,8 @@ pub struct CustomerPaymentMethod {
pub payment_method_id: String,
/// The unique identifier of the customer.
#[schema(example = "cus_meowerunwiuwiwqw")]
pub customer_id: String,
#[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub customer_id: id_type::CustomerId,
/// The type of payment method use for the payment.
#[schema(value_type = PaymentMethod,example = "card")]
@ -952,7 +952,8 @@ pub struct PaymentMethodId {
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
pub struct DefaultPaymentMethod {
pub customer_id: String,
#[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub customer_id: id_type::CustomerId,
pub payment_method_id: String,
}
//------------------------------------------------TokenizeService------------------------------------------------
@ -1034,7 +1035,7 @@ pub struct TokenizedCardValue2 {
pub card_security_code: Option<String>,
pub card_fingerprint: Option<String>,
pub external_id: Option<String>,
pub customer_id: Option<String>,
pub customer_id: Option<id_type::CustomerId>,
pub payment_method_id: Option<String>,
}
@ -1045,7 +1046,7 @@ pub struct TokenizedWalletValue1 {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedWalletValue2 {
pub customer_id: Option<String>,
pub customer_id: Option<id_type::CustomerId>,
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
@ -1055,7 +1056,7 @@ pub struct TokenizedBankTransferValue1 {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedBankTransferValue2 {
pub customer_id: Option<String>,
pub customer_id: Option<id_type::CustomerId>,
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
@ -1065,5 +1066,5 @@ pub struct TokenizedBankRedirectValue1 {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct TokenizedBankRedirectValue2 {
pub customer_id: Option<String>,
pub customer_id: Option<id_type::CustomerId>,
}