|
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
|
|
|
public function __construct() |
|
38
|
|
|
{ |
|
39
|
|
|
$this->type = '$chargeback'; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @return string |
|
44
|
|
|
*/ |
|
45
|
|
|
public function getOrder() |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->order; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param string $order |
|
52
|
|
|
* |
|
53
|
|
|
* @return $this |
|
54
|
|
|
*/ |
|
55
|
|
|
public function setOrder($order) |
|
56
|
|
|
{ |
|
57
|
|
|
$this->order = $order; |
|
58
|
|
|
|
|
59
|
|
|
return $this; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return string |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getTransaction() |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->transaction; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param string $transaction |
|
72
|
|
|
* |
|
73
|
|
|
* @return $this |
|
74
|
|
|
*/ |
|
75
|
|
|
public function setTransaction($transaction) |
|
76
|
|
|
{ |
|
77
|
|
|
$this->transaction = $transaction; |
|
78
|
|
|
|
|
79
|
|
|
return $this; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @return string |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getChargebackState() |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->chargebackState; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @param string $chargebackState |
|
92
|
|
|
* |
|
93
|
|
|
* @return $this |
|
94
|
|
|
*/ |
|
95
|
|
|
public function setChargebackState($chargebackState) |
|
96
|
|
|
{ |
|
97
|
|
|
if (!ChargebackState::isValid($chargebackState)) { |
|
98
|
|
|
throw new InvalidArgumentException('You should inform a valid chargeback state.'); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
$this->chargebackState = $chargebackState; |
|
102
|
|
|
|
|
103
|
|
|
return $this; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @return string |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getChargebackReason() |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->chargebackReason; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @param string $chargebackReason |
|
116
|
|
|
* |
|
117
|
|
|
* @return $this |
|
118
|
|
|
*/ |
|
119
|
|
|
public function setChargebackReason($chargebackReason) |
|
120
|
|
|
{ |
|
121
|
|
|
if (!ChargebackReason::isValid($chargebackReason)) { |
|
122
|
|
|
throw new InvalidArgumentException('You should inform a valid chargeback reason.'); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
$this->chargebackReason = $chargebackReason; |
|
126
|
|
|
|
|
127
|
|
|
return $this; |
|
128
|
|
|
} |
|
129
|
|
|
} |
|
130
|
|
|
|