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
|
2 |
|
public function getBaggageFields() |
24
|
|
|
{ |
25
|
2 |
|
return $this->getCurrency() . ' ' . $this->username; |
|
|
|
|
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
2 |
|
public function getData() |
32
|
|
|
{ |
33
|
2 |
|
$this->validate('checkoutId', 'amount', 'currency', 'description', 'transactionId'); |
34
|
|
|
|
35
|
|
|
$return = [ |
36
|
2 |
|
'ik_shop_id' => $this->getCheckoutId(), |
37
|
2 |
|
'ik_payment_amount' => $this->getAmount(), |
38
|
2 |
|
'ik_payment_id' => $this->getTransactionId(), |
39
|
2 |
|
'ik_payment_desc' => $this->getDescription(), |
40
|
2 |
|
'ik_baggage_fields' => $this->getBaggageFields(), |
41
|
2 |
|
]; |
42
|
|
|
|
43
|
2 |
|
if ($ik_success_url = $this->getReturnUrl()) { |
44
|
2 |
|
$return['ik_success_url'] = $ik_success_url; |
45
|
2 |
|
$return['ik_success_method'] = $this->getReturnMethod(); |
46
|
2 |
|
} |
47
|
|
|
|
48
|
2 |
|
if ($ik_fail_method = $this->getCancelUrl()) { |
49
|
2 |
|
$return['ik_fail_url'] = $ik_fail_method; |
50
|
2 |
|
$return['ik_fail_method'] = $this->getCancelMethod(); |
51
|
2 |
|
} |
52
|
|
|
|
53
|
2 |
|
if ($ik_status_url = $this->getNotifyUrl()) { |
54
|
2 |
|
$return['ik_status_url'] = $ik_status_url; |
55
|
2 |
|
$return['ik_status_method'] = $this->getNotifyMethod(); |
56
|
2 |
|
} |
57
|
|
|
|
58
|
2 |
|
return $return; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* {@inheritdoc} |
63
|
|
|
* @param mixed $data |
64
|
|
|
* @return PurchaseResponse |
65
|
|
|
*/ |
66
|
1 |
|
public function sendData($data) |
67
|
|
|
{ |
68
|
1 |
|
return $this->response = new PurchaseResponse($this, $data); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
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: