|
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
|
|
|
* InterKassa Abstract Response. |
|
16
|
|
|
*/ |
|
17
|
|
|
abstract class AbstractResponse extends \Omnipay\Common\Message\AbstractResponse |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* {@inheritdoc} |
|
21
|
|
|
* @var AbstractRequest |
|
22
|
|
|
*/ |
|
23
|
|
|
public $request; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* The checkout ID. |
|
27
|
|
|
* |
|
28
|
|
|
* @return string |
|
29
|
|
|
*/ |
|
30
|
|
|
public function getCheckoutId( ) |
|
31
|
|
|
{ |
|
32
|
|
|
return isset( $this->data[ 'ik_co_id' ] ) ? $this->data[ 'ik_co_id' ] : null; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* The transaction identifier generated by the merchant website. |
|
37
|
|
|
* |
|
38
|
|
|
* @return string |
|
39
|
|
|
*/ |
|
40
|
|
|
public function getTransactionId( ) |
|
41
|
|
|
{ |
|
42
|
|
|
return isset( $this->data[ 'ik_pm_no' ] ) ? $this->data[ 'ik_pm_no' ] : null; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* The state of the payment. |
|
47
|
|
|
* Possible results: |
|
48
|
|
|
* - `new`: newly created payment |
|
49
|
|
|
* - `waitAccept`: waits for the payment |
|
50
|
|
|
* - `process`: the payment is being processed |
|
51
|
|
|
* - `success`: the payment processed successfully |
|
52
|
|
|
* - `canceled`: the payment have been canceled |
|
53
|
|
|
* - `fail`: the payment failed. |
|
54
|
|
|
* |
|
55
|
|
|
* @return string |
|
56
|
|
|
* @see isSuccessful |
|
57
|
|
|
*/ |
|
58
|
|
|
public function getTransactionStatus( ) |
|
59
|
|
|
{ |
|
60
|
|
|
return isset( $this->data[ 'ik_inv_st' ] ) ? $this->data[ 'ik_inv_st' ] : null; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* {@inheritdoc} |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getTransactionReference( ) |
|
67
|
|
|
{ |
|
68
|
|
|
return isset( $this->data[ 'ik_inv_id' ] ) ? $this->data[ 'ik_inv_id' ] : null; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* The amount of payment. |
|
73
|
|
|
* |
|
74
|
|
|
* @return mixed |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getAmount( ) |
|
77
|
|
|
{ |
|
78
|
|
|
return isset( $this->data[ 'ik_am' ] ) ? $this->data[ 'ik_am' ] : null; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* The currency of the payment. |
|
83
|
|
|
* @return string |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getCurrency( ) |
|
86
|
|
|
{ |
|
87
|
|
|
return isset( $this->data[ 'ik_cur' ] ) ? $this->data[ 'ik_cur' ] : null; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* The time of request processing. |
|
92
|
|
|
* |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getTime( ) |
|
96
|
|
|
{ |
|
97
|
|
|
$requestDate = isset( $this->data[ 'ik_inv_prc' ] ) ? $this->data[ 'ik_inv_prc' ] : null; |
|
98
|
|
|
|
|
99
|
|
|
return ( new \DateTime( $requestDate, new \DateTimeZone( 'Europe/Moscow' ) ) )->format( 'c' ); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @return string the payment method inside a gateway (Visa, WebMoney, etc) |
|
104
|
|
|
*/ |
|
105
|
|
|
public function getPayer( ) |
|
106
|
|
|
{ |
|
107
|
|
|
return isset( $this->data[ 'ik_pw_via' ] ) ? $this->data[ 'ik_pw_via' ] : null; |
|
108
|
|
|
} |
|
109
|
|
|
} |