RefundRequest::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 15
cts 15
cp 1
rs 9.6
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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