1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PagaMasTarde\Model; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Charge |
7
|
|
|
* @package PagaMasTarde\Model |
8
|
|
|
*/ |
9
|
|
|
class Charge extends AbstractModel |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @var string $id |
13
|
|
|
*/ |
14
|
|
|
public $id; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var int $amount |
18
|
|
|
*/ |
19
|
|
|
public $amount; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var string $errorCode |
23
|
|
|
*/ |
24
|
|
|
public $errorCode; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string $errorMessage |
28
|
|
|
*/ |
29
|
|
|
public $errorMessage; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string $orderId |
33
|
|
|
*/ |
34
|
|
|
public $orderId; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string $description |
38
|
|
|
*/ |
39
|
|
|
public $description; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string $paid |
43
|
|
|
*/ |
44
|
|
|
public $paid; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string $createdAt |
48
|
|
|
*/ |
49
|
|
|
public $createdAt; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string $status |
53
|
|
|
*/ |
54
|
|
|
public $status; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var int $commission |
58
|
|
|
*/ |
59
|
|
|
public $commission; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var int $amountToSettle |
63
|
|
|
*/ |
64
|
|
|
public $amountToSettle; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var string $discount |
68
|
|
|
*/ |
69
|
|
|
public $discount; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var array $metadata |
73
|
|
|
*/ |
74
|
|
|
public $metadata; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var string $closedAt |
78
|
|
|
*/ |
79
|
|
|
public $closedAt; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var string $paymentDate |
83
|
|
|
*/ |
84
|
|
|
public $paymentDate; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var Card $card |
88
|
|
|
*/ |
89
|
|
|
public $card; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var Refund[] $refunds |
93
|
|
|
*/ |
94
|
|
|
public $refunds; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* AutoFillMethod for card |
98
|
|
|
* |
99
|
|
|
* @param $cardArray |
100
|
|
|
*/ |
101
|
|
|
public function autoFillCard($cardArray) |
102
|
|
|
{ |
103
|
|
|
$card = new Card($cardArray); |
104
|
|
|
|
105
|
|
|
$this->card = $card; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* AutoFillMethod for refunds |
110
|
|
|
* |
111
|
|
|
* @param $refundsArray |
112
|
|
|
*/ |
113
|
|
|
public function autoFillRefunds($refundsArray) |
114
|
|
|
{ |
115
|
|
|
foreach ($refundsArray as $refund) { |
116
|
|
|
$refunds[] = new Refund($refund); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
$this->refunds = isset($refunds) ? $refunds : array(); |
|
|
|
|
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return string |
124
|
|
|
*/ |
125
|
|
|
public function getId() |
126
|
|
|
{ |
127
|
|
|
return $this->id; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param string $id |
132
|
|
|
* |
133
|
|
|
* @return Charge |
134
|
|
|
*/ |
135
|
|
|
public function setId($id) |
136
|
|
|
{ |
137
|
|
|
$this->id = $id; |
138
|
|
|
|
139
|
|
|
return $this; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @return int |
144
|
|
|
*/ |
145
|
|
|
public function getAmount() |
146
|
|
|
{ |
147
|
|
|
return $this->amount; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @param int $amount |
152
|
|
|
* |
153
|
|
|
* @return Charge |
154
|
|
|
*/ |
155
|
|
|
public function setAmount($amount) |
156
|
|
|
{ |
157
|
|
|
$this->amount = $amount; |
158
|
|
|
|
159
|
|
|
return $this; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @return string |
164
|
|
|
*/ |
165
|
|
|
public function getErrorCode() |
166
|
|
|
{ |
167
|
|
|
return $this->errorCode; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @param string $errorCode |
172
|
|
|
* |
173
|
|
|
* @return Charge |
174
|
|
|
*/ |
175
|
|
|
public function setErrorCode($errorCode) |
176
|
|
|
{ |
177
|
|
|
$this->errorCode = $errorCode; |
178
|
|
|
|
179
|
|
|
return $this; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @return string |
184
|
|
|
*/ |
185
|
|
|
public function getErrorMessage() |
186
|
|
|
{ |
187
|
|
|
return $this->errorMessage; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @param string $errorMessage |
192
|
|
|
* |
193
|
|
|
* @return Charge |
194
|
|
|
*/ |
195
|
|
|
public function setErrorMessage($errorMessage) |
196
|
|
|
{ |
197
|
|
|
$this->errorMessage = $errorMessage; |
198
|
|
|
|
199
|
|
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @return string |
204
|
|
|
*/ |
205
|
|
|
public function getOrderId() |
206
|
|
|
{ |
207
|
|
|
return $this->orderId; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @param string $orderId |
212
|
|
|
* |
213
|
|
|
* @return Charge |
214
|
|
|
*/ |
215
|
|
|
public function setOrderId($orderId) |
216
|
|
|
{ |
217
|
|
|
$this->orderId = $orderId; |
218
|
|
|
|
219
|
|
|
return $this; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @return string |
224
|
|
|
*/ |
225
|
|
|
public function getDescription() |
226
|
|
|
{ |
227
|
|
|
return $this->description; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @param string $description |
232
|
|
|
* |
233
|
|
|
* @return Charge |
234
|
|
|
*/ |
235
|
|
|
public function setDescription($description) |
236
|
|
|
{ |
237
|
|
|
$this->description = $description; |
238
|
|
|
|
239
|
|
|
return $this; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @return string |
244
|
|
|
*/ |
245
|
|
|
public function getPaid() |
246
|
|
|
{ |
247
|
|
|
return $this->paid; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @param string $paid |
252
|
|
|
* |
253
|
|
|
* @return Charge |
254
|
|
|
*/ |
255
|
|
|
public function setPaid($paid) |
256
|
|
|
{ |
257
|
|
|
$this->paid = $paid; |
258
|
|
|
|
259
|
|
|
return $this; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* @return string |
264
|
|
|
*/ |
265
|
|
|
public function getCreatedAt() |
266
|
|
|
{ |
267
|
|
|
return $this->createdAt; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @param string $createdAt |
272
|
|
|
* |
273
|
|
|
* @return Charge |
274
|
|
|
*/ |
275
|
|
|
public function setCreatedAt($createdAt) |
276
|
|
|
{ |
277
|
|
|
$this->createdAt = $createdAt; |
278
|
|
|
|
279
|
|
|
return $this; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* @return string |
284
|
|
|
*/ |
285
|
|
|
public function getStatus() |
286
|
|
|
{ |
287
|
|
|
return $this->status; |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* @param string $status |
292
|
|
|
* |
293
|
|
|
* @return Charge |
294
|
|
|
*/ |
295
|
|
|
public function setStatus($status) |
296
|
|
|
{ |
297
|
|
|
$this->status = $status; |
298
|
|
|
|
299
|
|
|
return $this; |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* @return int |
304
|
|
|
*/ |
305
|
|
|
public function getCommission() |
306
|
|
|
{ |
307
|
|
|
return $this->commission; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @param int $commission |
312
|
|
|
* |
313
|
|
|
* @return Charge |
314
|
|
|
*/ |
315
|
|
|
public function setCommission($commission) |
316
|
|
|
{ |
317
|
|
|
$this->commission = $commission; |
318
|
|
|
|
319
|
|
|
return $this; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* @return int |
324
|
|
|
*/ |
325
|
|
|
public function getAmountToSettle() |
326
|
|
|
{ |
327
|
|
|
return $this->amountToSettle; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* @param int $amountToSettle |
332
|
|
|
* |
333
|
|
|
* @return Charge |
334
|
|
|
*/ |
335
|
|
|
public function setAmountToSettle($amountToSettle) |
336
|
|
|
{ |
337
|
|
|
$this->amountToSettle = $amountToSettle; |
338
|
|
|
|
339
|
|
|
return $this; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* @return string |
344
|
|
|
*/ |
345
|
|
|
public function getDiscount() |
346
|
|
|
{ |
347
|
|
|
return $this->discount; |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @param string $discount |
352
|
|
|
* |
353
|
|
|
* @return Charge |
354
|
|
|
*/ |
355
|
|
|
public function setDiscount($discount) |
356
|
|
|
{ |
357
|
|
|
$this->discount = $discount; |
358
|
|
|
|
359
|
|
|
return $this; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* @return array |
364
|
|
|
*/ |
365
|
|
|
public function getMetadata() |
366
|
|
|
{ |
367
|
|
|
return $this->metadata; |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
/** |
371
|
|
|
* @param array $metadata |
372
|
|
|
* |
373
|
|
|
* @return Charge |
374
|
|
|
*/ |
375
|
|
|
public function setMetadata($metadata) |
376
|
|
|
{ |
377
|
|
|
$this->metadata = $metadata; |
378
|
|
|
|
379
|
|
|
return $this; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* @return string |
384
|
|
|
*/ |
385
|
|
|
public function getClosedAt() |
386
|
|
|
{ |
387
|
|
|
return $this->closedAt; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* @param string $closedAt |
392
|
|
|
* |
393
|
|
|
* @return Charge |
394
|
|
|
*/ |
395
|
|
|
public function setClosedAt($closedAt) |
396
|
|
|
{ |
397
|
|
|
$this->closedAt = $closedAt; |
398
|
|
|
|
399
|
|
|
return $this; |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
/** |
403
|
|
|
* @return string |
404
|
|
|
*/ |
405
|
|
|
public function getPaymentDate() |
406
|
|
|
{ |
407
|
|
|
return $this->paymentDate; |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* @param string $paymentDate |
412
|
|
|
* |
413
|
|
|
* @return Charge |
414
|
|
|
*/ |
415
|
|
|
public function setPaymentDate($paymentDate) |
416
|
|
|
{ |
417
|
|
|
$this->paymentDate = $paymentDate; |
418
|
|
|
|
419
|
|
|
return $this; |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
/** |
423
|
|
|
* @return Card |
424
|
|
|
*/ |
425
|
|
|
public function getCard() |
426
|
|
|
{ |
427
|
|
|
return $this->card; |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* @param Card $card |
432
|
|
|
* |
433
|
|
|
* @return Charge |
434
|
|
|
*/ |
435
|
|
|
public function setCard($card) |
436
|
|
|
{ |
437
|
|
|
$this->card = $card; |
438
|
|
|
|
439
|
|
|
return $this; |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
/** |
443
|
|
|
* @return Refund[] |
444
|
|
|
*/ |
445
|
|
|
public function getRefunds() |
446
|
|
|
{ |
447
|
|
|
return $this->refunds; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
/** |
451
|
|
|
* @param Refund[] $refunds |
452
|
|
|
* |
453
|
|
|
* @return Charge |
454
|
|
|
*/ |
455
|
|
|
public function setRefunds($refunds) |
456
|
|
|
{ |
457
|
|
|
$this->refunds = $refunds; |
458
|
|
|
|
459
|
|
|
return $this; |
460
|
|
|
} |
461
|
|
|
} |
462
|
|
|
|