Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions api-reference/v1/openapi_spec_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -16483,6 +16483,13 @@
"description": "The tax registration identifier of the customer.",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
}
},
Expand Down Expand Up @@ -16946,6 +16953,13 @@
"example": "123456789",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
}
},
Expand Down Expand Up @@ -17030,6 +17044,13 @@
"example": "123456789",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
}
},
Expand Down Expand Up @@ -17091,6 +17112,13 @@
"example": "123456789",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
}
},
Expand Down
28 changes: 28 additions & 0 deletions api-reference/v2/openapi_spec_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10495,6 +10495,13 @@
"description": "The tax registration identifier of the customer.",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
}
},
Expand Down Expand Up @@ -10714,6 +10721,13 @@
"example": "123456789",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
},
"additionalProperties": false
Expand Down Expand Up @@ -10820,6 +10834,13 @@
"example": "123456789",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
}
},
Expand Down Expand Up @@ -10896,6 +10917,13 @@
"example": "123456789",
"nullable": true,
"maxLength": 255
},
"customer_document_number": {
"type": "string",
"description": "Document number of the customer",
"example": "doc_123456789",
"nullable": true,
"maxLength": 255
}
},
"additionalProperties": false
Expand Down
21 changes: 21 additions & 0 deletions crates/api_models/src/customers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ pub struct CustomerRequest {
#[schema(max_length = 255, value_type = Option<String>, example = "123456789")]
#[smithy(value_type = "Option<String>")]
pub tax_registration_id: Option<Secret<String>>,
/// Document number of the customer
#[schema(value_type = Option<String>, max_length = 255, example = "doc_123456789")]
#[smithy(value_type = "Option<String>")]
pub customer_document_number: Option<Secret<String>>,
}

