1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* RoboKassa driver for the Omnipay PHP payment processing library |
5
|
|
|
* |
6
|
|
|
* @link https://github.com/hiqdev/omnipay-epayservice |
7
|
|
|
* @package omnipay-epayservice |
8
|
|
|
* @license MIT |
9
|
|
|
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Omnipay\RoboKassa\Message; |
13
|
|
|
|
14
|
|
|
class PurchaseRequest extends AbstractRequest |
15
|
|
|
{ |
16
|
|
|
public function getCurrency() |
17
|
|
|
{ |
18
|
|
|
return $this->getParameter('currency'); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function setCurrency($value) |
22
|
|
|
{ |
23
|
|
|
return $this->setParameter('currency', $value); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getLanguage() |
27
|
|
|
{ |
28
|
|
|
return $this->getParameter('language'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function setLanguage($value) |
32
|
|
|
{ |
33
|
|
|
return $this->setParameter('language', $value); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function getSignatureValue() |
37
|
|
|
{ |
38
|
|
|
return $this->getParameter('signature'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function setSignatureValue($value) |
42
|
|
|
{ |
43
|
|
|
return $this->setParameter('signature', $value); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getData() |
47
|
|
|
{ |
48
|
|
|
$this->validate( |
49
|
|
|
'purse', |
50
|
|
|
'amount', 'currency', 'description', |
51
|
|
|
'returnUrl', 'cancelUrl', 'notifyUrl' |
52
|
|
|
); |
53
|
|
|
|
54
|
|
|
return [ |
55
|
|
|
'Desc' => $this->getDescription(), |
56
|
|
|
'MrchLogin' => $this->getPurse(), |
57
|
|
|
'OutSum' => $this->getAmount(), |
58
|
|
|
'IncCurrLabel' => $this->getCurrency(), |
59
|
|
|
'Culture' => $this->getLanguage(), |
60
|
|
|
'ShpCart' => $this->is_cart, |
|
|
|
|
61
|
|
|
'ShpClient' => $this->client, |
|
|
|
|
62
|
|
|
'ShpTime' => $this->time, |
|
|
|
|
63
|
|
|
'SignatureValue' => $this->getSignatureValue(), |
64
|
|
|
]; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function sendData($data) |
68
|
|
|
{ |
69
|
|
|
return $this->response = new PurchaseResponse($this, $data); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: