1 module telega.telegram.payments;
2 
3 import std.typecons : Nullable;
4 import telega.telegram.basic : User;
5 
6 
7 /*** Payments types ***/
8 struct LabeledPrice
9 {
10     string label;
11     uint   amount;
12 }
13 
14 struct Invoice
15 {
16     string title;
17     string description;
18     string start_parameter;
19     string currency;
20     uint   total_amount;
21 }
22 
23 struct ShippingAddress
24 {
25     string country_code;
26     string state;
27     string city;
28     string street_line1;
29     string street_line2;
30     string post_code;
31 }
32 
33 // TODO add nullable fields
34 struct OrderInfo
35 {
36     string name;
37     string phone_number;
38     string email;
39     Nullable!ShippingAddress shipping_address;
40 }
41 
42 struct ShippingOption
43 {
44     string id;
45     string title;
46     LabeledPrice[] prices;
47 }
48 
49 // TODO add nullable fields
50 struct SuccessfulPayment
51 {
52     string currency;
53     uint   total_amount;
54     string invoice_payload;
55     string shipping_option_id;
56     Nullable!OrderInfo order_info;
57     string telegram_payment_charge_id;
58     string provider_payment_charge_id;
59 }
60 
61 struct ShippingQuery
62 {
63     string id;
64     User   from;
65     string invoice_payload;
66     ShippingAddress shipping_address;
67 }
68 
69 // TODO add nullable fields
70 struct PreCheckoutQuery
71 {
72     string             id;
73     User               from;
74     string             currency;
75     uint               total_amount;
76     string             invoice_payload;
77     string             shipping_option_id;
78     Nullable!OrderInfo order_info;
79 }