Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(api_models): remove deny_unknown_fields from v2 customers and payment_methods DTOs (#14287)

Shankar Singh C62be2f9e511d
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 2d321c5881..4bc42dd357 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -14290,8 +14290,7 @@
],
"nullable": true
}
- },
- "additionalProperties": false
+ }
},
"CustomerResponse": {
"type": "object",
@@ -14488,8 +14487,7 @@
],
"nullable": true
}
- },
- "additionalProperties": false
+ }
},
"DDCData": {
"type": "object",
@@ -23473,8 +23471,7 @@
"storage_type": {
"$ref": "#/components/schemas/StorageType"
}
- },
- "additionalProperties": false
+ }
},
"PaymentMethodCreateData": {
"oneOf": [
@@ -24148,8 +24145,7 @@
"payment_method_subtype": {
"$ref": "#/components/schemas/PaymentMethodType"
}
- },
- "additionalProperties": false
+ }
},
"PaymentMethodIntentCreate": {
"type": "object",
@@ -24177,8 +24173,7 @@
"maxLength": 64,
"minLength": 32
}
- },
- "additionalProperties": false
+ }
},
"PaymentMethodIssuerCode": {
"type": "string",
@@ -24553,8 +24548,7 @@
"type": "boolean",
"description": "Trigger an Account Updater check for the stored payment method."
}
- },
- "additionalProperties": false
+ }
},
"PaymentMethodSessionConfirmRequest": {
"type": "object",
@@ -25025,8 +25019,7 @@
],
"nullable": true
}
- },
- "additionalProperties": false
+ }
},
"PaymentMethodUpdateData": {
"oneOf": [
diff --git a/crates/api_models/src/customers.rs b/crates/api_models/src/customers.rs
index a301782ee6..61e05be5ea 100644
--- a/crates/api_models/src/customers.rs
+++ b/crates/api_models/src/customers.rs
@@ -126,7 +126,6 @@ impl CustomerRequest {
/// The customer details
#[cfg(feature = "v2")]
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
-#[serde(deny_unknown_fields)]
pub struct CustomerRequest {
/// The merchant identifier for the customer object.
#[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
@@ -418,7 +417,6 @@ impl CustomerUpdateRequest {
#[cfg(feature = "v2")]
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
-#[serde(deny_unknown_fields)]
pub struct CustomerUpdateRequest {
/// The customer's name
#[schema(max_length = 255, value_type = String, example = "Jon Test")]
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index ec18c476c5..3377d7832f 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -119,7 +119,6 @@ pub struct PaymentMethodCreate {
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
-#[serde(deny_unknown_fields)]
pub struct PaymentMethodRetrieveRequest {
#[serde(default)]
pub fetch_raw_detail: bool,
@@ -130,7 +129,6 @@ pub struct PaymentMethodRetrieveRequest {
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
-#[serde(deny_unknown_fields)]
pub struct PaymentMethodCreate {
/// The type of payment method use for the payment.
#[schema(value_type = PaymentMethod,example = "card")]
@@ -171,7 +169,6 @@ pub struct PaymentMethodCreate {
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
-#[serde(deny_unknown_fields)]
pub struct PaymentMethodIntentCreate {
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
@@ -193,7 +190,6 @@ pub struct PaymentMethodIntentCreate {
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
-#[serde(deny_unknown_fields)]
pub struct PaymentMethodIntentConfirm {
/// The unique identifier of the customer.
#[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
@@ -573,7 +569,6 @@ pub struct PaymentMethodUpdate {
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
-#[serde(deny_unknown_fields)]
pub struct PaymentMethodUpdate {
/// Payment method details to be updated for the payment_method
pub payment_method_data: Option<PaymentMethodUpdateData>,
@@ -593,7 +588,6 @@ pub struct PaymentMethodUpdate {
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, ToSchema)]
-#[serde(deny_unknown_fields)]
#[serde(rename_all = "snake_case")]
#[serde(rename = "payment_method_data")]
pub enum PaymentMethodUpdateData {
@@ -631,7 +625,6 @@ pub enum BankRedirectDetail {
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
-#[serde(deny_unknown_fields)]
#[serde(rename_all = "snake_case")]
#[serde(rename = "payment_method_data")]
pub enum PaymentMethodCreateData {