Completed
Push — master ( 1b7afa...9fbca5 )
by Dmitry
03:33
created

OldPurchaseRequest::getData()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 28
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 20
CRAP Score 4

Importance

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