1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types\Payments\Query; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
use TelegramBot\Api\Types\Payments\OrderInfo; |
7
|
|
|
use TelegramBot\Api\Types\User; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class PreCheckoutQuery |
11
|
|
|
* This object contains information about an incoming pre-checkout query. |
12
|
|
|
* |
13
|
|
|
* @package TelegramBot\Api\Types\Payments\Query |
14
|
|
|
*/ |
15
|
|
|
class PreCheckoutQuery extends BaseType |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @var array |
19
|
|
|
*/ |
20
|
|
|
protected static $requiredParams = ['id', 'from', 'currency', 'total_amount', 'invoice_payload']; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
protected static $map = [ |
26
|
|
|
'id' => true, |
27
|
|
|
'from' => User::class, |
28
|
|
|
'currency' => true, |
29
|
|
|
'total_amount' => true, |
30
|
|
|
'invoice_payload' => true, |
31
|
|
|
'shipping_option_id' => true, |
32
|
|
|
'order_info' => OrderInfo::class |
33
|
|
|
]; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Unique query identifier |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
protected $id; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* User who sent the query |
44
|
|
|
* |
45
|
|
|
* @var User |
46
|
|
|
*/ |
47
|
|
|
protected $from; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Three-letter ISO 4217 currency code |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
protected $currency; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Total price in the smallest units of the currency |
58
|
|
|
* |
59
|
|
|
* @var integer |
60
|
|
|
*/ |
61
|
|
|
protected $totalAmount; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Bot specified invoice payload |
65
|
|
|
* |
66
|
|
|
* @var string |
67
|
|
|
*/ |
68
|
|
|
protected $invoicePayload; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Optional. Identifier of the shipping option chosen by the user |
72
|
|
|
* |
73
|
|
|
* @var string|null |
74
|
|
|
*/ |
75
|
|
|
protected $shippingOptionId; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Optional. Order info provided by the user |
79
|
|
|
* |
80
|
|
|
* @var OrderInfo|null |
81
|
|
|
*/ |
82
|
|
|
protected $orderInfo; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @author MY |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getId() |
89
|
|
|
{ |
90
|
|
|
return $this->id; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @author MY |
95
|
|
|
* |
96
|
|
|
* @param string $id |
97
|
|
|
* |
98
|
|
|
* @return void |
99
|
|
|
*/ |
100
|
|
|
public function setId($id) |
101
|
|
|
{ |
102
|
|
|
$this->id = $id; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @author MY |
107
|
|
|
* @return User |
108
|
|
|
*/ |
109
|
|
|
public function getFrom() |
110
|
|
|
{ |
111
|
|
|
return $this->from; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @author MY |
116
|
|
|
* |
117
|
|
|
* @param User $from |
118
|
|
|
* |
119
|
|
|
* @return void |
120
|
|
|
*/ |
121
|
|
|
public function setFrom($from) |
122
|
|
|
{ |
123
|
|
|
$this->from = $from; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @author MY |
128
|
|
|
* @return string |
129
|
|
|
*/ |
130
|
|
|
public function getCurrency() |
131
|
|
|
{ |
132
|
|
|
return $this->currency; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @author MY |
137
|
|
|
* |
138
|
|
|
* @param string $currency |
139
|
|
|
* |
140
|
|
|
* @return void |
141
|
|
|
*/ |
142
|
|
|
public function setCurrency($currency) |
143
|
|
|
{ |
144
|
|
|
$this->currency = $currency; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @author MY |
149
|
|
|
* @return int |
150
|
|
|
*/ |
151
|
|
|
public function getTotalAmount() |
152
|
|
|
{ |
153
|
|
|
return $this->totalAmount; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @author MY |
158
|
|
|
* |
159
|
|
|
* @param int $totalAmount |
160
|
|
|
* |
161
|
|
|
* @return void |
162
|
|
|
*/ |
163
|
|
|
public function setTotalAmount($totalAmount) |
164
|
|
|
{ |
165
|
|
|
$this->totalAmount = $totalAmount; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @author MY |
170
|
|
|
* @return mixed |
171
|
|
|
*/ |
172
|
|
|
public function getInvoicePayload() |
173
|
|
|
{ |
174
|
|
|
return $this->invoicePayload; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @author MY |
179
|
|
|
* |
180
|
|
|
* @param mixed $invoicePayload |
181
|
|
|
* |
182
|
|
|
* @return void |
183
|
|
|
*/ |
184
|
|
|
public function setInvoicePayload($invoicePayload) |
185
|
|
|
{ |
186
|
|
|
$this->invoicePayload = $invoicePayload; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @author MY |
191
|
|
|
* |
192
|
|
|
* @return null|string |
193
|
|
|
*/ |
194
|
|
|
public function getShippingOptionId() |
195
|
|
|
{ |
196
|
|
|
return $this->shippingOptionId; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @author MY |
201
|
|
|
* |
202
|
|
|
* @param string $shippingOptionId |
203
|
|
|
* |
204
|
|
|
* @return void |
205
|
|
|
*/ |
206
|
|
|
public function setShippingOptionId($shippingOptionId) |
207
|
|
|
{ |
208
|
|
|
$this->shippingOptionId = $shippingOptionId; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @author MY |
213
|
|
|
* |
214
|
|
|
* @return OrderInfo|null |
215
|
|
|
*/ |
216
|
|
|
public function getOrderInfo() |
217
|
|
|
{ |
218
|
|
|
return $this->orderInfo; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @author MY |
223
|
|
|
* |
224
|
|
|
* @param OrderInfo $orderInfo |
225
|
|
|
* |
226
|
|
|
* @return void |
227
|
|
|
*/ |
228
|
|
|
public function setOrderInfo($orderInfo) |
229
|
|
|
{ |
230
|
|
|
$this->orderInfo = $orderInfo; |
231
|
|
|
} |
232
|
|
|
} |
233
|
|
|
|