app_store_server_library/primitives/
transaction_history_request.rs1use crate::primitives::in_app_ownership_type::InAppOwnershipType;
2use chrono::{DateTime, Utc};
3use serde::{Deserialize, Serialize};
4use serde_with::formats::Flexible;
5use serde_with::TimestampMilliSeconds;
6
7#[serde_with::serde_as]
8#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
9pub struct TransactionHistoryRequest {
10 #[serde(rename = "startDate")]
12 #[serde_as(as = "Option<TimestampMilliSeconds<String, Flexible>>")]
13 pub start_date: Option<DateTime<Utc>>,
14
15 #[serde(rename = "endDate")]
17 #[serde_as(as = "Option<TimestampMilliSeconds<String, Flexible>>")]
18 pub end_date: Option<DateTime<Utc>>,
19
20 #[serde(rename = "productIds")]
22 pub product_ids: Option<Vec<String>>,
23
24 #[serde(rename = "productTypes")]
26 pub product_types: Option<Vec<ProductType>>,
27
28 pub sort: Option<Order>,
30
31 #[serde(rename = "subscriptionGroupIdentifiers")]
33 pub subscription_group_identifiers: Option<Vec<String>>,
34
35 #[serde(rename = "inAppOwnershipType")]
37 pub in_app_ownership_type: Option<InAppOwnershipType>,
38
39 pub revoked: Option<bool>,
41}
42
43#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
44pub enum ProductType {
45 #[serde(rename = "AUTO_RENEWABLE")]
46 AutoRenewable,
47 #[serde(rename = "NON_RENEWABLE")]
48 NonRenewable,
49 #[serde(rename = "CONSUMABLE")]
50 Consumable,
51 #[serde(rename = "NON_CONSUMABLE")]
52 NonConsumable,
53}
54
55impl ProductType {
56 pub fn raw_value(&self) -> &str {
57 match self {
58 ProductType::AutoRenewable => "AUTO_RENEWABLE",
59 ProductType::NonRenewable => "NON_RENEWABLE",
60 ProductType::Consumable => "CONSUMABLE",
61 ProductType::NonConsumable => "NON_CONSUMABLE",
62 }
63 }
64}
65
66#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
67pub enum Order {
68 #[serde(rename = "ASCENDING")]
69 Ascending,
70 #[serde(rename = "DESCENDING")]
71 Descending,
72}
73
74impl Order {
75 pub fn raw_value(&self) -> &str {
76 match self {
77 Order::Ascending => "ASCENDING",
78 Order::Descending => "DESCENDING",
79 }
80 }
81}