|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* InterKassa driver for the Omnipay PHP payment processing library |
|
5
|
|
|
* |
|
6
|
|
|
* @link https://github.com/ange007/omnipay-interkassa |
|
7
|
|
|
* @package omnipay-interkassa |
|
8
|
|
|
* @license MIT |
|
9
|
|
|
* @copyright Copyright (c) 2017, ange007 ( original author: 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
|
|
|
/** |
|
21
|
|
|
* {@inheritdoc} |
|
22
|
|
|
*/ |
|
23
|
|
|
public function getData( ) |
|
24
|
|
|
{ |
|
25
|
|
|
$this->validate( 'checkoutId', 'amount', 'currency', 'description', 'transactionId' ); |
|
26
|
|
|
|
|
27
|
|
|
$return = [ |
|
28
|
|
|
'ik_co_id' => $this->getCheckoutId( ), |
|
29
|
|
|
'ik_am' => $this->getAmount( ), |
|
30
|
|
|
'ik_pm_no' => $this->getTransactionId( ), |
|
31
|
|
|
'ik_desc' => $this->getDescription( ), |
|
32
|
|
|
'ik_cur' => $this->getCurrency( ), |
|
33
|
|
|
]; |
|
34
|
|
|
|
|
35
|
|
|
if( $ik_pnd_u = $this->getReturnUrl( ) ) |
|
36
|
|
|
{ |
|
37
|
|
|
$return[ 'ik_pnd_u' ] = $ik_pnd_u; |
|
38
|
|
|
|
|
39
|
|
|
if( $ik_pnd_m = $this->getReturnMethod( ) ) |
|
40
|
|
|
{ |
|
41
|
|
|
$return[ 'ik_pnd_m' ] = $ik_pnd_m; |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
if( $ik_suc_u = $this->getReturnUrl( ) ) |
|
46
|
|
|
{ |
|
47
|
|
|
$return[ 'ik_suc_u' ] = $ik_suc_u; |
|
48
|
|
|
|
|
49
|
|
|
if( $ik_suc_m = $this->getReturnMethod( ) ) |
|
50
|
|
|
{ |
|
51
|
|
|
$return[ 'ik_suc_m' ] = $ik_suc_m; |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
if( $ik_fal_u = $this->getCancelUrl( ) ) |
|
56
|
|
|
{ |
|
57
|
|
|
$return[ 'ik_fal_u' ] = $ik_fal_u; |
|
58
|
|
|
|
|
59
|
|
|
if( $ik_fal_m = $this->getCancelMethod( ) ) |
|
60
|
|
|
{ |
|
61
|
|
|
$return[ 'ik_fal_m' ] = $ik_fal_m; |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
if( $ik_ia_u = $this->getNotifyUrl( ) ) |
|
66
|
|
|
{ |
|
67
|
|
|
$return[ 'ik_ia_u' ] = $ik_ia_u; |
|
68
|
|
|
|
|
69
|
|
|
if( $ik_ia_m = $this->getNotifyMethod( ) ) |
|
70
|
|
|
{ |
|
71
|
|
|
$return[ 'ik_ia_m' ] = $ik_ia_m; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
if( $signKey = $this->getSignKey( ) ) |
|
76
|
|
|
{ |
|
77
|
|
|
$return[ 'ik_sign' ] = $this->calculateSign( $return, $signKey ); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
return $return; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* {@inheritdoc} |
|
85
|
|
|
* @param mixed $data |
|
86
|
|
|
* @return PurchaseResponse |
|
87
|
|
|
*/ |
|
88
|
|
|
public function sendData( $data ) |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->response = new PurchaseResponse( $this, $data ); |
|
91
|
|
|
} |
|
92
|
|
|
} |