1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WSW\SiftScience\Entities; |
4
|
|
|
|
5
|
|
|
use InvalidArgumentException; |
6
|
|
|
use WSW\SiftScience\Support\AllowedValues\FailureReason; |
7
|
|
|
use WSW\SiftScience\Support\AllowedValues\PromotionStatus; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Promotion |
11
|
|
|
* |
12
|
|
|
* @package WSW\SiftScience\Entities |
13
|
|
|
* @author Ronaldo Matos Rodrigues <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class Promotion |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
private $id; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $status; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $failureReason; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
private $description; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
private $referrerUserId; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var Discount |
44
|
|
|
*/ |
45
|
|
|
private $discount; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var CreditPoint |
49
|
|
|
*/ |
50
|
|
|
private $creditPoint; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
2 |
|
public function getId() |
56
|
|
|
{ |
57
|
2 |
|
return $this->id; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $id |
62
|
|
|
* |
63
|
|
|
* @return Promotion |
64
|
|
|
*/ |
65
|
3 |
|
public function setId($id) |
66
|
|
|
{ |
67
|
3 |
|
$this->id = $id; |
68
|
|
|
|
69
|
3 |
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return string |
74
|
|
|
*/ |
75
|
2 |
|
public function getStatus() |
76
|
|
|
{ |
77
|
2 |
|
return $this->status; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param string $status |
82
|
|
|
* |
83
|
|
|
* @return Promotion |
84
|
|
|
*/ |
85
|
4 |
|
public function setStatus($status) |
86
|
|
|
{ |
87
|
4 |
|
if (!PromotionStatus::isValid($status)) { |
88
|
1 |
|
throw new InvalidArgumentException('You should inform a valid status.'); |
89
|
|
|
} |
90
|
|
|
|
91
|
3 |
|
$this->status = $status; |
92
|
|
|
|
93
|
3 |
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
2 |
|
public function getFailureReason() |
100
|
|
|
{ |
101
|
2 |
|
return $this->failureReason; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param string $failureReason |
106
|
|
|
* |
107
|
|
|
* @return Promotion |
108
|
|
|
*/ |
109
|
3 |
|
public function setFailureReason($failureReason) |
110
|
|
|
{ |
111
|
3 |
|
if (!FailureReason::isValid($failureReason)) { |
112
|
1 |
|
throw new InvalidArgumentException('You should inform a valid failure reason.'); |
113
|
|
|
} |
114
|
|
|
|
115
|
2 |
|
$this->failureReason = $failureReason; |
116
|
|
|
|
117
|
2 |
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
2 |
|
public function getDescription() |
124
|
|
|
{ |
125
|
2 |
|
return $this->description; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param string $description |
130
|
|
|
* |
131
|
|
|
* @return Promotion |
132
|
|
|
*/ |
133
|
3 |
|
public function setDescription($description) |
134
|
|
|
{ |
135
|
3 |
|
$this->description = $description; |
136
|
|
|
|
137
|
3 |
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return string |
142
|
|
|
*/ |
143
|
2 |
|
public function getReferrerUserId() |
144
|
|
|
{ |
145
|
2 |
|
return $this->referrerUserId; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @param string $referrerUserId |
150
|
|
|
* |
151
|
|
|
* @return Promotion |
152
|
|
|
*/ |
153
|
2 |
|
public function setReferrerUserId($referrerUserId) |
154
|
|
|
{ |
155
|
2 |
|
$this->referrerUserId = $referrerUserId; |
156
|
|
|
|
157
|
2 |
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return Discount |
162
|
|
|
*/ |
163
|
2 |
|
public function getDiscount() |
164
|
|
|
{ |
165
|
2 |
|
return $this->discount; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @param Discount $discount |
170
|
|
|
* |
171
|
|
|
* @return Promotion |
172
|
|
|
*/ |
173
|
2 |
|
public function setDiscount(Discount $discount) |
174
|
|
|
{ |
175
|
2 |
|
$this->discount = $discount; |
176
|
|
|
|
177
|
2 |
|
return $this; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @return CreditPoint |
182
|
|
|
*/ |
183
|
2 |
|
public function getCreditPoint() |
184
|
|
|
{ |
185
|
2 |
|
return $this->creditPoint; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @param CreditPoint $creditPoint |
190
|
|
|
* |
191
|
|
|
* @return Promotion |
192
|
|
|
*/ |
193
|
2 |
|
public function setCreditPoint(CreditPoint $creditPoint) |
194
|
|
|
{ |
195
|
2 |
|
$this->creditPoint = $creditPoint; |
196
|
|
|
|
197
|
2 |
|
return $this; |
198
|
|
|
} |
199
|
|
|
} |
200
|
|
|
|