1
|
|
|
<?php |
2
|
|
|
namespace MrPrompt\ShipmentCommon\Base; |
3
|
|
|
|
4
|
|
|
use ArrayObject; |
5
|
|
|
use stdClass; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Credit card |
9
|
|
|
* |
10
|
|
|
* @author Thiago Paes <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class Billet |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var ArrayObject |
16
|
|
|
*/ |
17
|
|
|
private $details; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var BankAccount |
21
|
|
|
*/ |
22
|
|
|
private $bankAccount; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var Seller |
26
|
|
|
*/ |
27
|
|
|
private $assignor; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var float |
31
|
|
|
*/ |
32
|
|
|
private $rate; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var int |
36
|
|
|
*/ |
37
|
|
|
private $number; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Constructor |
41
|
|
|
*/ |
42
|
11 |
|
public function __construct( |
43
|
|
|
BankAccount $bankAccount = null, |
44
|
|
|
Seller $assignor = null, |
45
|
|
|
ArrayObject $details = null, |
46
|
|
|
float $rate = 0.00, |
47
|
|
|
int $number = 0 |
48
|
|
|
) { |
49
|
11 |
|
$this->bankAccount = $bankAccount ?? new BankAccount(); |
50
|
11 |
|
$this->assignor = $assignor ?? new Seller(); |
51
|
11 |
|
$this->details = $details ?? new ArrayObject(); |
52
|
11 |
|
$this->rate = $rate; |
53
|
11 |
|
$this->number = $number; |
54
|
11 |
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return ArrayObject |
58
|
|
|
*/ |
59
|
1 |
|
public function getDetails(): ArrayObject |
60
|
|
|
{ |
61
|
1 |
|
return $this->details; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param ArrayObject $details |
66
|
|
|
*/ |
67
|
1 |
|
public function setDetails(ArrayObject $details) |
68
|
|
|
{ |
69
|
1 |
|
$this->details = $details; |
70
|
1 |
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param object $detail |
74
|
|
|
*/ |
75
|
1 |
|
public function addDetail(stdClass $detail) |
76
|
|
|
{ |
77
|
1 |
|
$this->details->append($detail); |
78
|
1 |
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return float |
82
|
|
|
*/ |
83
|
1 |
|
public function getRate(): float |
84
|
|
|
{ |
85
|
1 |
|
return $this->rate; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param float $rate |
90
|
|
|
*/ |
91
|
1 |
|
public function setRate(float $rate) |
92
|
|
|
{ |
93
|
1 |
|
$this->rate = $rate; |
94
|
1 |
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return BankAccount |
98
|
|
|
*/ |
99
|
1 |
|
public function getBankAccount() |
100
|
|
|
{ |
101
|
1 |
|
return $this->bankAccount; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param BankAccount $bankAccount |
106
|
|
|
*/ |
107
|
1 |
|
public function setBankAccount(BankAccount $bankAccount) |
108
|
|
|
{ |
109
|
1 |
|
$this->bankAccount = $bankAccount; |
110
|
1 |
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return Seller |
114
|
|
|
*/ |
115
|
1 |
|
public function getAssignor(): Seller |
116
|
|
|
{ |
117
|
1 |
|
return $this->assignor; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param Seller $assignor |
122
|
|
|
*/ |
123
|
1 |
|
public function setAssignor(Seller $assignor) |
124
|
|
|
{ |
125
|
1 |
|
$this->assignor = $assignor; |
126
|
1 |
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return int |
130
|
|
|
*/ |
131
|
1 |
|
public function getNumber(): int |
132
|
|
|
{ |
133
|
1 |
|
return $this->number; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param int $number |
138
|
|
|
*/ |
139
|
1 |
|
public function setNumber(int $number) |
140
|
|
|
{ |
141
|
1 |
|
$this->number = $number; |
142
|
1 |
|
} |
143
|
|
|
} |
144
|
|
|
|