app_store_server_library/primitives/
external_purchase_token.rs

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