1 | <?php |
||
7 | class PaymentVerification |
||
8 | { |
||
9 | /** |
||
10 | * Command to Pass to the PayuService. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $command = 'verify_payment'; |
||
15 | |||
16 | /** |
||
17 | * Merchant Key. |
||
18 | * |
||
19 | * @var string|null |
||
20 | */ |
||
21 | protected $key = null; |
||
22 | |||
23 | /** |
||
24 | * Merchant Salt. |
||
25 | * |
||
26 | * @var string|null |
||
27 | */ |
||
28 | protected $salt = null; |
||
29 | |||
30 | /** |
||
31 | * Payu Service URL. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $url = null; |
||
36 | |||
37 | /** |
||
38 | * Transaction ID. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $txn_id = []; |
||
43 | |||
44 | /** |
||
45 | * Original Response. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $response = []; |
||
50 | |||
51 | |||
52 | /** |
||
53 | * PaymentVerification constructor. |
||
54 | * |
||
55 | * @param $txn_id |
||
56 | */ |
||
57 | public function __construct($txn_id) |
||
69 | |||
70 | /** |
||
71 | * Request for Verification Status. |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function request() |
||
85 | |||
86 | /** |
||
87 | * Simple data accessor. |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | public function simple() |
||
95 | |||
96 | /** |
||
97 | * Full Data Accessor. |
||
98 | * |
||
99 | * @return array |
||
100 | */ |
||
101 | public function full() |
||
105 | |||
106 | /** |
||
107 | * Get Response according to Simple or Full. |
||
108 | * |
||
109 | * @param boolean $simple |
||
110 | * @return array |
||
111 | */ |
||
112 | protected function getResponse($simple) |
||
124 | |||
125 | /** |
||
126 | * Get the Request Params for Verification. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getVerificationPostFields() |
||
139 | |||
140 | /** |
||
141 | * Set the Verification Response. |
||
142 | * |
||
143 | * @throws \Exception |
||
144 | */ |
||
145 | protected function sendRequest() |
||
166 | |||
167 | /** |
||
168 | * Update Payu Payments Table Entries. |
||
169 | * |
||
170 | * @return boolean |
||
171 | */ |
||
172 | protected function updatePayuTransaction() |
||
183 | |||
184 | /** |
||
185 | * Get Full Response for user. |
||
186 | * |
||
187 | * @return array |
||
188 | */ |
||
189 | protected function getFullResponseData() |
||
204 | |||
205 | /** |
||
206 | * Get Simple Response for user. |
||
207 | * |
||
208 | * @return array |
||
209 | */ |
||
210 | protected function getSimpleResponseData() |
||
223 | |||
224 | /** |
||
225 | * Get Response Message. |
||
226 | * |
||
227 | * @param $item |
||
228 | * @return string |
||
229 | */ |
||
230 | protected function getResponseMessage($item) |
||
239 | |||
240 | /** |
||
241 | * @param $item |
||
242 | * @return mixed |
||
243 | */ |
||
244 | protected function getPayuPaymentAttributes($item) |
||
252 | |||
253 | } |