|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Alcalyn\PayplugBundle\Model; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* IPN |
|
7
|
|
|
* |
|
8
|
|
|
* IPN instance created when payplug send an IPN to your server. |
|
9
|
|
|
* |
|
10
|
|
|
* @method IPN setAmount(integer $amount) |
|
11
|
|
|
* @method IPN setEmail($email) |
|
12
|
|
|
* @method IPN setFirstName($firstName) |
|
13
|
|
|
* @method IPN setLastName($lastName) |
|
14
|
|
|
* @method IPN setCustomer($customer) |
|
15
|
|
|
* @method IPN setOrder($order) |
|
16
|
|
|
* @method IPN setCustomData($customData) |
|
17
|
|
|
* @method IPN setOrigin($origin) |
|
18
|
|
|
*/ |
|
19
|
|
|
class IPN extends Transaction |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Value of field $state when payment is done |
|
23
|
|
|
* |
|
24
|
|
|
* @var string |
|
25
|
|
|
*/ |
|
26
|
|
|
const PAYMENT_PAID = 'paid'; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Value of field $state when payment has been refunded |
|
30
|
|
|
* |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
const PAYMENT_REFUNDED = 'refunded'; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* The new state of the transaction: 'paid' or 'refunded'. |
|
37
|
|
|
* |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
private $state; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* The PayPlug transaction ID. |
|
44
|
|
|
* We recommend you save it and associate it with this order in your database. |
|
45
|
|
|
* |
|
46
|
|
|
* @var integer |
|
47
|
|
|
*/ |
|
48
|
|
|
private $idTransaction; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* If value is true, the payment was done in TEST (Sandbox) mode. |
|
52
|
|
|
* |
|
53
|
|
|
* @var boolean |
|
54
|
|
|
*/ |
|
55
|
|
|
private $isTest; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Set state |
|
59
|
|
|
* |
|
60
|
|
|
* @param string $state |
|
61
|
|
|
* @return IPN |
|
62
|
|
|
*/ |
|
63
|
|
|
public function setState($state) |
|
64
|
|
|
{ |
|
65
|
|
|
$this->state = $state; |
|
66
|
|
|
|
|
67
|
|
|
return $this; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Get state |
|
72
|
|
|
* |
|
73
|
|
|
* @return string |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getState() |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->state; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Set idTransaction |
|
82
|
|
|
* |
|
83
|
|
|
* @param integer $idTransaction |
|
84
|
|
|
* @return IPN |
|
85
|
|
|
*/ |
|
86
|
|
|
public function setIdTransaction($idTransaction) |
|
87
|
|
|
{ |
|
88
|
|
|
$this->idTransaction = $idTransaction; |
|
89
|
|
|
|
|
90
|
|
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Get idTransaction |
|
95
|
|
|
* |
|
96
|
|
|
* @return integer |
|
97
|
|
|
*/ |
|
98
|
|
|
public function getIdTransaction() |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->idTransaction; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Set isTest |
|
105
|
|
|
* |
|
106
|
|
|
* @param boolean $isTest |
|
107
|
|
|
* @return IPN |
|
108
|
|
|
*/ |
|
109
|
|
|
public function setIsTest($isTest) |
|
110
|
|
|
{ |
|
111
|
|
|
$this->isTest = $isTest; |
|
112
|
|
|
|
|
113
|
|
|
return $this; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Get isTest |
|
118
|
|
|
* |
|
119
|
|
|
* @return boolean |
|
120
|
|
|
*/ |
|
121
|
|
|
public function getIsTest() |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->isTest; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @return string |
|
128
|
|
|
*/ |
|
129
|
|
|
public static function getClassName() |
|
130
|
|
|
{ |
|
131
|
|
|
return __CLASS__; |
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
|