1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Deserialize, Serialize)]
4#[serde(rename_all = "camelCase")]
5pub struct PingRequest {
6 pub value: Option<String>,
7}
8
9#[derive(Debug, Clone, Default, Deserialize, Serialize)]
10#[serde(rename_all = "camelCase")]
11pub struct PingResponse {
12 pub value: Option<String>,
13}
14
15#[derive(Debug, Clone, Default, Deserialize, Serialize)]
16#[serde(rename_all = "camelCase")]
17pub struct PurchaseRequest {
18 pub product_id: String,
20}
21
22#[derive(Debug, Clone, Default, Deserialize, Serialize)]
23#[serde(rename_all = "camelCase")]
24pub struct SubscriptionPurchaseRequest {
25 pub product_id: String,
27 pub base_plan_id: Option<String>,
29 pub offer_token: Option<String>,
31}
32
33#[derive(Debug, Clone, Default, Deserialize, Serialize)]
34#[serde(rename_all = "camelCase")]
35pub struct ConsumeRequest {
36 pub purchase_token: String,
38}
39
40#[derive(Debug, Clone, Default, Deserialize, Serialize)]
41#[serde(rename_all = "camelCase")]
42pub struct SubscriptionListRequest {
43 pub product_ids: Vec<String>,
45}
46
47#[derive(Debug, Clone, Default, Deserialize, Serialize)]
48#[serde(rename_all = "camelCase")]
49pub struct PurchaseResponse {
50 pub success: bool,
52}
53
54#[derive(Debug, Clone, Default, Deserialize, Serialize)]
55#[serde(rename_all = "camelCase")]
56pub struct SubscriptionPurchaseResponse {
57 pub success: bool,
59 pub purchase_token: Option<String>,
61 pub order_id: Option<String>,
63 pub is_auto_renewing: Option<bool>,
65 pub pending: Option<bool>,
67 pub base_plan_id: Option<String>,
69 pub offer_token: Option<String>,
71 pub product_id: Option<String>,
73 pub price: Option<String>,
75}
76
77#[derive(Debug, Clone, Default, Deserialize, Serialize)]
78#[serde(rename_all = "camelCase")]
79pub struct Product {
80 pub description: String,
81 pub name: String,
82 pub product_id: String,
83 pub product_type: String,
84 pub title: String,
85 pub price: String,
86}
87
88#[derive(Debug, Clone, Default, Deserialize, Serialize)]
89#[serde(rename_all = "camelCase")]
90pub struct SubscriptionProduct {
91 pub description: String,
92 pub name: String,
93 pub product_id: String,
94 pub product_type: String,
95 pub title: String,
96 pub price: String,
97 pub base_plans: Option<Vec<BasePlan>>,
99}
100
101#[derive(Debug, Clone, Default, Deserialize, Serialize)]
102#[serde(rename_all = "camelCase")]
103pub struct BasePlan {
104 pub base_plan_id: String,
106 pub name: String,
108 pub price: String,
110 pub billing_period: String,
112 pub is_default: Option<bool>,
114}
115
116#[derive(Debug, Clone, Default, Deserialize, Serialize)]
117#[serde(rename_all = "camelCase")]
118pub struct Purchase {
119 pub developer_payload: String,
120 pub order_id: Option<String>,
121 pub original_json: String,
122 pub package_name: String,
123 pub products: Vec<String>,
124 pub purchase_state: i32,
125 pub purchase_time: i128,
126 pub purchase_token: String,
127 pub quantity: i32,
128 pub signature: String,
129 pub is_acknowledged: bool,
130 pub is_auto_renewing: bool,
131}
132
133#[derive(Debug, Clone, Default, Deserialize, Serialize)]
134#[serde(rename_all = "camelCase")]
135pub struct ProductsResponse {
136 pub products: Vec<Product>,
138}
139
140#[derive(Debug, Clone, Default, Deserialize, Serialize)]
141#[serde(rename_all = "camelCase")]
142pub struct PurchasesResponse {
143 pub purchases: Vec<Purchase>,
145}
146
147#[derive(Debug, Clone, Default, Deserialize, Serialize)]
148#[serde(rename_all = "camelCase")]
149pub struct SubscriptionListResponse {
150 pub subscriptions: Vec<SubscriptionProduct>,
152}