RefundRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 2
dl 0
loc 44
ccs 21
cts 21
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 20 1
A createResponse() 0 4 1
A setOriginalOrderNumber() 0 4 1
A getOriginalOrderNumber() 0 4 1
1
<?php
2
3
namespace Omnipay\AllPay\Message;
4
5
use Omnipay\Common\Exception\InvalidRequestException;
6
7
class RefundRequest extends AbstractRequest
8
{
9
    protected $apiEndpoint = 'refund';
10
11
    /**
12
     * @return array|mixed
13
     * @throws InvalidRequestException
14
     */
15 6
    public function getData()
16
    {
17 6
        $this->validate(
18 6
            'transactionReference',
19 6
            'originalOrderNumber',
20 6
            'amount',
21 6
            'paymentMethod',
22 6
            'currency'
23
        );
24
25 6
        $data = $this->getBaseData();
26 6
        $data['transType'] = 'REFD';
27 6
        $data['orderNum'] = $this->getTransactionReference();
28 6
        $data['origOrderNum'] = $this->getOriginalOrderNumber();
29 6
        $data['returnAmount'] = $this->getAmount();
30 6
        $data['paymentSchema'] = $this->getPaymentMethod();
31 6
        $data['orderCurrency'] = $this->getCurrency();
32
33 6
        return $data;
34
    }
35
36 6
    protected function createResponse($data)
37
    {
38 6
        return $this->response = new RefundResponse($this, $data);
39
    }
40
41 6
    public function setOriginalOrderNumber($value)
42
    {
43 6
        return $this->setParameter('originalOrderNumber', $value);
44
    }
45
46 6
    public function getOriginalOrderNumber()
47
    {
48 6
        return $this->getParameter('originalOrderNumber');
49
    }
50
}
51