1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Bip70\Protobuf\Proto; |
6
|
|
|
|
7
|
|
|
use DrSlump\Protobuf; |
8
|
|
|
use DrSlump\Protobuf\Descriptor; |
9
|
|
|
use DrSlump\Protobuf\Field; |
10
|
|
|
use DrSlump\Protobuf\Message; |
11
|
|
|
|
12
|
|
|
class PaymentDetails extends Message |
13
|
|
|
{ |
14
|
|
|
|
15
|
|
|
/** @var string */ |
16
|
|
|
public $network = 'main'; |
17
|
|
|
|
18
|
|
|
/** @var \Bip70\Protobuf\Proto\Output[] */ |
19
|
|
|
public $outputs = array(); |
20
|
|
|
|
21
|
|
|
/** @var int */ |
22
|
|
|
public $time; |
23
|
|
|
|
24
|
|
|
/** @var int */ |
25
|
|
|
public $expires; |
26
|
|
|
|
27
|
|
|
/** @var string */ |
28
|
|
|
public $memo; |
29
|
|
|
|
30
|
|
|
/** @var string */ |
31
|
|
|
public $payment_url; |
32
|
|
|
|
33
|
|
|
/** @var string */ |
34
|
|
|
public $merchant_data; |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/** @var \Closure[] */ |
38
|
|
|
protected static $__extensions = array(); |
39
|
|
|
|
40
|
1 |
|
public static function descriptor() |
41
|
|
|
{ |
42
|
1 |
|
$descriptor = new Descriptor(__CLASS__, 'payments.PaymentDetails'); |
43
|
|
|
|
44
|
|
|
// OPTIONAL STRING network = 1 |
45
|
1 |
|
$f = new Field(); |
46
|
1 |
|
$f->number = 1; |
47
|
1 |
|
$f->name = 'network'; |
48
|
1 |
|
$f->type = Protobuf::TYPE_STRING; |
49
|
1 |
|
$f->rule = Protobuf::RULE_OPTIONAL; |
50
|
1 |
|
$f->default = 'main'; |
51
|
1 |
|
$descriptor->addField($f); |
52
|
|
|
|
53
|
|
|
// REPEATED MESSAGE outputs = 2 |
54
|
1 |
|
$f = new Field(); |
55
|
1 |
|
$f->number = 2; |
56
|
1 |
|
$f->name = 'outputs'; |
57
|
1 |
|
$f->type = Protobuf::TYPE_MESSAGE; |
58
|
1 |
|
$f->rule = Protobuf::RULE_REPEATED; |
59
|
1 |
|
$f->reference = Output::class; |
60
|
1 |
|
$descriptor->addField($f); |
61
|
|
|
|
62
|
|
|
// REQUIRED UINT64 time = 3 |
63
|
1 |
|
$f = new Field(); |
64
|
1 |
|
$f->number = 3; |
65
|
1 |
|
$f->name = 'time'; |
66
|
1 |
|
$f->type = Protobuf::TYPE_UINT64; |
67
|
1 |
|
$f->rule = Protobuf::RULE_REQUIRED; |
68
|
1 |
|
$descriptor->addField($f); |
69
|
|
|
|
70
|
|
|
// OPTIONAL UINT64 expires = 4 |
71
|
1 |
|
$f = new Field(); |
72
|
1 |
|
$f->number = 4; |
73
|
1 |
|
$f->name = 'expires'; |
74
|
1 |
|
$f->type = Protobuf::TYPE_UINT64; |
75
|
1 |
|
$f->rule = Protobuf::RULE_OPTIONAL; |
76
|
1 |
|
$descriptor->addField($f); |
77
|
|
|
|
78
|
|
|
// OPTIONAL STRING memo = 5 |
79
|
1 |
|
$f = new Field(); |
80
|
1 |
|
$f->number = 5; |
81
|
1 |
|
$f->name = 'memo'; |
82
|
1 |
|
$f->type = Protobuf::TYPE_STRING; |
83
|
1 |
|
$f->rule = Protobuf::RULE_OPTIONAL; |
84
|
1 |
|
$descriptor->addField($f); |
85
|
|
|
|
86
|
|
|
// OPTIONAL STRING payment_url = 6 |
87
|
1 |
|
$f = new Field(); |
88
|
1 |
|
$f->number = 6; |
89
|
1 |
|
$f->name = 'payment_url'; |
90
|
1 |
|
$f->type = Protobuf::TYPE_STRING; |
91
|
1 |
|
$f->rule = Protobuf::RULE_OPTIONAL; |
92
|
1 |
|
$descriptor->addField($f); |
93
|
|
|
|
94
|
|
|
// OPTIONAL BYTES merchant_data = 7 |
95
|
1 |
|
$f = new Field(); |
96
|
1 |
|
$f->number = 7; |
97
|
1 |
|
$f->name = 'merchant_data'; |
98
|
1 |
|
$f->type = Protobuf::TYPE_BYTES; |
99
|
1 |
|
$f->rule = Protobuf::RULE_OPTIONAL; |
100
|
1 |
|
$descriptor->addField($f); |
101
|
|
|
|
102
|
1 |
|
foreach (self::$__extensions as $cb) { |
103
|
|
|
$descriptor->addField($cb(), true); |
104
|
|
|
} |
105
|
|
|
|
106
|
1 |
|
return $descriptor; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Check if <network> has a value |
111
|
|
|
* |
112
|
|
|
* @return boolean |
113
|
|
|
*/ |
114
|
1 |
|
public function hasNetwork() |
115
|
|
|
{ |
116
|
1 |
|
return $this->_has(1); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Clear <network> value |
121
|
|
|
* |
122
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
123
|
|
|
*/ |
124
|
1 |
|
public function clearNetwork() |
125
|
|
|
{ |
126
|
1 |
|
return $this->_clear(1); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Get <network> value |
131
|
|
|
* |
132
|
|
|
* @return string |
133
|
|
|
*/ |
134
|
1 |
|
public function getNetwork() |
135
|
|
|
{ |
136
|
1 |
|
return $this->_get(1); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Set <network> value |
141
|
|
|
* |
142
|
|
|
* @param string $value |
143
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
144
|
|
|
*/ |
145
|
1 |
|
public function setNetwork($value) |
146
|
|
|
{ |
147
|
1 |
|
return $this->_set(1, $value); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* Check if <outputs> has a value |
152
|
|
|
* |
153
|
|
|
* @return boolean |
154
|
|
|
*/ |
155
|
2 |
|
public function hasOutputs() |
156
|
|
|
{ |
157
|
2 |
|
return $this->_has(2); |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Clear <outputs> value |
162
|
|
|
* |
163
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
164
|
|
|
*/ |
165
|
2 |
|
public function clearOutputs() |
166
|
|
|
{ |
167
|
2 |
|
return $this->_clear(2); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Get <outputs> value |
172
|
|
|
* |
173
|
|
|
* @param int $idx |
174
|
|
|
* @return \Bip70\Protobuf\Proto\Output |
175
|
|
|
*/ |
176
|
2 |
|
public function getOutputs($idx = null) |
177
|
|
|
{ |
178
|
2 |
|
return $this->_get(2, $idx); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Set <outputs> value |
183
|
|
|
* |
184
|
|
|
* @param \Bip70\Protobuf\Proto\Output $value |
185
|
|
|
* @param int $idx |
186
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
187
|
|
|
*/ |
188
|
2 |
|
public function setOutputs(\Bip70\Protobuf\Proto\Output $value, $idx = null) |
189
|
|
|
{ |
190
|
2 |
|
return $this->_set(2, $value, $idx); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* Get all elements of <outputs> |
195
|
|
|
* |
196
|
|
|
* @return \Bip70\Protobuf\Proto\Output[] |
197
|
|
|
*/ |
198
|
2 |
|
public function getOutputsList() |
199
|
|
|
{ |
200
|
2 |
|
return $this->_get(2); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Add a new element to <outputs> |
205
|
|
|
* |
206
|
|
|
* @param \Bip70\Protobuf\Proto\Output $value |
207
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
208
|
|
|
*/ |
209
|
1 |
|
public function addOutputs(\Bip70\Protobuf\Proto\Output $value) |
210
|
|
|
{ |
211
|
1 |
|
return $this->_add(2, $value); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Check if <time> has a value |
216
|
|
|
* |
217
|
|
|
* @return boolean |
218
|
|
|
*/ |
219
|
2 |
|
public function hasTime() |
220
|
|
|
{ |
221
|
2 |
|
return $this->_has(3); |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* Clear <time> value |
226
|
|
|
* |
227
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
228
|
|
|
*/ |
229
|
1 |
|
public function clearTime() |
230
|
|
|
{ |
231
|
1 |
|
return $this->_clear(3); |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Get <time> value |
236
|
|
|
* |
237
|
|
|
* @return int |
238
|
|
|
*/ |
239
|
2 |
|
public function getTime() |
240
|
|
|
{ |
241
|
2 |
|
return $this->_get(3); |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Set <time> value |
246
|
|
|
* |
247
|
|
|
* @param int $value |
248
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
249
|
|
|
*/ |
250
|
18 |
|
public function setTime($value) |
251
|
|
|
{ |
252
|
18 |
|
return $this->_set(3, $value); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* Check if <expires> has a value |
257
|
|
|
* |
258
|
|
|
* @return boolean |
259
|
|
|
*/ |
260
|
1 |
|
public function hasExpires() |
261
|
|
|
{ |
262
|
1 |
|
return $this->_has(4); |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* Clear <expires> value |
267
|
|
|
* |
268
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
269
|
|
|
*/ |
270
|
1 |
|
public function clearExpires() |
271
|
|
|
{ |
272
|
1 |
|
return $this->_clear(4); |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Get <expires> value |
277
|
|
|
* |
278
|
|
|
* @return int |
279
|
|
|
*/ |
280
|
1 |
|
public function getExpires() |
281
|
|
|
{ |
282
|
1 |
|
return $this->_get(4); |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* Set <expires> value |
287
|
|
|
* |
288
|
|
|
* @param int $value |
289
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
290
|
|
|
*/ |
291
|
1 |
|
public function setExpires($value) |
292
|
|
|
{ |
293
|
1 |
|
return $this->_set(4, $value); |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* Check if <memo> has a value |
298
|
|
|
* |
299
|
|
|
* @return boolean |
300
|
|
|
*/ |
301
|
1 |
|
public function hasMemo() |
302
|
|
|
{ |
303
|
1 |
|
return $this->_has(5); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* Clear <memo> value |
308
|
|
|
* |
309
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
310
|
|
|
*/ |
311
|
1 |
|
public function clearMemo() |
312
|
|
|
{ |
313
|
1 |
|
return $this->_clear(5); |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* Get <memo> value |
318
|
|
|
* |
319
|
|
|
* @return string |
320
|
|
|
*/ |
321
|
1 |
|
public function getMemo() |
322
|
|
|
{ |
323
|
1 |
|
return $this->_get(5); |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* Set <memo> value |
328
|
|
|
* |
329
|
|
|
* @param string $value |
330
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
331
|
|
|
*/ |
332
|
1 |
|
public function setMemo($value) |
333
|
|
|
{ |
334
|
1 |
|
return $this->_set(5, $value); |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* Check if <payment_url> has a value |
339
|
|
|
* |
340
|
|
|
* @return boolean |
341
|
|
|
*/ |
342
|
1 |
|
public function hasPaymentUrl() |
343
|
|
|
{ |
344
|
1 |
|
return $this->_has(6); |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Clear <payment_url> value |
349
|
|
|
* |
350
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
351
|
|
|
*/ |
352
|
1 |
|
public function clearPaymentUrl() |
353
|
|
|
{ |
354
|
1 |
|
return $this->_clear(6); |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Get <payment_url> value |
359
|
|
|
* |
360
|
|
|
* @return string |
361
|
|
|
*/ |
362
|
1 |
|
public function getPaymentUrl() |
363
|
|
|
{ |
364
|
1 |
|
return $this->_get(6); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Set <payment_url> value |
369
|
|
|
* |
370
|
|
|
* @param string $value |
371
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
372
|
|
|
*/ |
373
|
1 |
|
public function setPaymentUrl($value) |
374
|
|
|
{ |
375
|
1 |
|
return $this->_set(6, $value); |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* Check if <merchant_data> has a value |
380
|
|
|
* |
381
|
|
|
* @return boolean |
382
|
|
|
*/ |
383
|
1 |
|
public function hasMerchantData() |
384
|
|
|
{ |
385
|
1 |
|
return $this->_has(7); |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* Clear <merchant_data> value |
390
|
|
|
* |
391
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
392
|
|
|
*/ |
393
|
1 |
|
public function clearMerchantData() |
394
|
|
|
{ |
395
|
1 |
|
return $this->_clear(7); |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* Get <merchant_data> value |
400
|
|
|
* |
401
|
|
|
* @return string |
402
|
|
|
*/ |
403
|
1 |
|
public function getMerchantData() |
404
|
|
|
{ |
405
|
1 |
|
return $this->_get(7); |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Set <merchant_data> value |
410
|
|
|
* |
411
|
|
|
* @param string $value |
412
|
|
|
* @return \Bip70\Protobuf\Proto\PaymentDetails |
413
|
|
|
*/ |
414
|
1 |
|
public function setMerchantData($value) |
415
|
|
|
{ |
416
|
1 |
|
return $this->_set(7, $value); |
417
|
|
|
} |
418
|
|
|
} |
419
|
|
|
|