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 PurchaseRequest. |
16
|
|
|
*/ |
17
|
|
|
class PurchaseRequest extends AbstractRequest |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* {@inheritdoc} |
21
|
|
|
*/ |
22
|
1 |
|
public function getData() |
23
|
|
|
{ |
24
|
1 |
|
$this->validate('checkoutId', 'amount', 'currency', 'description', 'transactionId'); |
25
|
|
|
|
26
|
|
|
$return = [ |
27
|
1 |
|
'ik_co_id' => $this->getCheckoutId(), |
28
|
1 |
|
'ik_am' => $this->getAmount(), |
29
|
1 |
|
'ik_pm_no' => $this->getTransactionId(), |
30
|
1 |
|
'ik_desc' => $this->getDescription(), |
31
|
1 |
|
'ik_cur' => $this->getCurrency(), |
32
|
|
|
]; |
33
|
|
|
|
34
|
1 |
|
if ($ik_pnd_u = $this->getReturnUrl()) { |
35
|
1 |
|
$return['ik_pnd_u'] = $ik_pnd_u; |
36
|
|
|
|
37
|
1 |
|
if ($ik_pnd_m = $this->getReturnMethod()) { |
38
|
|
|
$return['ik_pnd_m'] = $ik_pnd_m; |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
1 |
|
if ($ik_suc_u = $this->getReturnUrl()) { |
43
|
1 |
|
$return['ik_suc_u'] = $ik_suc_u; |
44
|
|
|
|
45
|
1 |
|
if ($ik_suc_m = $this->getReturnMethod()) { |
46
|
|
|
$return['ik_suc_m'] = $ik_suc_m; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
50
|
1 |
|
if ($ik_fal_u = $this->getCancelUrl()) { |
51
|
1 |
|
$return['ik_fal_u'] = $ik_fal_u; |
52
|
|
|
|
53
|
1 |
|
if ($ik_fal_m = $this->getCancelMethod()) { |
54
|
|
|
$return['ik_fal_m'] = $ik_fal_m; |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
1 |
|
if ($ik_ia_u = $this->getNotifyUrl()) { |
59
|
1 |
|
$return['ik_ia_u'] = $ik_ia_u; |
60
|
|
|
|
61
|
1 |
|
if ($ik_ia_m = $this->getNotifyMethod()) { |
62
|
|
|
$return['ik_ia_m'] = $ik_ia_m; |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
66
|
1 |
|
if ($this->getSecret()) { |
67
|
1 |
|
$return['ik_sign'] = $this->calculateSign($return); |
68
|
|
|
} |
69
|
|
|
|
70
|
1 |
|
return $return; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* {@inheritdoc} |
75
|
|
|
* @param mixed $data |
76
|
|
|
* @return PurchaseResponse |
77
|
|
|
*/ |
78
|
1 |
|
public function sendData($data) |
79
|
|
|
{ |
80
|
1 |
|
return $this->response = new PurchaseResponse($this, $data); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|