Completed
Push — master ( 7de380...31fde0 )
by
unknown
08:36
created

Refund::getAmount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Cardinity\Method\Refund;
4
5
use Cardinity\Method\ResultObject;
6
7 View Code Duplication
class Refund extends ResultObject
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /** @type string ID of the refund.
10
        Value assigned by Cardinity. */
11
    private $id;
12
13
    /** @type float Amount refunded shown in #0.00 format. */
14
    private $amount;
15
16
    /** @type string Three-letter ISO currency code representing the currency in
17
        which the refund was made.
18
        Supported currencies: EUR, USD.
19
        Value assigned by Cardinity. */
20
    private $currency;
21
22
    /** @type string Can only be: refund.
23
        Value assigned by Cardinity. */
24
    private $type;
25
26
    /** @type string Refund creation time as defined in RFC 3339 Section 5.6.
27
        UTC timezone.
28
        Value assigned by Cardinity. */
29
    private $created;
30
31
    /** @type boolean Indicates whether a refund was made in live or testing
32
        mode.
33
        Value assigned by Cardinity. */
34
    private $live;
35
36
    /** @type string ID of the refunded payment.
37
        Value assigned by Cardinity. */
38
    private $parentId;
39
40
    /** @type string Refund status.
41
        Can be one of the following: approved, declined.
42
        Value assigned by Cardinity. */
43
    private $status;
44
45
    /** @type string Error message.
46
        Returned only if status is declined.
47
        Provides human readable information why the refund failed.
48
        Value assigned by Cardinity. */
49
    private $error;
50
51
    /** @type string Optional. Order ID provided by a merchant in initial
52
        payment. Must be between 2 and 50 characters [A-Za-z0-9'.-].
53
        Value assigned by Cardinity. */
54
    private $orderId;
55
56
    /** @type string Refund description provided by a merchant.
57
        Maximum length 255 characters. */
58
    private $description;
59
60
    /**
61
     * Gets the value of id.
62
     * @return mixed
63
     */
64
    public function getId()
65
    {
66
        return $this->id;
67
    }
68
69
    /**
70
     * Sets the value of id.
71
     * @param mixed $id the id
72
     * @return void
73
     */
74
    public function setId($id)
75
    {
76
        $this->id = $id;
77
    }
78
79
    /**
80
     * Gets the value of amount.
81
     * @return mixed
82
     */
83
    public function getAmount()
84
    {
85
        return $this->amount;
86
    }
87
88
    /**
89
     * Sets the value of amount.
90
     * @param mixed $amount the amount
91
     * @return void
92
     */
93
    public function setAmount($amount)
94
    {
95
        $this->amount = $amount;
96
    }
97
98
    /**
99
     * Gets the value of currency.
100
     * @return mixed
101
     */
102
    public function getCurrency()
103
    {
104
        return $this->currency;
105
    }
106
107
    /**
108
     * Sets the value of currency.
109
     * @param mixed $currency the currency
110
     * @return void
111
     */
112
    public function setCurrency($currency)
113
    {
114
        $this->currency = $currency;
115
    }
116
117
    /**
118
     * Gets the value of type.
119
     * @return mixed
120
     */
121
    public function getType()
122
    {
123
        return $this->type;
124
    }
125
126
    /**
127
     * Sets the value of type.
128
     * @param mixed $type the type
129
     * @return void
130
     */
131
    public function setType($type)
132
    {
133
        $this->type = $type;
134
    }
135
136
    /**
137
     * Gets the value of created.
138
     * @return mixed
139
     */
140
    public function getCreated()
141
    {
142
        return $this->created;
143
    }
144
145
    /**
146
     * Sets the value of created.
147
     * @param mixed $created the created
148
     * @return void
149
     */
150
    public function setCreated($created)
151
    {
152
        $this->created = $created;
153
    }
154
155
    /**
156
     * Gets the value of live.
157
     * @return mixed
158
     */
159
    public function getLive()
160
    {
161
        return $this->live;
162
    }
163
164
    /**
165
     * Sets the value of live.
166
     * @param mixed $live the live
167
     * @return void
168
     */
169
    public function setLive($live)
170
    {
171
        $this->live = $live;
172
    }
173
174
    /**
175
     * Gets the value of parentId.
176
     * @return mixed
177
     */
178
    public function getParentId()
179
    {
180
        return $this->parentId;
181
    }
182
183
    /**
184
     * Sets the value of parentId.
185
     * @param mixed $parentId the parent id
186
     * @return void
187
     */
188
    public function setParentId($parentId)
189
    {
190
        $this->parentId = $parentId;
191
    }
192
193
    /**
194
     * Gets the value of status.
195
     * @return mixed
196
     */
197
    public function getStatus()
198
    {
199
        return $this->status;
200
    }
201
202
    /**
203
     * Sets the value of status.
204
     * @param mixed $status the status
205
     * @return void
206
     */
207
    public function setStatus($status)
208
    {
209
        $this->status = $status;
210
    }
211
212
    /**
213
     * Gets the value of error.
214
     * @return mixed
215
     */
216
    public function getError()
217
    {
218
        return $this->error;
219
    }
220
221
    /**
222
     * Sets the value of error.
223
     * @param mixed $error the error
224
     * @return void
225
     */
226
    public function setError($error)
227
    {
228
        $this->error = $error;
229
    }
230
231
    /**
232
     * Gets the value of orderId.
233
     * @return mixed
234
     */
235
    public function getOrderId()
236
    {
237
        return $this->orderId;
238
    }
239
240
    /**
241
     * Sets the value of orderId.
242
     * @param mixed $orderId the order id
243
     * @return void
244
     */
245
    public function setOrderId($orderId)
246
    {
247
        $this->orderId = $orderId;
248
    }
249
250
    /**
251
     * Gets the value of description.
252
     * @return mixed
253
     */
254
    public function getDescription()
255
    {
256
        return $this->description;
257
    }
258
259
    /**
260
     * Sets the value of description.
261
     * @param mixed $description the description
262
     * @return void
263
     */
264
    public function setDescription($description)
265
    {
266
        $this->description = $description;
267
    }
268
269
    /**
270
     * Check if refund is approved
271
     * @return boolean
272
     */
273
    public function isApproved()
274
    {
275
        return $this->getStatus() === 'approved';
276
    }
277
278
    /**
279
     * Check if refund is declined
280
     * @return boolean
281
     */
282
    public function isDeclined()
283
    {
284
        return $this->getStatus() === 'declined';
285
    }
286
}
287