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

Code before:
    pub customer_id: Option<CustomerId>,
    pub billing: Option<Address>,
    pub shipping: Option<Address>,
    pub profile_id: Option<ProfileId>,
    pub setup_future_usage: Option<FutureUsage>,
    /// The url to which user must be redirected to after completion of the purchase
    #[schema(value_type = Option<String>)]
    pub return_url: Option<Url>,
    pub capture_method: Option<CaptureMethod>,
    pub authentication_type: Option<AuthenticationType>,
}

#[derive(Debug, Clone, serde::Serialize, ToSchema)]
pub struct ConfirmPaymentsRequestData {
    pub billing: Option<Address>,
    pub shipping: Option<Address>,
    pub profile_id: Option<ProfileId>,
    pub payment_method: PaymentMethod,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_type: Option<PaymentMethodType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_data: Option<PaymentMethodDataRequest>,
    pub customer_acceptance: Option<CustomerAcceptance>,
    pub payment_type: Option<PaymentType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_token: Option<String>,
}

#[derive(Debug, Clone, serde::Serialize, ToSchema)]
pub struct CreateAndConfirmPaymentsRequestData {
    pub amount: MinorUnit,
    pub currency: Currency,
    pub customer_id: Option<CustomerId>,
    pub confirm: bool,
    pub billing: Option<Address>,
    pub shipping: Option<Address>,
    pub profile_id: Option<ProfileId>,
    pub setup_future_usage: Option<FutureUsage>,
    /// The url to which user must be redirected to after completion of the purchase
    #[schema(value_type = Option<String>)]
    pub return_url: Option<Url>,
    pub capture_method: Option<CaptureMethod>,
    pub authentication_type: Option<AuthenticationType>,
    pub payment_method: Option<PaymentMethod>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_type: Option<PaymentMethodType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_data: Option<PaymentMethodDataRequest>,
    pub customer_acceptance: Option<CustomerAcceptance>,
    pub payment_type: Option<PaymentType>,
    #[serde(skip_serializing_if = "Option::is_none")]

Review comment (security):
```suggestion
    pub payment_token: Option<Secret<String>>,
```

Code after:
    pub amount: MinorUnit,
    pub currency: Currency,
    pub customer_id: Option<CustomerId>,
    pub billing: Option<Address>,
    pub shipping: Option<Address>,
    pub profile_id: Option<ProfileId>,
    pub setup_future_usage: Option<FutureUsage>,
    /// The url to which user must be redirected to after completion of the purchase
    #[schema(value_type = Option<String>)]
    pub return_url: Option<Url>,
    pub capture_method: Option<CaptureMethod>,
    pub authentication_type: Option<AuthenticationType>,
}

#[derive(Debug, Clone, serde::Serialize, ToSchema)]
pub struct ConfirmPaymentsRequestData {
    pub billing: Option<Address>,
    pub shipping: Option<Address>,
    pub profile_id: Option<ProfileId>,
    pub payment_method: PaymentMethod,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_type: Option<PaymentMethodType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_data: Option<PaymentMethodDataRequest>,
    pub customer_acceptance: Option<CustomerAcceptance>,
    pub payment_type: Option<PaymentType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schema(value_type = Option<String>, example = "token_sxJdmpUnpNsJk5VWzcjl")]
    pub payment_token: Option<Secret<String>>,
}

#[derive(Debug, Clone, serde::Serialize, ToSchema)]
pub struct CreateAndConfirmPaymentsRequestData {
    pub amount: MinorUnit,
    pub currency: Currency,
    pub customer_id: Option<CustomerId>,
    pub confirm: bool,
    pub billing: Option<Address>,
    pub shipping: Option<Address>,
    pub profile_id: Option<ProfileId>,
    pub setup_future_usage: Option<FutureUsage>,
    /// The url to which user must be redirected to after completion of the purchase
    #[schema(value_type = Option<String>)]
    pub return_url: Option<Url>,
    pub capture_method: Option<CaptureMethod>,
    pub authentication_type: Option<AuthenticationType>,
    pub payment_method: Option<PaymentMethod>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_type: Option<PaymentMethodType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_method_data: Option<PaymentMethodDataRequest>,