|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Luigel\Paymongo\Models; |
|
4
|
|
|
|
|
5
|
|
|
class Source |
|
6
|
|
|
{ |
|
7
|
|
|
protected $id; |
|
8
|
|
|
protected $type; |
|
9
|
|
|
protected $currency; |
|
10
|
|
|
protected $status; |
|
11
|
|
|
protected $amount; |
|
12
|
|
|
protected $redirect; |
|
13
|
|
|
protected $source_type; |
|
14
|
|
|
protected $created_at; |
|
15
|
|
|
protected $data; |
|
16
|
|
|
|
|
17
|
|
|
public function setData($data) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->id = $data['id']; |
|
20
|
|
|
$this->type = $data['type']; |
|
21
|
|
|
$this->currency = $data['attributes']['currency']; |
|
22
|
|
|
$this->status = $data['attributes']['status']; |
|
23
|
|
|
$this->amount = number_format($data['attributes']['amount'] / 100, 2); |
|
24
|
|
|
$this->redirect = $data['attributes']['redirect']; |
|
25
|
|
|
$this->source_type = $data['attributes']['type']; |
|
26
|
|
|
$this->created_at = $data['attributes']['created_at']; |
|
27
|
|
|
|
|
28
|
|
|
$this->data = [ |
|
29
|
|
|
'id' => $this->id, |
|
30
|
|
|
'type' => $this->type, |
|
31
|
|
|
'currency' => $this->currency, |
|
32
|
|
|
'status' => $this->status, |
|
33
|
|
|
'amount' => $this->amount, |
|
34
|
|
|
'redirect' => $this->redirect, |
|
35
|
|
|
'source_type' => $this->source_type, |
|
36
|
|
|
'created_at' => $this->created_at |
|
37
|
|
|
]; |
|
38
|
|
|
|
|
39
|
|
|
return $this; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function getId() |
|
43
|
|
|
{ |
|
44
|
|
|
return $this->id; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function getType() |
|
48
|
|
|
{ |
|
49
|
|
|
return $this->type; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function getCurrency() |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->currency; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getStatus() |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->status; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function getAmount() |
|
63
|
|
|
{ |
|
64
|
|
|
return $this->amount; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function getRedirect() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->redirect; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function getSuccessRedirect() |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->redirect['success']; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function getFailedRedirect() |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->redirect['failed']; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getCheckoutUrlRedirect() |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->redirect['checkout_url']; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function getSourceType() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->source_type; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function getCreatedAt() |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->created_at; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function getData() |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->data; |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|