|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Zanzara\Telegram\Type\Shipping; |
|
6
|
|
|
|
|
7
|
|
|
use Zanzara\Telegram\Type\User; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* This object contains information about an incoming pre-checkout query. |
|
11
|
|
|
* |
|
12
|
|
|
* More on https://core.telegram.org/bots/api#precheckoutquery |
|
13
|
|
|
*/ |
|
14
|
|
|
class PreCheckoutQuery |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Unique query identifier |
|
19
|
|
|
* |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
private $id; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* User who sent the query |
|
26
|
|
|
* |
|
27
|
|
|
* @var User |
|
28
|
|
|
*/ |
|
29
|
|
|
private $from; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Three-letter ISO 4217 currency code |
|
33
|
|
|
* |
|
34
|
|
|
* @var string |
|
35
|
|
|
*/ |
|
36
|
|
|
private $currency; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 |
|
40
|
|
|
* pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point |
|
41
|
|
|
* for each currency (2 for the majority of currencies). |
|
42
|
|
|
* |
|
43
|
|
|
* @var int |
|
44
|
|
|
*/ |
|
45
|
|
|
private $total_amount; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Bot specified invoice payload |
|
49
|
|
|
* |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
private $invoice_payload; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Optional. Identifier of the shipping option chosen by the user |
|
56
|
|
|
* |
|
57
|
|
|
* @var string|null |
|
58
|
|
|
*/ |
|
59
|
|
|
private $shipping_option_id; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Optional. Order info provided by the user |
|
63
|
|
|
* |
|
64
|
|
|
* @var OrderInfo|null |
|
65
|
|
|
*/ |
|
66
|
|
|
private $order_info; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @return string |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getId(): string |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->id; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @param string $id |
|
78
|
|
|
*/ |
|
79
|
|
|
public function setId(string $id): void |
|
80
|
|
|
{ |
|
81
|
|
|
$this->id = $id; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return User |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getFrom(): User |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->from; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @param User $from |
|
94
|
|
|
*/ |
|
95
|
|
|
public function setFrom(User $from): void |
|
96
|
|
|
{ |
|
97
|
|
|
$this->from = $from; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getCurrency(): string |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->currency; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @param string $currency |
|
110
|
|
|
*/ |
|
111
|
|
|
public function setCurrency(string $currency): void |
|
112
|
|
|
{ |
|
113
|
|
|
$this->currency = $currency; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return int |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getTotalAmount(): int |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->total_amount; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @param int $total_amount |
|
126
|
|
|
*/ |
|
127
|
|
|
public function setTotalAmount(int $total_amount): void |
|
128
|
|
|
{ |
|
129
|
|
|
$this->total_amount = $total_amount; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return string |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getInvoicePayload(): string |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->invoice_payload; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @param string $invoice_payload |
|
142
|
|
|
*/ |
|
143
|
|
|
public function setInvoicePayload(string $invoice_payload): void |
|
144
|
|
|
{ |
|
145
|
|
|
$this->invoice_payload = $invoice_payload; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* @return string|null |
|
150
|
|
|
*/ |
|
151
|
|
|
public function getShippingOptionId(): ?string |
|
152
|
|
|
{ |
|
153
|
|
|
return $this->shipping_option_id; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* @param string|null $shipping_option_id |
|
158
|
|
|
*/ |
|
159
|
|
|
public function setShippingOptionId(?string $shipping_option_id): void |
|
160
|
|
|
{ |
|
161
|
|
|
$this->shipping_option_id = $shipping_option_id; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @return OrderInfo|null |
|
166
|
|
|
*/ |
|
167
|
|
|
public function getOrderInfo(): ?OrderInfo |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->order_info; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* @param OrderInfo|null $order_info |
|
174
|
|
|
*/ |
|
175
|
|
|
public function setOrderInfo(?OrderInfo $order_info): void |
|
176
|
|
|
{ |
|
177
|
|
|
$this->order_info = $order_info; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
} |