OldPurchaseRequest::getData()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 16
cts 16
cp 1
rs 9.472
c 0
b 0
f 0
cc 4
nc 8
nop 0
crap 4
1
<?php
2
/**
3
 * InterKassa driver for the Omnipay PHP payment processing library
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-interkassa
6
 * @package   omnipay-interkassa
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\InterKassa\Message;
12
13
/**
14
 * Class OldPurchaseRequest
15
 * Implements request for APIv1.
16
 */
17
class OldPurchaseRequest extends AbstractRequest
18
{
19
    /**
20
     * @return string
21
     */
22
    public function getBaggageFields()
23
    {
24
        return $this->getCurrency();
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 3
    public function getData()
31
    {
32 3
        $this->validate('checkoutId', 'amount', 'currency', 'description', 'transactionId');
33
34
        $return = [
35 3
            'ik_shop_id' => $this->getCheckoutId(),
36 3
            'ik_payment_amount' => $this->getAmount(),
37 3
            'ik_payment_id' => $this->getTransactionId(),
38 3
            'ik_payment_desc' => $this->getDescription(),
39
        ];
40
41 3
        if ($ik_success_url = $this->getReturnUrl()) {
42 3
            $return['ik_success_url'] = $ik_success_url;
43 3
            $return['ik_success_method'] = $this->getReturnMethod();
44
        }
45
46 3
        if ($ik_fail_method = $this->getCancelUrl()) {
47 3
            $return['ik_fail_url'] = $ik_fail_method;
48 3
            $return['ik_fail_method'] = $this->getCancelMethod();
49
        }
50
51 3
        if ($ik_status_url = $this->getNotifyUrl()) {
52 3
            $return['ik_status_url'] = $ik_status_url;
53 3
            $return['ik_status_method'] = $this->getNotifyMethod();
54
        }
55
56 3
        return $return;
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     * @param mixed $data
62
     * @return PurchaseResponse
63
     */
64 2
    public function sendData($data)
65
    {
66 2
        return $this->response = new PurchaseResponse($this, $data);
67
    }
68
}
69