1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WSW\SiftScience\Entities; |
4
|
|
|
|
5
|
|
|
use InvalidArgumentException; |
6
|
|
|
use WSW\SiftScience\Support\AllowedValues\PaymentGateway; |
7
|
|
|
use WSW\SiftScience\Support\AllowedValues\PaymentType; |
8
|
|
|
use WSW\SiftScience\Support\AllowedValues\VerificationStatus; |
9
|
|
|
use WSW\SiftScience\Support\Traits\Entities\PayPalPaymentMethodTrait; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class PaymentMethod |
13
|
|
|
* |
14
|
|
|
* @package WSW\SiftScience\Entities |
15
|
|
|
* @author Ronaldo Matos Rodrigues <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
class PaymentMethod |
18
|
|
|
{ |
19
|
|
|
use PayPalPaymentMethodTrait; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
private $paymentType; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
private $paymentGateway; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
private $cardBin; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
private $cardLast4; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
private $cvvResultCode; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
private $avsResultCode; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
private $verificationStatus; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
private $routingNumber; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
private $declineReasonCode; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var string |
68
|
|
|
*/ |
69
|
|
|
private $stripeCvcCheck; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var string |
73
|
|
|
*/ |
74
|
|
|
private $stripeFunding; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var string |
78
|
|
|
*/ |
79
|
|
|
private $stripeBrand; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var string |
83
|
|
|
*/ |
84
|
|
|
private $stripeAddressLine1Check; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var string |
88
|
|
|
*/ |
89
|
|
|
private $stripeAddressLine2Check; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
private $stripeAddressZipCheck; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
3 |
|
public function getPaymentType() |
100
|
|
|
{ |
101
|
3 |
|
return $this->paymentType; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param string $paymentType |
106
|
|
|
* @throws \InvalidArgumentException |
107
|
|
|
* |
108
|
|
|
* @return $this |
109
|
|
|
*/ |
110
|
5 |
|
public function setPaymentType($paymentType) |
111
|
|
|
{ |
112
|
5 |
|
if (!PaymentType::isValid($paymentType)) { |
113
|
1 |
|
throw new InvalidArgumentException("You should inform a valid payment type"); |
114
|
|
|
} |
115
|
|
|
|
116
|
4 |
|
$this->paymentType = $paymentType; |
117
|
|
|
|
118
|
4 |
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return string |
123
|
|
|
*/ |
124
|
3 |
|
public function getPaymentGateway() |
125
|
|
|
{ |
126
|
3 |
|
return $this->paymentGateway; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param string $paymentGateway |
131
|
|
|
* @throws \InvalidArgumentException |
132
|
|
|
* |
133
|
|
|
* @return $this |
134
|
|
|
*/ |
135
|
5 |
|
public function setPaymentGateway($paymentGateway) |
136
|
|
|
{ |
137
|
5 |
|
if (!PaymentGateway::isValid($paymentGateway)) { |
138
|
1 |
|
throw new InvalidArgumentException("You should inform a valid payment gateway"); |
139
|
|
|
} |
140
|
|
|
|
141
|
4 |
|
$this->paymentGateway = $paymentGateway; |
142
|
|
|
|
143
|
4 |
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
3 |
|
public function getCardBin() |
150
|
|
|
{ |
151
|
3 |
|
return $this->cardBin; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param string $cardBin |
156
|
|
|
* |
157
|
|
|
* @return $this |
158
|
|
|
*/ |
159
|
4 |
|
public function setCardBin($cardBin) |
160
|
|
|
{ |
161
|
4 |
|
$this->cardBin = $cardBin; |
162
|
|
|
|
163
|
4 |
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return string |
168
|
|
|
*/ |
169
|
3 |
|
public function getCardLast4() |
170
|
|
|
{ |
171
|
3 |
|
return $this->cardLast4; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param string $cardLast4 |
176
|
|
|
* |
177
|
|
|
* @return $this |
178
|
|
|
*/ |
179
|
4 |
|
public function setCardLast4($cardLast4) |
180
|
|
|
{ |
181
|
4 |
|
$this->cardLast4 = $cardLast4; |
182
|
|
|
|
183
|
4 |
|
return $this; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @return string |
188
|
|
|
*/ |
189
|
3 |
|
public function getCvvResultCode() |
190
|
|
|
{ |
191
|
3 |
|
return $this->cvvResultCode; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @param string $cvvResultCode |
196
|
|
|
* |
197
|
|
|
* @return $this |
198
|
|
|
*/ |
199
|
3 |
|
public function setCvvResultCode($cvvResultCode) |
200
|
|
|
{ |
201
|
3 |
|
$this->cvvResultCode = $cvvResultCode; |
202
|
|
|
|
203
|
3 |
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @return string |
208
|
|
|
*/ |
209
|
3 |
|
public function getAvsResultCode() |
210
|
|
|
{ |
211
|
3 |
|
return $this->avsResultCode; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @param string $avsResultCode |
216
|
|
|
* |
217
|
|
|
* @return $this |
218
|
|
|
*/ |
219
|
1 |
|
public function setAvsResultCode($avsResultCode) |
220
|
|
|
{ |
221
|
1 |
|
$this->avsResultCode = $avsResultCode; |
222
|
|
|
|
223
|
1 |
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @return string |
228
|
|
|
*/ |
229
|
3 |
|
public function getVerificationStatus() |
230
|
|
|
{ |
231
|
3 |
|
return $this->verificationStatus; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @param string $verificationStatus |
236
|
|
|
* |
237
|
|
|
* @return $this |
238
|
|
|
*/ |
239
|
4 |
|
public function setVerificationStatus($verificationStatus) |
240
|
|
|
{ |
241
|
4 |
|
if (!VerificationStatus::isValid($verificationStatus)) { |
242
|
1 |
|
throw new InvalidArgumentException("You should inform a valid verification status"); |
243
|
|
|
} |
244
|
|
|
|
245
|
3 |
|
$this->verificationStatus = $verificationStatus; |
246
|
|
|
|
247
|
3 |
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @return string |
252
|
|
|
*/ |
253
|
3 |
|
public function getRoutingNumber() |
254
|
|
|
{ |
255
|
3 |
|
return $this->routingNumber; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @param string $routingNumber |
260
|
|
|
* |
261
|
|
|
* @return $this |
262
|
|
|
*/ |
263
|
1 |
|
public function setRoutingNumber($routingNumber) |
264
|
|
|
{ |
265
|
1 |
|
$this->routingNumber = $routingNumber; |
266
|
|
|
|
267
|
1 |
|
return $this; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @return string |
272
|
|
|
*/ |
273
|
3 |
|
public function getDeclineReasonCode() |
274
|
|
|
{ |
275
|
3 |
|
return $this->declineReasonCode; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* @param string $declineReasonCode |
280
|
|
|
* |
281
|
|
|
* @return $this |
282
|
|
|
*/ |
283
|
1 |
|
public function setDeclineReasonCode($declineReasonCode) |
284
|
|
|
{ |
285
|
1 |
|
$this->declineReasonCode = $declineReasonCode; |
286
|
|
|
|
287
|
1 |
|
return $this; |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* @return string |
292
|
|
|
*/ |
293
|
3 |
|
public function getStripeCvcCheck() |
294
|
|
|
{ |
295
|
3 |
|
return $this->stripeCvcCheck; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @param string $stripeCvcCheck |
300
|
|
|
* |
301
|
|
|
* @return $this |
302
|
|
|
*/ |
303
|
1 |
|
public function setStripeCvcCheck($stripeCvcCheck) |
304
|
|
|
{ |
305
|
1 |
|
$this->stripeCvcCheck = $stripeCvcCheck; |
306
|
|
|
|
307
|
1 |
|
return $this; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @return string |
312
|
|
|
*/ |
313
|
3 |
|
public function getStripeFunding() |
314
|
|
|
{ |
315
|
3 |
|
return $this->stripeFunding; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* @param string $stripeFunding |
320
|
|
|
* |
321
|
|
|
* @return $this |
322
|
|
|
*/ |
323
|
1 |
|
public function setStripeFunding($stripeFunding) |
324
|
|
|
{ |
325
|
1 |
|
$this->stripeFunding = $stripeFunding; |
326
|
|
|
|
327
|
1 |
|
return $this; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* @return string |
332
|
|
|
*/ |
333
|
3 |
|
public function getStripeBrand() |
334
|
|
|
{ |
335
|
3 |
|
return $this->stripeBrand; |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* @param string $stripeBrand |
340
|
|
|
* |
341
|
|
|
* @return $this |
342
|
|
|
*/ |
343
|
1 |
|
public function setStripeBrand($stripeBrand) |
344
|
|
|
{ |
345
|
1 |
|
$this->stripeBrand = $stripeBrand; |
346
|
|
|
|
347
|
1 |
|
return $this; |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @return string |
352
|
|
|
*/ |
353
|
3 |
|
public function getStripeAddressLine1Check() |
354
|
|
|
{ |
355
|
3 |
|
return $this->stripeAddressLine1Check; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* @param string $stripeAddressLine1Check |
360
|
|
|
* |
361
|
|
|
* @return $this |
362
|
|
|
*/ |
363
|
1 |
|
public function setStripeAddressLine1Check($stripeAddressLine1Check) |
364
|
|
|
{ |
365
|
1 |
|
$this->stripeAddressLine1Check = $stripeAddressLine1Check; |
366
|
|
|
|
367
|
1 |
|
return $this; |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
/** |
371
|
|
|
* @return string |
372
|
|
|
*/ |
373
|
3 |
|
public function getStripeAddressLine2Check() |
374
|
|
|
{ |
375
|
3 |
|
return $this->stripeAddressLine2Check; |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* @param string $stripeAddressLine2Check |
380
|
|
|
* |
381
|
|
|
* @return $this |
382
|
|
|
*/ |
383
|
1 |
|
public function setStripeAddressLine2Check($stripeAddressLine2Check) |
384
|
|
|
{ |
385
|
1 |
|
$this->stripeAddressLine2Check = $stripeAddressLine2Check; |
386
|
|
|
|
387
|
1 |
|
return $this; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* @return string |
392
|
|
|
*/ |
393
|
3 |
|
public function getStripeAddressZipCheck() |
394
|
|
|
{ |
395
|
3 |
|
return $this->stripeAddressZipCheck; |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* @param string $stripeAddressZipCheck |
400
|
|
|
* |
401
|
|
|
* @return $this |
402
|
|
|
*/ |
403
|
1 |
|
public function setStripeAddressZipCheck($stripeAddressZipCheck) |
404
|
|
|
{ |
405
|
1 |
|
$this->stripeAddressZipCheck = $stripeAddressZipCheck; |
406
|
|
|
|
407
|
1 |
|
return $this; |
408
|
|
|
} |
409
|
|
|
} |
410
|
|
|
|