Completed
Push — master ( 98d687...92b683 )
by Andrii
03:05
created

PurchaseRequest   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 16
lcom 3
cbo 2
dl 0
loc 99
ccs 0
cts 80
cp 0
rs 10
c 0
b 0
f 0

16 Methods

Rating   Name   Duplication   Size   Complexity  
A getCurrency() 0 4 1
A setCurrency() 0 4 1
A getLanguage() 0 4 1
A setLanguage() 0 4 1
A getSignature() 0 4 1
A setSignature() 0 4 1
A getInvId() 0 4 1
A setInvId() 0 4 1
A getClient() 0 4 1
A setClient() 0 4 1
A getTime() 0 4 1
A setTime() 0 4 1
A getShpCart() 0 4 1
A setShpCart() 0 4 1
A getData() 0 21 1
A sendData() 0 4 1
1
<?php
2
/**
3
 * RoboKassa driver for Omnipay PHP payment library
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-robokassa
6
 * @package   omnipay-robokassa
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\RoboKassa\Message;
12
13
class PurchaseRequest extends AbstractRequest
14
{
15
    public function getCurrency()
16
    {
17
        return $this->getParameter('currency');
18
    }
19
20
    public function setCurrency($value)
21
    {
22
        return $this->setParameter('currency', $value);
23
    }
24
25
    public function getLanguage()
26
    {
27
        return $this->getParameter('language');
28
    }
29
30
    public function setLanguage($value)
31
    {
32
        return $this->setParameter('language', $value);
33
    }
34
35
    public function getSignature()
36
    {
37
        return $this->getParameter('signature');
38
    }
39
40
    public function setSignature($value)
41
    {
42
        return $this->setParameter('signature', $value);
43
    }
44
45
    public function getInvId()
46
    {
47
        return $this->getParameter('inv_id');
48
    }
49
50
    public function setInvId($value)
51
    {
52
        return $this->setParameter('inv_id', $value);
53
    }
54
55
    public function getClient()
56
    {
57
        return $this->getParameter('client');
58
    }
59
60
    public function setClient($value)
61
    {
62
        return $this->setParameter('client', $value);
63
    }
64
65
    public function getTime()
66
    {
67
        return $this->getParameter('time');
68
    }
69
70
    public function setTime($value)
71
    {
72
        return $this->setParameter('time', $value);
73
    }
74
75
    public function getShpCart()
76
    {
77
        return $this->getParameter('shp_cart');
78
    }
79
80
    public function setShpCart($value)
81
    {
82
        return $this->setParameter('shp_cart', $value);
83
    }
84
85
    public function getData()
86
    {
87
        $this->validate(
88
            'purse',
89
            'amount', 'currency', 'description',
90
            'returnUrl', 'cancelUrl', 'notifyUrl'
91
        );
92
93
        return [
94
            'Desc' => $this->getDescription(),
95
            'MrchLogin' => $this->getPurse(),
96
            'OutSum' => $this->getAmount(),
97
            'IncCurrLabel' => $this->getCurrency(),
98
            'InvId' => $this->getInvId(),
99
            'Culture' => $this->getLanguage(),
100
            'ShpCart' => $this->getShpCart(),
101
            'ShpClient' => $this->getClient(),
102
            'ShpTime' => $this->getTime(),
103
            'SignatureValue' => $this->getSignature(),
104
        ];
105
    }
106
107
    public function sendData($data)
108
    {
109
        return $this->response = new PurchaseResponse($this, $data);
110
    }
111
}
112