1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace WSW\SiftScience\Events; |
4
|
|
|
|
5
|
|
|
use InvalidArgumentException; |
6
|
|
|
use WSW\SiftScience\Support\AllowedValues\ChargebackReason; |
7
|
|
|
use WSW\SiftScience\Support\AllowedValues\ChargebackState; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Chargeback |
11
|
|
|
* |
12
|
|
|
* @package WSW\SiftScience\Events |
13
|
|
|
* @author Ronaldo Matos Rodrigues <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class Chargeback extends BaseEvent |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
private $order; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $transaction; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $chargebackState; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
private $chargebackReason; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Chargeback constructor. |
39
|
|
|
*/ |
40
|
6 |
|
public function __construct() |
41
|
|
|
{ |
42
|
6 |
|
$this->type = '$chargeback'; |
43
|
6 |
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return string |
47
|
|
|
*/ |
48
|
3 |
|
public function getOrder() |
49
|
|
|
{ |
50
|
3 |
|
return $this->order; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param string $order |
55
|
|
|
* |
56
|
|
|
* @return $this |
57
|
|
|
*/ |
58
|
1 |
|
public function setOrder($order) |
59
|
|
|
{ |
60
|
1 |
|
$this->order = $order; |
61
|
|
|
|
62
|
1 |
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
3 |
|
public function getTransaction() |
69
|
|
|
{ |
70
|
3 |
|
return $this->transaction; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param string $transaction |
75
|
|
|
* |
76
|
|
|
* @return $this |
77
|
|
|
*/ |
78
|
1 |
|
public function setTransaction($transaction) |
79
|
|
|
{ |
80
|
1 |
|
$this->transaction = $transaction; |
81
|
|
|
|
82
|
1 |
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
3 |
|
public function getChargebackState() |
89
|
|
|
{ |
90
|
3 |
|
return $this->chargebackState; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param string $chargebackState |
95
|
|
|
* |
96
|
|
|
* @return $this |
97
|
|
|
*/ |
98
|
2 |
|
public function setChargebackState($chargebackState) |
99
|
|
|
{ |
100
|
2 |
|
if (!ChargebackState::isValid($chargebackState)) { |
101
|
1 |
|
throw new InvalidArgumentException('You should inform a valid chargeback state.'); |
102
|
|
|
} |
103
|
|
|
|
104
|
1 |
|
$this->chargebackState = $chargebackState; |
105
|
|
|
|
106
|
1 |
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return string |
111
|
|
|
*/ |
112
|
3 |
|
public function getChargebackReason() |
113
|
|
|
{ |
114
|
3 |
|
return $this->chargebackReason; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param string $chargebackReason |
119
|
|
|
* |
120
|
|
|
* @return $this |
121
|
|
|
*/ |
122
|
2 |
|
public function setChargebackReason($chargebackReason) |
123
|
|
|
{ |
124
|
2 |
|
if (!ChargebackReason::isValid($chargebackReason)) { |
125
|
1 |
|
throw new InvalidArgumentException('You should inform a valid chargeback reason.'); |
126
|
|
|
} |
127
|
|
|
|
128
|
1 |
|
$this->chargebackReason = $chargebackReason; |
129
|
|
|
|
130
|
1 |
|
return $this; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|