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
use serde::{Deserialize, Serialize};
use crate::models::advanced_commerce_offer::AdvancedCommerceOffer;
/// The data your app provides to add items when it makes changes to an auto-renewable subscription.
///
/// [AdvancedCommerceSubscriptionModifyAddItem](https://developer.apple.com/documentation/advancedcommerceapi/subscriptionmodifyadditem)
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AdvancedCommerceSubscriptionModifyAddItem {
/// The item's product identifier.
///
/// [SKU](https://developer.apple.com/documentation/advancedcommerceapi/sku)
#[serde(rename = "SKU")]
pub 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,
/// The price in milliunits.
///
/// [Price](https://developer.apple.com/documentation/advancedcommerceapi/price)
pub price: i64,
/// 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 AdvancedCommerceSubscriptionModifyAddItem {
pub fn new(sku: String, description: String, display_name: String, price: i64) -> Self {
Self {
sku,
description,
display_name,
price,
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
}
}