app_store_server_library/models/external_purchase_token.rs
1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use serde_with::formats::Flexible;
4use serde_with::TimestampMilliSeconds;
5
6use crate::models::token_type::TokenType;
7
8/// The payload data that contains an external purchase token.
9///
10/// [externalPurchaseToken](https://developer.apple.com/documentation/appstoreservernotifications/externalpurchasetoken)
11#[serde_with::serde_as]
12#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
13pub struct ExternalPurchaseToken {
14 /// The field of an external purchase token that uniquely identifies the token.
15 ///
16 /// [externalPurchaseId](https://developer.apple.com/documentation/appstoreservernotifications/externalpurchaseid)
17 #[serde(rename = "externalPurchaseId")]
18 pub external_purchase_id: Option<String>,
19
20 /// The field of an external purchase token that contains the UNIX date, in milliseconds,
21 /// when the system created the token.
22 ///
23 /// [tokenCreationDate](https://developer.apple.com/documentation/appstoreservernotifications/tokencreationdate)
24 #[serde(rename = "tokenCreationDate")]
25 #[serde_as(as = "Option<TimestampMilliSeconds<String, Flexible>>")]
26 pub token_creation_date: Option<DateTime<Utc>>,
27
28 /// The unique identifier of an app in the App Store.
29 ///
30 /// [appAppleId](https://developer.apple.com/documentation/appstoreservernotifications/appappleid)
31 #[serde(rename = "appAppleId")]
32 pub app_apple_id: Option<i64>,
33
34 /// The bundle identifier of an app.
35 ///
36 /// [bundleId](https://developer.apple.com/documentation/appstoreservernotifications/bundleid)
37 #[serde(rename = "bundleId")]
38 pub bundle_id: Option<String>,
39
40 /// The UNIX time, in milliseconds, when a token expires. This field is present only for custom link tokens.
41 ///
42 /// [tokenExpirationDate](https://developer.apple.com/documentation/appstoreservernotifications/tokenexpirationdate)
43 #[serde(rename = "tokenExpirationDate")]
44 #[serde_as(as = "Option<TimestampMilliSeconds<String, Flexible>>")]
45 pub token_expiration_date: Option<DateTime<Utc>>,
46
47 /// The type of an external purchase custom link token.
48 ///
49 /// [tokenType](https://developer.apple.com/documentation/appstoreservernotifications/tokentype)
50 #[serde(rename = "tokenType")]
51 pub token_type: Option<TokenType>,
52}