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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use serde::{Deserialize, Serialize};
use crate::models::advanced_commerce_effective::AdvancedCommerceEffective;
use crate::models::advanced_commerce_offer::AdvancedCommerceOffer;
use crate::models::advanced_commerce_reason::AdvancedCommerceReason;
/// The data your app provides to change an item of an auto-renewable subscription.
///
/// [AdvancedCommerceSubscriptionModifyChangeItem](https://developer.apple.com/documentation/advancedcommerceapi/subscriptionmodifychangeitem)
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AdvancedCommerceSubscriptionModifyChangeItem {
/// The new SKU identifier for the item.
///
/// [SKU](https://developer.apple.com/documentation/advancedcommerceapi/sku)
#[serde(rename = "SKU")]
pub sku: String,
/// The original SKU of the item.
///
/// [currentSKU](https://developer.apple.com/documentation/advancedcommerceapi/sku)
#[serde(rename = "currentSKU")]
pub current_sku: String,
/// The description of the item.
///
/// [Description](https://developer.apple.com/documentation/advancedcommerceapi/description)
pub description: String,
/// The display name of the item.
///
/// [Display Name](https://developer.apple.com/documentation/advancedcommerceapi/displayname)
pub display_name: String,
/// When the change takes effect.
///
/// [AdvancedCommerceEffective](https://developer.apple.com/documentation/advancedcommerceapi/effective)
pub effective: AdvancedCommerceEffective,
/// The price in milliunits.
///
/// [Price](https://developer.apple.com/documentation/advancedcommerceapi/price)
pub price: i64,
/// The reason for the change.
///
/// [AdvancedCommerceReason](https://developer.apple.com/documentation/advancedcommerceapi/reason)
pub reason: AdvancedCommerceReason,
/// An offer for the item.
///
/// [AdvancedCommerceOffer](https://developer.apple.com/documentation/advancedcommerceapi/offer)
#[serde(skip_serializing_if = "Option::is_none")]
pub offer: Option<AdvancedCommerceOffer>,
/// The prorated price for the item.
///
/// [ProratedPrice](https://developer.apple.com/documentation/advancedcommerceapi/proratedprice)
#[serde(skip_serializing_if = "Option::is_none")]
pub prorated_price: Option<i64>,
}
impl AdvancedCommerceSubscriptionModifyChangeItem {
pub fn new(
sku: String,
current_sku: String,
description: String,
display_name: String,
effective: AdvancedCommerceEffective,
price: i64,
reason: AdvancedCommerceReason,
) -> Self {
Self {
sku,
current_sku,
description,
display_name,
effective,
price,
reason,
offer: None,
prorated_price: None,
}
}
pub fn with_offer(mut self, offer: AdvancedCommerceOffer) -> Self {
self.offer = Some(offer);
self
}
pub fn with_prorated_price(mut self, prorated_price: i64) -> Self {
self.prorated_price = Some(prorated_price);
self
}
}