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

OldPurchaseRequest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 91.67%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 6
c 3
b 1
f 0
lcom 2
cbo 2
dl 0
loc 52
ccs 22
cts 24
cp 0.9167
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBaggageFields() 0 4 1
B getData() 0 28 4
A sendData() 0 4 1
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