Version Notes
This version is properly tested on the following Magento CE versions: 1.5, 1.6, 1.7,1.8,1.9.* . In this particular version we are supporting it to run on PHP V 5.5.X.
Download this release
Release Info
Developer | Rave Infosys |
Extension | First_Data_Gateway_Integration |
Version | 1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.0.7
- app/code/community/Raveinfosys/Linkpoint/Model/Linkpoint.php +476 -482
- app/code/community/Raveinfosys/Linkpoint/Model/Observer.php +13 -13
- app/code/community/Raveinfosys/Linkpoint/Model/Soapclienthmac.php +24 -22
- app/code/community/Raveinfosys/Linkpoint/etc/config.xml +1 -1
- app/code/community/Raveinfosys/Linkpoint/etc/system.xml +1 -1
- app/code/community/Raveinfosys/Linkpoint/sql/linkpoint_setup/mysql4-install-1.0.0.php +1 -1
- package.xml +10 -11
app/code/community/Raveinfosys/Linkpoint/Model/Linkpoint.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* NOTICE OF LICENSE
|
4 |
*
|
@@ -16,63 +17,64 @@
|
|
16 |
*/
|
17 |
class Raveinfosys_Linkpoint_Model_Linkpoint extends Mage_Payment_Model_Method_Ccsave
|
18 |
{
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
protected $_canAuthorize
|
23 |
-
protected $_canCapture
|
24 |
-
protected $_canCapturePartial
|
25 |
-
protected $_canRefund
|
26 |
-
|
27 |
-
protected $_canVoid
|
28 |
-
protected $_canUseInternal
|
29 |
-
protected $_canUseCheckout
|
30 |
-
protected $_canUseForMultishipping
|
31 |
-
protected $_isInitializeNeeded
|
32 |
-
protected $_canFetchTransactionInfo
|
33 |
-
protected $_canReviewPayment
|
34 |
-
protected $_canCreateBillingAgreement
|
35 |
-
protected $_canManageRecurringProfiles
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
39 |
* Fields that should be replaced in debug with '***'
|
40 |
*
|
41 |
* @var array
|
42 |
*/
|
43 |
protected $_debugReplacePrivateDataKeys = array('keyId', 'hmacKey', 'gatewayId', 'gatewayPass');
|
44 |
-
|
45 |
-
|
46 |
* Validate payment method information object
|
47 |
*
|
48 |
* @param Mage_Payment_Model_Info $info
|
49 |
* @return Mage_Payment_Model_Abstract
|
50 |
*/
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
$order_amount = (double)$info->getQuote()->getBaseGrandTotal();
|
57 |
} elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
|
58 |
-
$order_amount = (double)$info->getOrder()->getQuoteBaseGrandTotal();
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
if(!empty($order_min) && (double)$order_min>$order_amount) {
|
67 |
-
Mage::throwException("Order amount less than required Minimum order amount.");
|
68 |
-
}
|
69 |
-
/*
|
70 |
-
* calling parent validate function
|
71 |
-
*/
|
72 |
parent::validate();
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
* Send authorize request to gateway
|
77 |
*
|
78 |
* @param Varien_Object $payment
|
@@ -80,298 +82,287 @@ class Raveinfosys_Linkpoint_Model_Linkpoint extends Mage_Payment_Model_Method_Cc
|
|
80 |
* @return Mage_Paygate_Model_Authorizenet
|
81 |
* @throws Mage_Core_Exception
|
82 |
*/
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
Mage::throwException(Mage::helper('linkpoint')->__('Invalid amount for transaction.'));
|
87 |
-
}
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
public function capture(Varien_Object $payment, $amount)
|
182 |
-
{
|
183 |
-
if ($amount <= 0) {
|
184 |
Mage::throwException(Mage::helper('linkpoint')->__('Invalid amount for transaction.'));
|
185 |
}
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
Mage::throwException("No response found");
|
321 |
-
}
|
322 |
-
}
|
323 |
-
|
324 |
-
/**
|
325 |
* refund the amount with transaction id
|
326 |
*
|
327 |
* @param string $payment Varien_Object object
|
328 |
* @return Mage_Paygate_Model_Authorizenet
|
329 |
* @throws Mage_Core_Exception
|
330 |
*/
|
331 |
-
public function refund(Varien_Object $payment, $amount)
|
332 |
-
|
|
|
333 |
$data = $this->_prepareData();
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
}
|
371 |
Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment.'));
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
* Void the payment through gateway
|
376 |
*
|
377 |
* @param Varien_Object $payment
|
@@ -379,195 +370,197 @@ class Raveinfosys_Linkpoint_Model_Linkpoint extends Mage_Payment_Model_Method_Cc
|
|
379 |
* @throws Mage_Core_Exception
|
380 |
*/
|
381 |
public function void(Varien_Object $payment)
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
}
|
414 |
$payment->setStatus(self::STATUS_ERROR);
|
415 |
Mage::throwException('Invalid transaction ID.');
|
416 |
}
|
417 |
-
|
418 |
-
|
419 |
* Cancel payment
|
420 |
*
|
421 |
* @param Varien_Object $invoicePayment
|
422 |
* @return Mage_Payment_Model_Abstract
|
423 |
*/
|
424 |
-
public function cancel(Varien_Object $payment)
|
|
|
425 |
return $this->void($payment);
|
426 |
}
|
427 |
-
|
428 |
-
|
429 |
* converts a hash of name-value pairs
|
430 |
* to the correct array for new API
|
431 |
-
|
432 |
-
|
433 |
* @param Array $pdata
|
434 |
* @return String $xml
|
435 |
*/
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
* converts the LSGS response xml string
|
483 |
* to a hash of name-value pairs
|
484 |
-
|
485 |
* @param String $xml
|
486 |
* @return Array $retarr
|
487 |
*/
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
|
|
497 |
* chnage from: process hash table or xml string table using cURL
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
* @param Array $data
|
502 |
* @return String $xml
|
503 |
*/
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
$payment->setTransactionId($transactionId);
|
565 |
$payment->resetTransactionAdditionalInfo();
|
566 |
foreach ($transactionDetails as $key => $value) {
|
567 |
$payment->setData($key, $value);
|
568 |
}
|
569 |
-
|
570 |
-
$transaction = $payment->addTransaction($transactionType, null, false
|
571 |
foreach ($transactionDetails as $key => $value) {
|
572 |
$payment->unsetData($key);
|
573 |
}
|
@@ -577,6 +570,7 @@ class Raveinfosys_Linkpoint_Model_Linkpoint extends Mage_Payment_Model_Method_Cc
|
|
577 |
|
578 |
return $transaction;
|
579 |
}
|
|
|
580 |
}
|
581 |
|
582 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* NOTICE OF LICENSE
|
5 |
*
|
17 |
*/
|
18 |
class Raveinfosys_Linkpoint_Model_Linkpoint extends Mage_Payment_Model_Method_Ccsave
|
19 |
{
|
20 |
+
|
21 |
+
protected $_code = 'linkpoint'; //unique internal payment method identifier
|
22 |
+
protected $_isGateway = true; //Is this payment method a gateway (online auth/charge) ?
|
23 |
+
protected $_canAuthorize = true; //Can authorize online?
|
24 |
+
protected $_canCapture = true; //Can capture funds online?
|
25 |
+
protected $_canCapturePartial = false; //Can capture partial amounts online?
|
26 |
+
protected $_canRefund = true; //Can refund online?
|
27 |
+
protected $_canRefundInvoicePartial = true; //Can refund invoices partially?
|
28 |
+
protected $_canVoid = true; //Can void transactions online?
|
29 |
+
protected $_canUseInternal = true; //Can use this payment method in administration panel?
|
30 |
+
protected $_canUseCheckout = true; //Can show this payment method as an option on checkout payment page?
|
31 |
+
protected $_canUseForMultishipping = false; //Is this payment method suitable for multi-shipping checkout?
|
32 |
+
protected $_isInitializeNeeded = false;
|
33 |
+
protected $_canFetchTransactionInfo = false;
|
34 |
+
protected $_canReviewPayment = false;
|
35 |
+
protected $_canCreateBillingAgreement = false;
|
36 |
+
protected $_canManageRecurringProfiles = false;
|
37 |
+
protected $_canSaveCc = false; //Can save credit card information for future processing?
|
38 |
+
protected $_infoBlockType = 'payment/info_cc';
|
39 |
+
|
40 |
+
/**
|
41 |
* Fields that should be replaced in debug with '***'
|
42 |
*
|
43 |
* @var array
|
44 |
*/
|
45 |
protected $_debugReplacePrivateDataKeys = array('keyId', 'hmacKey', 'gatewayId', 'gatewayPass');
|
46 |
+
|
47 |
+
/**
|
48 |
* Validate payment method information object
|
49 |
*
|
50 |
* @param Mage_Payment_Model_Info $info
|
51 |
* @return Mage_Payment_Model_Abstract
|
52 |
*/
|
53 |
+
public function validate()
|
54 |
+
{
|
55 |
+
$info = $this->getInfoInstance();
|
56 |
+
$order_amount = 0;
|
57 |
+
if ($info instanceof Mage_Sales_Model_Quote_Payment) {
|
58 |
+
$order_amount = (double) $info->getQuote()->getBaseGrandTotal();
|
59 |
} elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
|
60 |
+
$order_amount = (double) $info->getOrder()->getQuoteBaseGrandTotal();
|
61 |
+
}
|
62 |
+
|
63 |
+
$order_min = $this->getConfigData('min_order_total');
|
64 |
+
$order_max = $this->getConfigData('max_order_total');
|
65 |
+
if (!empty($order_max) && (double) $order_max < $order_amount) {
|
66 |
+
Mage::throwException("Order amount greater than permissible Maximum order amount.");
|
67 |
}
|
68 |
+
if (!empty($order_min) && (double) $order_min > $order_amount) {
|
69 |
+
Mage::throwException("Order amount less than required Minimum order amount.");
|
70 |
+
}
|
71 |
+
/*
|
72 |
+
* calling parent validate function
|
73 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
parent::validate();
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
* Send authorize request to gateway
|
79 |
*
|
80 |
* @param Varien_Object $payment
|
82 |
* @return Mage_Paygate_Model_Authorizenet
|
83 |
* @throws Mage_Core_Exception
|
84 |
*/
|
85 |
+
public function authorize(Varien_Object $payment, $amount)
|
86 |
+
{
|
87 |
+
if ($amount <= 0) {
|
88 |
Mage::throwException(Mage::helper('linkpoint')->__('Invalid amount for transaction.'));
|
89 |
+
}
|
90 |
+
$payment->setAmount($amount);
|
91 |
+
$data = $this->_prepareData();
|
92 |
+
$data['trans_type'] = "01";
|
93 |
+
$creditcard = array(
|
94 |
+
'cardnumber' => $payment->getCcNumber(),
|
95 |
+
'cardexpmonth' => $payment->getCcExpMonth(),
|
96 |
+
'ccname' => $payment->getCcOwner(),
|
97 |
+
'cardexpyear' => substr($payment->getCcExpYear(), -2),
|
98 |
+
);
|
99 |
+
if ($this->getConfigData('useccv') == 1) {
|
100 |
+
$creditcard["cvmindicator"] = "provided";
|
101 |
+
$creditcard["cvmvalue"] = $payment->getCcCid();
|
102 |
+
$creditcard["cvv2indicator"] = 1;
|
103 |
+
$creditcard["cvv2value"] = $payment->getCcCid();
|
104 |
+
}
|
105 |
+
|
106 |
+
$shipping = array();
|
107 |
+
$billing = array();
|
108 |
+
$order = $payment->getOrder();
|
109 |
+
if (!empty($order)) {
|
110 |
+
$BillingAddress = $order->getBillingAddress();
|
111 |
+
|
112 |
+
$billing['name'] = $BillingAddress->getFirstname() . " " . $BillingAddress->getLastname();
|
113 |
+
$billing['company'] = $BillingAddress->getCompany();
|
114 |
+
$billing['address'] = $BillingAddress->getStreet(1);
|
115 |
+
$billing['city'] = $BillingAddress->getCity();
|
116 |
+
$billing['state'] = $BillingAddress->getRegion();
|
117 |
+
$billing['zip'] = $BillingAddress->getPostcode();
|
118 |
+
$billing['country'] = $BillingAddress->getCountry();
|
119 |
+
$billing['email'] = $order->getCustomerEmail();
|
120 |
+
$billing['phone'] = $BillingAddress->getTelephone();
|
121 |
+
$billing['fax'] = $BillingAddress->getFax();
|
122 |
+
|
123 |
+
$ShippingAddress = $order->getShippingAddress();
|
124 |
+
if (!empty($shipping)) {
|
125 |
+
$shipping['sname'] = $ShippingAddress->getFirstname() . " " . $ShippingAddress->getLastname();
|
126 |
+
$shipping['saddress1'] = $ShippingAddress->getStreet(1);
|
127 |
+
$shipping['scity'] = $ShippingAddress->getCity();
|
128 |
+
$shipping['sstate'] = $ShippingAddress->getRegion();
|
129 |
+
$shipping['szip'] = $ShippingAddress->getPostcode();
|
130 |
+
$shipping['scountry'] = $ShippingAddress->getCountry();
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
$merchantinfo = array();
|
135 |
+
$merchantinfo['gatewayId'] = $data['gatewayId'];
|
136 |
+
$merchantinfo['gatewayPass'] = $data['gatewayPass'];
|
137 |
+
$paymentdetails = array();
|
138 |
+
$paymentdetails['chargetotal'] = $payment->getAmount();
|
139 |
+
|
140 |
+
$data = array_merge($data, $creditcard, $billing, $shipping, $merchantinfo, $paymentdetails);
|
141 |
+
|
142 |
+
$result = $this->_postRequest($data);
|
143 |
+
|
144 |
+
if (is_array($result) && count($result) > 0) {
|
145 |
+
|
146 |
+
if (array_key_exists("Bank_Message", $result)) {
|
147 |
+
if ($result["Bank_Message"] != "Approved") {
|
148 |
+
$payment->setStatus(self::STATUS_ERROR);
|
149 |
+
Mage::throwException("Gateway error : {" . (string) $result["EXact_Message"] . "}");
|
150 |
+
} elseif ($result['Transaction_Error']) {
|
151 |
+
Mage::throwException("Returned Error Message: " . $result['Transaction_Error']);
|
152 |
+
}
|
153 |
+
/*
|
154 |
+
elseif($this->getConfigData('useccv') && $trxnResult->CVV2 != "M" ){
|
155 |
+
Mage::throwException("Invalid Card Verification Number(".$trxnResult->CVV2.")");
|
156 |
+
} */ else {
|
157 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
158 |
+
$payment->setAdditionalInformation('payment_type', $this->getConfigData('payment_action'));
|
159 |
+
$payment->setLastTransId((string) $result["Authorization_Num"]);
|
160 |
+
$payment->setTransactionTag((string) $result["Transaction_Tag"]);
|
161 |
+
if (!$payment->getParentTransactionId() || (string) $result["Authorization_Num"] != $payment->getParentTransactionId()) {
|
162 |
+
$payment->setTransactionId((string) $result["Authorization_Num"]);
|
163 |
+
}
|
164 |
+
$this->_addTransaction(
|
165 |
+
$payment, $result["Authorization_Num"], Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, array('is_transaction_closed' => 0));
|
166 |
+
$payment->setSkipTransactionCreation(true);
|
167 |
+
return $this;
|
168 |
+
}
|
169 |
+
} else {
|
170 |
+
Mage::throwException("No approval found");
|
171 |
+
}
|
172 |
+
} else {
|
173 |
+
Mage::throwException("No response found");
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
public function capture(Varien_Object $payment, $amount)
|
178 |
+
{
|
179 |
+
if ($amount <= 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
Mage::throwException(Mage::helper('linkpoint')->__('Invalid amount for transaction.'));
|
181 |
}
|
182 |
|
183 |
+
if ($payment->getTransactionTag() != '' && Mage::app()->getStore()->isAdmin()) {
|
184 |
+
return $this->authorizePayment($payment, number_format($amount, 2, '.', ''));
|
185 |
+
}
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
$payment->setAmount($amount);
|
190 |
+
$data = $this->_prepareData();
|
191 |
+
$data['trans_type'] = "00";
|
192 |
+
$creditcard = array(
|
193 |
+
'cardnumber' => $payment->getCcNumber(),
|
194 |
+
'cardexpmonth' => $payment->getCcExpMonth(),
|
195 |
+
'cardexpyear' => substr($payment->getCcExpYear(), -2),
|
196 |
+
'ccname' => $payment->getCcOwner()
|
197 |
+
);
|
198 |
+
if ($this->getConfigData('useccv') == 1) {
|
199 |
+
$creditcard["cvmindicator"] = "provided";
|
200 |
+
$creditcard["cvmvalue"] = $payment->getCcCid();
|
201 |
+
$creditcard["cvv2indicator"] = 1;
|
202 |
+
$creditcard["cvv2value"] = $payment->getCcCid();
|
203 |
+
}
|
204 |
+
|
205 |
+
$shipping = array();
|
206 |
+
$billing = array();
|
207 |
+
$order = $payment->getOrder();
|
208 |
+
if (!empty($order)) {
|
209 |
+
$BillingAddress = $order->getBillingAddress();
|
210 |
+
|
211 |
+
$billing['name'] = $BillingAddress->getFirstname() . " " . $BillingAddress->getLastname();
|
212 |
+
$billing['company'] = $BillingAddress->getCompany();
|
213 |
+
$billing['address'] = $BillingAddress->getStreet(1);
|
214 |
+
$billing['city'] = $BillingAddress->getCity();
|
215 |
+
$billing['state'] = $BillingAddress->getRegion();
|
216 |
+
$billing['zip'] = $BillingAddress->getPostcode();
|
217 |
+
$billing['country'] = $BillingAddress->getCountry();
|
218 |
+
$billing['email'] = $order->getCustomerEmail();
|
219 |
+
$billing['phone'] = $BillingAddress->getTelephone();
|
220 |
+
$billing['fax'] = $BillingAddress->getFax();
|
221 |
+
|
222 |
+
$ShippingAddress = $order->getShippingAddress();
|
223 |
+
if (!empty($shipping)) {
|
224 |
+
$shipping['sname'] = $ShippingAddress->getFirstname() . " " . $ShippingAddress->getLastname();
|
225 |
+
$shipping['saddress1'] = $ShippingAddress->getStreet(1);
|
226 |
+
$shipping['scity'] = $ShippingAddress->getCity();
|
227 |
+
$shipping['sstate'] = $ShippingAddress->getRegion();
|
228 |
+
$shipping['szip'] = $ShippingAddress->getPostcode();
|
229 |
+
$shipping['scountry'] = $ShippingAddress->getCountry();
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
$merchantinfo = array();
|
234 |
+
$merchantinfo['gatewayId'] = $data['gatewayId'];
|
235 |
+
$merchantinfo['gatewayPass'] = $data['gatewayPass'];
|
236 |
+
$paymentdetails = array();
|
237 |
+
$paymentdetails['chargetotal'] = $payment->getAmount();
|
238 |
+
|
239 |
+
$data = array_merge($data, $creditcard, $billing, $shipping, $merchantinfo, $paymentdetails);
|
240 |
+
|
241 |
+
$result = $this->_postRequest($data);
|
242 |
+
|
243 |
+
if (is_array($result) && count($result) > 0) {
|
244 |
+
|
245 |
+
if (array_key_exists("Bank_Message", $result)) {
|
246 |
+
if ($result["Bank_Message"] != "Approved") {
|
247 |
+
$payment->setStatus(self::STATUS_ERROR);
|
248 |
+
Mage::throwException("Gateway error : {" . (string) $result["EXact_Message"] . "}");
|
249 |
+
} elseif ($result['Transaction_Error']) {
|
250 |
+
Mage::throwException("Returned Error Message: " . $result['Transaction_Error']);
|
251 |
+
}
|
252 |
+
/*
|
253 |
+
elseif($this->getConfigData('useccv') && $trxnResult->CVV2 != "M" ){
|
254 |
+
Mage::throwException("Invalid Card Verification Number(".$trxnResult->CVV2.")");
|
255 |
+
} */ else {
|
256 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
257 |
+
$payment->setLastTransId((string) $result["Authorization_Num"]);
|
258 |
+
$payment->setTransactionTag((string) $result["Transaction_Tag"]);
|
259 |
+
if (!$payment->getParentTransactionId() || (string) $result["Authorization_Num"] != $payment->getParentTransactionId()) {
|
260 |
+
$payment->setTransactionId((string) $result["Authorization_Num"]);
|
261 |
+
}
|
262 |
+
return $this;
|
263 |
+
}
|
264 |
+
} else {
|
265 |
+
Mage::throwException("No approval found");
|
266 |
+
}
|
267 |
+
} else {
|
268 |
+
Mage::throwException("No response found");
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
public function authorizePayment(Varien_Object $payment, $amount)
|
273 |
+
{
|
274 |
+
$payment->setAmount($amount);
|
275 |
+
$data = $this->_prepareData();
|
276 |
+
$data['trans_type'] = "32";
|
277 |
+
$data['transaction_tag'] = $payment->getTransactionTag();
|
278 |
+
|
279 |
+
#$data['authorization_num'] = $payment->getLastTransId();
|
280 |
+
$data['authorization_num'] = $payment->getParentTransactionId();
|
281 |
+
|
282 |
+
$data['chargetotal'] = $amount;
|
283 |
+
|
284 |
+
$result = $this->_postRequest($data);
|
285 |
+
|
286 |
+
if (is_array($result) && count($result) > 0) {
|
287 |
+
|
288 |
+
if (array_key_exists("Bank_Message", $result)) {
|
289 |
+
if ($result["Bank_Message"] != "Approved") {
|
290 |
+
$payment->setStatus(self::STATUS_ERROR);
|
291 |
+
Mage::throwException("Gateway error : {" . (string) $result["EXact_Message"] . "}");
|
292 |
+
} elseif ($result['Transaction_Error']) {
|
293 |
+
Mage::throwException("Returned Error Message: " . $result['Transaction_Error']);
|
294 |
+
}
|
295 |
+
/*
|
296 |
+
elseif($this->getConfigData('useccv') && $trxnResult->CVV2 != "M" ){
|
297 |
+
Mage::throwException("Invalid Card Verification Number(".$trxnResult->CVV2.")");
|
298 |
+
} */ else {
|
299 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
300 |
+
$payment->setLastTransId((string) $result["Authorization_Num"]);
|
301 |
+
$payment->setTransactionTag((string) $result["Transaction_Tag"]);
|
302 |
+
if (!$payment->getParentTransactionId() || (string) $result["Authorization_Num"] != $payment->getParentTransactionId()) {
|
303 |
+
$payment->setTransactionId((string) $result["Authorization_Num"]);
|
304 |
+
}
|
305 |
+
return $this;
|
306 |
+
}
|
307 |
+
} else {
|
308 |
+
Mage::throwException("No approval found");
|
309 |
+
}
|
310 |
+
} else {
|
311 |
+
Mage::throwException("No response found");
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
|
|
|
|
|
|
|
|
|
|
316 |
* refund the amount with transaction id
|
317 |
*
|
318 |
* @param string $payment Varien_Object object
|
319 |
* @return Mage_Paygate_Model_Authorizenet
|
320 |
* @throws Mage_Core_Exception
|
321 |
*/
|
322 |
+
public function refund(Varien_Object $payment, $amount)
|
323 |
+
{
|
324 |
+
if ($payment->getRefundTransactionId() && $amount > 0) {
|
325 |
$data = $this->_prepareData();
|
326 |
+
$data["trans_type"] = '34';
|
327 |
+
$data["oid"] = $payment->getRefundTransactionId();
|
328 |
+
$data['transaction_tag'] = $payment->getTransactionTag();
|
329 |
+
$data['authorization_num'] = $payment->getParentTransactionId();
|
330 |
+
|
331 |
+
$instance = $payment->getMethodInstance()->getInfoInstance();
|
332 |
+
$paymentdetails = array();
|
333 |
+
$paymentdetails['chargetotal'] = $amount;
|
334 |
+
$paymentdetails['cardnumber'] = $instance->getCcNumber();
|
335 |
+
$paymentdetails['ccname'] = $instance->getCcOwner();
|
336 |
+
$paymentdetails['cardexpmonth'] = $instance->getCcExpMonth();
|
337 |
+
$paymentdetails['cardexpyear'] = substr($instance->getCcExpYear(), -2);
|
338 |
+
$shipping = array();
|
339 |
+
$billing = array();
|
340 |
+
|
341 |
+
$data = array_merge($data, $paymentdetails);
|
342 |
+
$result = $this->_postRequest($data);
|
343 |
+
if (is_array($result) && count($result) > 0) {
|
344 |
+
if (array_key_exists("Bank_Message", $result)) {
|
345 |
+
if ($result["Bank_Message"] != "Approved") {
|
346 |
+
Mage::throwException("Gateway error : {" . (string) $result["EXact_Message"] . "}");
|
347 |
+
} else {
|
348 |
+
$payment->setStatus(self::STATUS_SUCCESS);
|
349 |
+
$payment->setLastTransId((string) $result["Authorization_Num"]);
|
350 |
+
if (!$payment->getParentTransactionId() || (string) $result["Authorization_Num"] != $payment->getParentTransactionId()) {
|
351 |
+
$payment->setTransactionId((string) $result["Authorization_Num"]);
|
352 |
+
}
|
353 |
+
return $this;
|
354 |
+
}
|
355 |
+
} else {
|
356 |
+
Mage::throwException("No approval found");
|
357 |
+
}
|
358 |
+
} else {
|
359 |
+
Mage::throwException("No response found");
|
360 |
+
}
|
|
|
361 |
}
|
362 |
Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment.'));
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
* Void the payment through gateway
|
367 |
*
|
368 |
* @param Varien_Object $payment
|
370 |
* @throws Mage_Core_Exception
|
371 |
*/
|
372 |
public function void(Varien_Object $payment)
|
373 |
+
{
|
374 |
+
if ($payment->getParentTransactionId()) {
|
375 |
+
$data = $this->_prepareData();
|
376 |
+
$data["trans_type"] = '33';
|
377 |
+
$data["oid"] = $payment->getParentTransactionId();
|
378 |
+
$data['transaction_tag'] = $payment->getTransactionTag();
|
379 |
+
$data['authorization_num'] = $payment->getParentTransactionId();
|
380 |
+
$instance = $payment->getMethodInstance()->getInfoInstance();
|
381 |
+
$paymentdetails = array();
|
382 |
+
$paymentdetails['cardnumber'] = $instance->getCcNumber();
|
383 |
+
$data['ccname'] = $instance->getCcOwner();
|
384 |
+
$paymentdetails['cardexpmonth'] = $instance->getCcExpMonth();
|
385 |
+
$paymentdetails['cardexpyear'] = substr($instance->getCcExpYear(), -2);
|
386 |
+
$order = $payment->getOrder();
|
387 |
+
$data['chargetotal'] = $order->getGrandTotal();
|
388 |
+
$data = array_merge($data, $paymentdetails);
|
389 |
+
$result = $this->_postRequest($data);
|
390 |
+
if (is_array($result) && count($result) > 0) {
|
391 |
+
if (array_key_exists("Bank_Message", $result)) {
|
392 |
+
if ($result["Bank_Message"] != "Approved") {
|
393 |
+
Mage::throwException("Gateway error : {" . (string) $result["EXact_Message"] . "}");
|
394 |
+
} else {
|
395 |
+
$payment->setStatus(self::STATUS_SUCCESS);
|
396 |
+
return $this;
|
397 |
+
}
|
398 |
+
} else {
|
399 |
+
Mage::throwException("No approval found");
|
400 |
+
}
|
401 |
+
} else {
|
402 |
+
Mage::throwException("No response found");
|
403 |
+
}
|
404 |
}
|
405 |
$payment->setStatus(self::STATUS_ERROR);
|
406 |
Mage::throwException('Invalid transaction ID.');
|
407 |
}
|
408 |
+
|
409 |
+
/**
|
410 |
* Cancel payment
|
411 |
*
|
412 |
* @param Varien_Object $invoicePayment
|
413 |
* @return Mage_Payment_Model_Abstract
|
414 |
*/
|
415 |
+
public function cancel(Varien_Object $payment)
|
416 |
+
{
|
417 |
return $this->void($payment);
|
418 |
}
|
419 |
+
|
420 |
+
/**
|
421 |
* converts a hash of name-value pairs
|
422 |
* to the correct array for new API
|
423 |
+
* change on 19-feb-15
|
424 |
+
*
|
425 |
* @param Array $pdata
|
426 |
* @return String $xml
|
427 |
*/
|
428 |
+
protected function _buildRequest($req)
|
429 |
+
{
|
430 |
+
|
431 |
+
$request = array(
|
432 |
+
"User_Name" => "",
|
433 |
+
"Secure_AuthResult" => "",
|
434 |
+
"Ecommerce_Flag" => "",
|
435 |
+
"XID" => isset($req["oid"]) ? $req["oid"] : false,
|
436 |
+
"ExactID" => $req["gatewayId"],
|
437 |
+
"CAVV" => "",
|
438 |
+
"Password" => $req["gatewayPass"],
|
439 |
+
"CAVV_Algorithm" => "",
|
440 |
+
"Transaction_Type" => $req["trans_type"],
|
441 |
+
"Reference_No" => "",
|
442 |
+
"Customer_Ref" => "",
|
443 |
+
"Reference_3" => "",
|
444 |
+
"Client_IP" => isset($req["ip"]) ? $req["ip"] : false,
|
445 |
+
"Client_Email" => isset($req["email"]) ? $req["email"] : '',
|
446 |
+
"Language" => "en",
|
447 |
+
"Card_Number" => isset($req["cardnumber"]) ? $req["cardnumber"] : '',
|
448 |
+
"Expiry_Date" => isset($req['cardexpmonth']) ? sprintf("%02d", $req['cardexpmonth']) . $req['cardexpyear'] : '',
|
449 |
+
"CardHoldersName" => isset($req["ccname"]) ? $req["ccname"] : '',
|
450 |
+
"Track1" => "",
|
451 |
+
"Track2" => "",
|
452 |
+
"Authorization_Num" => isset($req["authorization_num"]) ? $req["authorization_num"] : false,
|
453 |
+
"Transaction_Tag" => isset($req["transaction_tag"]) ? $req["transaction_tag"] : false,
|
454 |
+
"DollarAmount" => $req["chargetotal"],
|
455 |
+
"VerificationStr1" => "",
|
456 |
+
"VerificationStr2" => isset($req["cvv2value"]) ? $req["cvv2value"] : '',
|
457 |
+
"CVD_Presence_Ind" => isset($req["cvv2indicator"]) ? $req["cvv2indicator"] : '',
|
458 |
+
"Secure_AuthRequired" => "",
|
459 |
+
"Currency" => "",
|
460 |
+
"PartialRedemption" => "",
|
461 |
+
"ZipCode" => isset($req["zip"]) ? $req["zip"] : '',
|
462 |
+
"Tax1Amount" => "",
|
463 |
+
"Tax1Number" => "",
|
464 |
+
"Tax2Amount" => "",
|
465 |
+
"Tax2Number" => "",
|
466 |
+
"SurchargeAmount" => "",
|
467 |
+
"PAN" => ""
|
468 |
+
);
|
469 |
+
|
470 |
+
return $request;
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
* converts the LSGS response xml string
|
475 |
* to a hash of name-value pairs
|
476 |
+
*
|
477 |
* @param String $xml
|
478 |
* @return Array $retarr
|
479 |
*/
|
480 |
+
protected function _readResponse($trxnResult)
|
481 |
+
{
|
482 |
+
foreach ($trxnResult as $key => $value) {
|
483 |
+
$value = nl2br($value);
|
484 |
+
$retarr[$key] = $value;
|
485 |
+
}
|
486 |
+
return $retarr;
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
* chnage from: process hash table or xml string table using cURL
|
491 |
+
* change to : process data using SoapClientHMAC for latest version of API
|
492 |
+
* change on 19-feb-15
|
493 |
+
*
|
494 |
* @param Array $data
|
495 |
* @return String $xml
|
496 |
*/
|
497 |
+
protected function _postRequest($data)
|
498 |
+
{
|
499 |
+
|
500 |
+
$debugData = array('request' => $data);
|
501 |
+
$trxnProperties = '';
|
502 |
+
$trxnProperties = $this->_buildRequest($data);
|
503 |
+
try {
|
504 |
+
$client = Mage::getModel('linkpoint/soapclienthmac', array("url" => $data["wsdlUrl"]));
|
505 |
+
$response = $client->SendAndCommit($trxnProperties);
|
506 |
+
} catch (Exception $e) {
|
507 |
+
$debugData['response'] = $e->getMessage();
|
508 |
+
$this->_debug($debugData);
|
509 |
+
Mage::throwException("Link point authorization failed");
|
510 |
+
}
|
511 |
+
|
512 |
+
if (!$response) {
|
513 |
+
$debugData['response'] = $response;
|
514 |
+
$this->_debug($debugData);
|
515 |
+
Mage::throwException(ucwords("error in $response"));
|
516 |
+
}
|
517 |
+
|
518 |
+
if (@$client->fault) {
|
519 |
+
Mage::throwException("FAULT: Code: {$client->faultcode} <BR /> String: {$client->faultstring} </B>");
|
520 |
+
$response["CTR"] = "There was an error while processing. No TRANSACTION DATA IN CTR!";
|
521 |
+
}
|
522 |
+
|
523 |
+
$result = $this->_readResponse($response);
|
524 |
+
$debugData['response'] = $result;
|
525 |
+
/* if($this->getConfigData('debug') == 1) {
|
526 |
+
$this->_debug($debugData);
|
527 |
+
} */
|
528 |
+
$this->_debug($debugData);
|
529 |
+
return $result;
|
530 |
+
}
|
531 |
+
|
532 |
+
protected function _prepareData()
|
533 |
+
{
|
534 |
+
$_coreHelper = Mage::helper('core');
|
535 |
+
|
536 |
+
$data = array(
|
537 |
+
'keyId' => $_coreHelper->decrypt($this->getConfigData('key_id')),
|
538 |
+
'hmacKey' => $_coreHelper->decrypt($this->getConfigData('hmac_key')),
|
539 |
+
'wsdlUrl' => $this->getConfigData('wsdl_url'),
|
540 |
+
'gatewayId' => $_coreHelper->decrypt($this->getConfigData('gateway_id')),
|
541 |
+
'gatewayPass' => $_coreHelper->decrypt($this->getConfigData('gateway_pass')),
|
542 |
+
);
|
543 |
+
|
544 |
+
if ($this->getConfigData('mode')) {
|
545 |
+
$data['wsdlUrl'] = "https://api.demo.globalgatewaye4.firstdata.com/transaction/wsdl";
|
546 |
+
}
|
547 |
+
|
548 |
+
if (empty($data['keyId']) || empty($data['hmacKey']) || empty($data['wsdlUrl']) || empty($data['gatewayId']) || empty($data['gatewayPass'])) {
|
549 |
+
Mage::throwException("Gateway Parameters Missing");
|
550 |
+
}
|
551 |
+
return $data;
|
552 |
+
}
|
553 |
+
|
554 |
+
protected function _addTransaction(Mage_Sales_Model_Order_Payment $payment, $transactionId, $transactionType, array $transactionDetails = array(), $message = false)
|
555 |
+
{
|
556 |
+
|
557 |
$payment->setTransactionId($transactionId);
|
558 |
$payment->resetTransactionAdditionalInfo();
|
559 |
foreach ($transactionDetails as $key => $value) {
|
560 |
$payment->setData($key, $value);
|
561 |
}
|
562 |
+
|
563 |
+
$transaction = $payment->addTransaction($transactionType, null, false, $message);
|
564 |
foreach ($transactionDetails as $key => $value) {
|
565 |
$payment->unsetData($key);
|
566 |
}
|
570 |
|
571 |
return $transaction;
|
572 |
}
|
573 |
+
|
574 |
}
|
575 |
|
576 |
?>
|
app/code/community/Raveinfosys/Linkpoint/Model/Observer.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* NOTICE OF LICENSE
|
4 |
*
|
@@ -16,18 +17,17 @@
|
|
16 |
*/
|
17 |
class Raveinfosys_Linkpoint_Model_Observer
|
18 |
{
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
}
|
31 |
-
}
|
32 |
}
|
|
|
33 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* NOTICE OF LICENSE
|
5 |
*
|
17 |
*/
|
18 |
class Raveinfosys_Linkpoint_Model_Observer
|
19 |
{
|
20 |
+
|
21 |
+
public function disableMethod(Varien_Event_Observer $observer)
|
22 |
+
{
|
23 |
+
$moduleName = "Raveinfosys_Linkpoint";
|
24 |
+
if ('linkpoint' == $observer->getMethodInstance()->getCode()) {
|
25 |
+
if (Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName)) {
|
26 |
+
$observer->getResult()->isAvailable = false;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
|
|
|
|
31 |
}
|
32 |
+
|
33 |
?>
|
app/code/community/Raveinfosys/Linkpoint/Model/Soapclienthmac.php
CHANGED
@@ -2,27 +2,29 @@
|
|
2 |
|
3 |
class Raveinfosys_Linkpoint_Model_Soapclienthmac extends SoapClient
|
4 |
{
|
5 |
-
public function __construct($wsdl, $options = NULL) {
|
6 |
-
global $context;
|
7 |
-
$context = stream_context_create();
|
8 |
-
$options['stream_context'] = $context;
|
9 |
-
return parent::SoapClient($wsdl['url'], $options);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
if (version_compare(PHP_VERSION, '5.3.11') == -1) {
|
20 |
-
ini_set("user_agent", "PHP-SOAP/" . PHP_VERSION . "\r\nAuthorization: GGE4_API " . $keyId . ":" . $authstr . "\r\nx-gge4-date: " . $hashtime . "\r\nx-gge4-content-sha1: " . sha1($request));
|
21 |
-
} else {
|
22 |
-
stream_context_set_option($context,array("http" => array("header" => "authorization: GGE4_API " . $keyId . ":" . $authstr . "\r\nx-gge4-date: " . $hashtime . "\r\nx-gge4-content-sha1: " . sha1($request))));
|
23 |
-
}
|
24 |
-
return parent::__doRequest($request, $location, $action, $version, $one_way);
|
25 |
-
}
|
26 |
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class Raveinfosys_Linkpoint_Model_Soapclienthmac extends SoapClient
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
public function __construct($wsdl, $options = NULL)
|
7 |
+
{
|
8 |
+
global $context;
|
9 |
+
$context = stream_context_create();
|
10 |
+
$options['stream_context'] = $context;
|
11 |
+
return parent::SoapClient($wsdl['url'], $options);
|
12 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
public function __doRequest($request, $location, $action, $version, $one_way = NULL)
|
15 |
+
{
|
16 |
+
global $context;
|
17 |
+
$hmacKey = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/linkpoint/hmac_key'));
|
18 |
+
$keyId = Mage::helper('core')->decrypt(Mage::getStoreConfig('payment/linkpoint/key_id'));
|
19 |
+
$hashtime = date("c");
|
20 |
+
$hashstr = "POST\ntext/xml; charset=utf-8\n" . sha1($request) . "\n" . $hashtime . "\n" . parse_url($location, PHP_URL_PATH);
|
21 |
+
$authstr = base64_encode(hash_hmac("sha1", $hashstr, $hmacKey, TRUE));
|
22 |
+
if (version_compare(PHP_VERSION, '5.3.11') == -1) {
|
23 |
+
ini_set("user_agent", "PHP-SOAP/" . PHP_VERSION . "\r\nAuthorization: GGE4_API " . $keyId . ":" . $authstr . "\r\nx-gge4-date: " . $hashtime . "\r\nx-gge4-content-sha1: " . sha1($request));
|
24 |
+
} else {
|
25 |
+
stream_context_set_option($context, array("http" => array("header" => "authorization: GGE4_API " . $keyId . ":" . $authstr . "\r\nx-gge4-date: " . $hashtime . "\r\nx-gge4-content-sha1: " . sha1($request))));
|
26 |
+
}
|
27 |
+
return parent::__doRequest($request, $location, $action, $version, $one_way);
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/community/Raveinfosys/Linkpoint/etc/config.xml
CHANGED
@@ -57,7 +57,7 @@
|
|
57 |
<payment>
|
58 |
<linkpoint>
|
59 |
<active>0</active>
|
60 |
-
<title>Credit Card (
|
61 |
<order_status>pending</order_status>
|
62 |
<cctypes>AE,VI,MC</cctypes>
|
63 |
<useccv>1</useccv>
|
57 |
<payment>
|
58 |
<linkpoint>
|
59 |
<active>0</active>
|
60 |
+
<title>Credit Card (First Data)</title>
|
61 |
<order_status>pending</order_status>
|
62 |
<cctypes>AE,VI,MC</cctypes>
|
63 |
<useccv>1</useccv>
|
app/code/community/Raveinfosys/Linkpoint/etc/system.xml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
<payment>
|
22 |
<groups>
|
23 |
<linkpoint translate="label">
|
24 |
-
<label>
|
25 |
<frontend_type>text</frontend_type>
|
26 |
<show_in_default>1</show_in_default>
|
27 |
<show_in_website>1</show_in_website>
|
21 |
<payment>
|
22 |
<groups>
|
23 |
<linkpoint translate="label">
|
24 |
+
<label>First Data Global Gateway</label>
|
25 |
<frontend_type>text</frontend_type>
|
26 |
<show_in_default>1</show_in_default>
|
27 |
<show_in_website>1</show_in_website>
|
app/code/community/Raveinfosys/Linkpoint/sql/linkpoint_setup/mysql4-install-1.0.0.php
CHANGED
@@ -7,4 +7,4 @@ $installer->startSetup();
|
|
7 |
|
8 |
$connection->addColumn($this->getTable('sales/order_payment'), 'transaction_tag', 'text null');
|
9 |
|
10 |
-
$installer->endSetup();
|
7 |
|
8 |
$connection->addColumn($this->getTable('sales/order_payment'), 'transaction_tag', 'text null');
|
9 |
|
10 |
+
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,21 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>First_Data_Gateway_Integration</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>This extension allows you to make payments using FirstData Global Gateway for all your online shopping needs
|
10 |
<description>To facilitate the payment options, this extension provides seamless integration with First Data Global Gateway. This extension allows you to make secure payments using FirstData Global Gateway for all your online shopping needs. It supports all credit cards such as Visa, MasterCard, AE, JCB etc.&#xD;
|
11 |
-
&#xD;
|
12 |
-
The customer is not required to leave the Magento store for making the payment. FDGG does support multiple currencies however you need to check FDGG website for latest updates.</description>
|
13 |
-
<notes>This version is properly tested on the following Magento CE versions: 1.5, 1.6, 1.7,1.8,1.9.*
|
14 |
-
This version also supports for PHP V5.6.12</notes>
|
15 |
<authors><author><name>Rave Infosys</name><user>raveinfo</user><email>magento@raveinfosys.com</email></author></authors>
|
16 |
-
<date>
|
17 |
-
<time>
|
18 |
-
<contents><target name="magecommunity"><dir name="Raveinfosys"><dir name="Linkpoint"><dir name="Model"><file name="Linkpoint.php" hash="
|
19 |
<compatible/>
|
20 |
-
<dependencies><required><php><min>5.2.0</min><max>5.6.
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>First_Data_Gateway_Integration</name>
|
4 |
+
<version>1.0.7</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>This extension allows you to make payments using FirstData Global Gateway for all your online shopping needs.</summary>
|
10 |
<description>To facilitate the payment options, this extension provides seamless integration with First Data Global Gateway. This extension allows you to make secure payments using FirstData Global Gateway for all your online shopping needs. It supports all credit cards such as Visa, MasterCard, AE, JCB etc.&#xD;
|
11 |
+
&#xD;
|
12 |
+
The customer is not required to leave the Magento store for making the payment. FDGG does support multiple currencies however you need to check FDGG website for latest updates.</description>
|
13 |
+
<notes>This version is properly tested on the following Magento CE versions: 1.5, 1.6, 1.7,1.8,1.9.* . In this particular version we are supporting it to run on PHP V 5.5.X.</notes>
|
|
|
14 |
<authors><author><name>Rave Infosys</name><user>raveinfo</user><email>magento@raveinfosys.com</email></author></authors>
|
15 |
+
<date>2016-04-07</date>
|
16 |
+
<time>09:32:22</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Raveinfosys"><dir name="Linkpoint"><dir name="Model"><file name="Linkpoint.php" hash="4c781b3cb9181a3e4fc4f57c923a9015"/><file name="Observer.php" hash="0a38baf1cb0af1ce54aeecd9b59d4efe"/><file name="Soapclienthmac.php" hash="00b202168782c8137fc535b94f8c1f05"/></dir><dir name="etc"><file name="config.xml" hash="e086274f91e8feccffef407a793b2a6d"/><file name="system.xml" hash="92a7b9885924ef7362399bdce807292b"/></dir><dir name="sql"><dir name="linkpoint_setup"><file name="mysql4-install-1.0.0.php" hash="e481582777149881c86863145d541707"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Raveinfosys_Linkpoint.xml" hash="87645041b22e2b0adf581b54991c6ee1"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.20</max></php><extension><name>curl</name><min>7.21.4</min><max>7.44.0</max></extension></required></dependencies>
|
20 |
</package>
|