#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema, SmithyModel)]
Expand Down Expand Up @@ -139,6 +143,9 @@ pub struct CustomerRequest {
/// The customer's tax registration number.
#[schema(max_length = 255, value_type = Option<String>, example = "123456789")]
pub tax_registration_id: Option<Secret<String>>,
/// Document number of the customer
#[schema(value_type = Option<String>, max_length = 255, example = "doc_123456789")]
pub customer_document_number: Option<Secret<String>>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -211,6 +218,10 @@ pub struct CustomerResponse {
#[schema(max_length = 255, value_type = Option<String>, example = "123456789")]
#[smithy(value_type = "Option<String>")]
pub tax_registration_id: crypto::OptionalEncryptableSecretString,
/// Document number of the customer
#[schema(value_type = Option<String>, max_length = 255, example = "doc_123456789")]
#[smithy(value_type = "Option<String>")]
pub customer_document_number: crypto::OptionalEncryptableSecretString,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -273,6 +284,9 @@ pub struct CustomerResponse {
/// The customer's tax registration number.
#[schema(max_length = 255, value_type = Option<String>, example = "123456789")]
pub tax_registration_id: crypto::OptionalEncryptableSecretString,
/// Document number of the customer
#[schema(value_type = Option<String>, max_length = 255, example = "doc_123456789")]
pub customer_document_number: crypto::OptionalEncryptableSecretString,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -372,6 +386,10 @@ pub struct CustomerUpdateRequest {
#[schema(max_length = 255, value_type = Option<String>, example = "123456789")]
#[smithy(value_type = "Option<String>")]
pub tax_registration_id: Option<Secret<String>>,
/// Document number of the customer
#[schema(value_type = Option<String>, max_length = 255, example = "doc_123456789")]
#[smithy(value_type = "Option<String>")]
pub customer_document_number: Option<Secret<String>>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -417,6 +435,9 @@ pub struct CustomerUpdateRequest {
/// The customer's tax registration number.
#[schema(max_length = 255, value_type = Option<String>, example = "123456789")]
pub tax_registration_id: Option<Secret<String>>,
/// Document number of the customer
#[schema(value_type = Option<String>, max_length = 255, example = "doc_123456789")]
pub customer_document_number: Option<Secret<String>>,
}

#[cfg(feature = "v2")]
Expand Down
7 changes: 7 additions & 0 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ pub struct CustomerDetails {
#[schema(value_type=Option<String>,max_length = 255)]
#[smithy(value_type = "Option<String>")]
pub tax_registration_id: Option<Secret<String>>,

/// Document number of the customer
#[schema(value_type = Option<String>, max_length = 255, example = "doc_123456789")]
#[smithy(value_type = "Option<String>")]
pub customer_document_number: Option<Secret<String>>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -1769,6 +1774,7 @@ mod payments_request_test {
phone: None,
phone_country_code: None,
tax_registration_id: None,
customer_document_number: None,
};

let payments_request = PaymentsRequest {
Expand All @@ -1794,6 +1800,7 @@ mod payments_request_test {
phone: None,
phone_country_code: None,
tax_registration_id: None,
customer_document_number: None,
};

let payments_request = PaymentsRequest {
Expand Down
8 changes: 8 additions & 0 deletions crates/common_types/src/payment_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use diesel::{
sql_types::{Json, Jsonb},
AsExpression, Queryable,
};
use masking::Secret;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

Expand Down Expand Up @@ -265,3 +266,10 @@ pub struct PspTokenization {
#[schema(value_type = String)]
pub connector_id: common_utils::id_type::MerchantConnectorAccountId,
}

/// Customer details associated with the payment method
#[derive(Default, Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct PaymentMethodCustomerDetails {
/// Document number of the customer
pub customer_document_number: Option<Secret<String>>,
}
14 changes: 14 additions & 0 deletions crates/diesel_models/src/customers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct CustomerNew {
pub tax_registration_id: Option<Encryption>,
pub created_by: Option<String>,
pub last_modified_by: Option<String>,
pub customer_document_number: Option<Encryption>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -62,6 +63,7 @@ impl From<CustomerNew> for Customer {
updated_by: customer_new.updated_by,
version: customer_new.version,
tax_registration_id: customer_new.tax_registration_id,
customer_document_number: customer_new.customer_document_number,
created_by: customer_new.created_by,
last_modified_by: customer_new.last_modified_by,
}
Expand Down Expand Up @@ -95,6 +97,7 @@ pub struct CustomerNew {
pub id: common_utils::id_type::GlobalCustomerId,
pub created_by: Option<String>,
pub last_modified_by: Option<String>,
pub customer_document_number: Option<Encryption>,
}

#[cfg(feature = "v2")]
Expand All @@ -121,6 +124,7 @@ impl From<CustomerNew> for Customer {
default_payment_method_id: None,
updated_by: customer_new.updated_by,
tax_registration_id: customer_new.tax_registration_id,
customer_document_number: customer_new.customer_document_number,
merchant_reference_id: customer_new.merchant_reference_id,
default_billing_address: customer_new.default_billing_address,
default_shipping_address: customer_new.default_shipping_address,
Expand Down Expand Up @@ -157,6 +161,7 @@ pub struct Customer {
pub tax_registration_id: Option<Encryption>,
pub created_by: Option<String>,
pub last_modified_by: Option<String>,
pub customer_document_number: Option<Encryption>,
}

#[cfg(feature = "v2")]
Expand All @@ -181,6 +186,7 @@ pub struct Customer {
pub tax_registration_id: Option<Encryption>,
pub created_by: Option<String>,
pub last_modified_by: Option<String>,
pub customer_document_number: Option<Encryption>,
pub merchant_reference_id: Option<common_utils::id_type::CustomerId>,
pub default_billing_address: Option<Encryption>,
pub default_shipping_address: Option<Encryption>,
Expand Down Expand Up @@ -208,6 +214,7 @@ pub struct CustomerUpdateInternal {
pub updated_by: Option<String>,
pub tax_registration_id: Option<Encryption>,
pub last_modified_by: Option<String>,
pub customer_document_number: Option<Encryption>,
}

#[cfg(feature = "v1")]
Expand All @@ -224,6 +231,7 @@ impl CustomerUpdateInternal {
address_id,
default_payment_method_id,
tax_registration_id,
customer_document_number,
last_modified_by,
..
} = self;
Expand All @@ -242,6 +250,8 @@ impl CustomerUpdateInternal {
.flatten()
.map_or(source.default_payment_method_id, Some),
tax_registration_id: tax_registration_id.map_or(source.tax_registration_id, Some),
customer_document_number: customer_document_number
.map_or(source.customer_document_number, Some),
last_modified_by: last_modified_by.or(source.last_modified_by),
..source
}
Expand Down Expand Up @@ -269,6 +279,7 @@ pub struct CustomerUpdateInternal {
pub status: Option<DeleteStatus>,
pub tax_registration_id: Option<Encryption>,
pub last_modified_by: Option<String>,
pub customer_document_number: Option<Encryption>,
}

#[cfg(feature = "v2")]
Expand All @@ -287,6 +298,7 @@ impl CustomerUpdateInternal {
default_shipping_address,
status,
tax_registration_id,
customer_document_number,
last_modified_by,
..
} = self;
Expand All @@ -309,6 +321,8 @@ impl CustomerUpdateInternal {
.map_or(source.default_shipping_address, Some),
status: status.unwrap_or(source.status),
tax_registration_id: tax_registration_id.map_or(source.tax_registration_id, Some),
customer_document_number: customer_document_number
.map_or(source.customer_document_number, Some),
last_modified_by: last_modified_by.or(source.last_modified_by),
..source
}
Expand Down
Loading
Loading