1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* public
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.87.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// PatchDiscountRequest : Request body for patching (updating) a discount. All fields are optional and only update if provided.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PatchDiscountRequest {
/// If present, update the discount amount: - If `discount_type` is `percentage`, this represents **basis points** (e.g., `540` = `5.4%`). - Otherwise, this represents **USD cents** (e.g., `100` = `$1.00`). Must be at least 1 if provided.
#[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
pub amount: Option<i32>,
/// If present, update the discount code (uppercase).
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
pub expires_at: Option<String>,
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Whether this discount should be preserved when a subscription changes plans. If not provided, the existing value is kept.
#[serde(rename = "preserve_on_plan_change", skip_serializing_if = "Option::is_none")]
pub preserve_on_plan_change: Option<bool>,
/// If present, replaces all restricted product IDs with this new set. To remove all restrictions, send empty array
#[serde(rename = "restricted_to", skip_serializing_if = "Option::is_none")]
pub restricted_to: Option<Vec<String>>,
/// Number of subscription billing cycles this discount is valid for. If not provided, the discount will be applied indefinitely to all recurring payments related to the subscription.
#[serde(rename = "subscription_cycles", skip_serializing_if = "Option::is_none")]
pub subscription_cycles: Option<i32>,
/// If present, update the discount type.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<models::DiscountType>,
#[serde(rename = "usage_limit", skip_serializing_if = "Option::is_none")]
pub usage_limit: Option<i32>,
}
impl PatchDiscountRequest {
/// Request body for patching (updating) a discount. All fields are optional and only update if provided.
pub fn new() -> PatchDiscountRequest {
PatchDiscountRequest {
amount: None,
code: None,
expires_at: None,
name: None,
preserve_on_plan_change: None,
restricted_to: None,
subscription_cycles: None,
r#type: None,
usage_limit: None,
}
}
}