Repository: juspay/hyperswitch
File: crates/api_models/src/payments.rs (Rust)

Code before:
    pub connector: Option<String>,
}

#[derive(Debug, serde::Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum SupportedWallets {
    Paypal,
    ApplePay,
    Klarna,
    Gpay,
}

#[derive(Debug, Default, serde::Deserialize, serde::Serialize, Clone)]
pub struct OrderDetails {
    pub product_name: String,
    pub quantity: u16,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct PaymentsSessionRequest {
    pub payment_id: String,
    pub client_secret: String,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpayAllowedMethodsParameters {
    pub allowed_auth_methods: Vec<String>,
    pub allowed_card_networks: Vec<String>,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpayTokenParameters {
    pub gateway: String,
    pub gateway_merchant_id: String,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpayTokenizationSpecification {
    #[serde(rename = "type")]
    pub token_specification_type: String,
    pub parameters: GpayTokenParameters,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpayAllowedPaymentMethods {
    #[serde(rename = "type")]
    pub payment_method_type: String,
    pub parameters: GpayAllowedMethodsParameters,
    pub tokenization_specification: GpayTokenizationSpecification,
}


Review comment (suggestion):
**🟡 Important - Serialization Asymmetry**

This creates an asymmetric serialization/deserialization behavior:
- **Serialization**: Uses camelCase (via the new attribute)
- **Deserialization**: Uses snake_case (Rust default)

**Issue**: If this data is ever round-tripped (deserialized then serialized), the field names won't match.

**Suggested Fix**: Either apply the rename to both serialize and deserialize:
```rust
#[serde(rename_all = "camelCase")]
```

Or if only serialization needs camelCase, add a comment explaining why deserialization should remain snake_case.

Code after:
    pub connector: Option<String>,
}

#[derive(Debug, serde::Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum SupportedWallets {
    Paypal,
    ApplePay,
    Klarna,
    Gpay,
}

#[derive(Debug, Default, serde::Deserialize, serde::Serialize, Clone)]
pub struct OrderDetails {
    pub product_name: String,
    pub quantity: u16,
}

#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct PaymentsSessionRequest {
    pub payment_id: String,
    pub client_secret: String,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all(serialize = "camelCase"))]
pub struct GpayAllowedMethodsParameters {
    pub allowed_auth_methods: Vec<String>,
    pub allowed_card_networks: Vec<String>,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all(serialize = "camelCase"))]
pub struct GpayTokenParameters {
    pub gateway: String,
    pub gateway_merchant_id: String,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all(serialize = "camelCase"))]
pub struct GpayTokenizationSpecification {
    #[serde(rename = "type")]
    pub token_specification_type: String,
    pub parameters: GpayTokenParameters,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all(serialize = "camelCase"))]
pub struct GpayAllowedPaymentMethods {
    #[serde(rename = "type")]
    pub payment_method_type: String,