Version Notes
3D Secure transactions redirected to an outer ACS page rather than using iframe. System log file contains transaction specific result details.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Iridiumcorp_Tpg |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.6
- app/code/local/Iridiumcorp/Sales/Model/Order.php +32 -0
- app/code/local/Iridiumcorp/Sales/Model/Order/Invoice.php +24 -0
- app/code/local/Iridiumcorp/Sales/etc/config.xml +18 -0
- app/code/local/Iridiumcorp/Tpg/Model/Direct.php +48 -0
- app/code/local/Iridiumcorp/Tpg/controllers/PaymentController.php +61 -28
- app/code/local/Iridiumcorp/Tpg/etc/config.xml +0 -1
- app/code/local/Iridiumcorp/Tpg/etc/system.xml +1 -1
- app/etc/modules/Iridiumcorp_All.xml +4 -0
- package.xml +4 -4
app/code/local/Iridiumcorp/Sales/Model/Order.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Iridiumcorp_Sales_Model_Order extends Mage_Sales_Model_Order
|
4 |
+
{
|
5 |
+
protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
|
6 |
+
{
|
7 |
+
// comment out the below section to enable manual override of the status
|
8 |
+
/*
|
9 |
+
// attempt to set the specified state
|
10 |
+
if ($shouldProtectState) {
|
11 |
+
if ($this->isStateProtected($state)) {
|
12 |
+
Mage::throwException(Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state));
|
13 |
+
}
|
14 |
+
}
|
15 |
+
*/
|
16 |
+
$this->setData('state', $state);
|
17 |
+
|
18 |
+
// add status history
|
19 |
+
if ($status)
|
20 |
+
{
|
21 |
+
if ($status === true)
|
22 |
+
{
|
23 |
+
$status = $this->getConfig()->getStateDefaultStatus($state);
|
24 |
+
}
|
25 |
+
|
26 |
+
$this->setStatus($status);
|
27 |
+
$history = $this->addStatusHistoryComment($comment, false); // no sense to set $status again
|
28 |
+
$history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility
|
29 |
+
}
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Iridiumcorp/Sales/Model/Order/Invoice.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Iridiumcorp_Sales_Model_Order_Invoice extends Mage_Sales_Model_Order_Invoice
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Capture invoice
|
7 |
+
*
|
8 |
+
* @return Mage_Sales_Model_Order_Invoice
|
9 |
+
*/
|
10 |
+
public function capture()
|
11 |
+
{
|
12 |
+
$this->getOrder()->getPayment()->capture($this);
|
13 |
+
|
14 |
+
// decide whether to pay the invoice
|
15 |
+
if($GLOBALS['m_boPayInvoice'])
|
16 |
+
{
|
17 |
+
if ($this->getIsPaid())
|
18 |
+
{
|
19 |
+
$this->pay();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Iridiumcorp/Sales/etc/config.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Iridiumcorp_Sales>
|
5 |
+
<version>0.0.1</version>
|
6 |
+
</Iridiumcorp_Sales>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<sales>
|
11 |
+
<rewrite>
|
12 |
+
<order>Iridiumcorp_Sales_Model_Order</order>
|
13 |
+
<order_invoice>Iridiumcorp_Sales_Model_Order_Invoice</order_invoice>
|
14 |
+
</rewrite>
|
15 |
+
</sales>
|
16 |
+
</models>
|
17 |
+
</global>
|
18 |
+
</config>
|
app/code/local/Iridiumcorp/Tpg/Model/Direct.php
CHANGED
@@ -8,6 +8,7 @@ include ("Tpg/ISOCountries.php");
|
|
8 |
// GLOBAL 3D Secure authorization result variables:
|
9 |
$m_sz3DSecureMessage;
|
10 |
$m_bo3DSecureError;
|
|
|
11 |
|
12 |
class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
13 |
{
|
@@ -144,6 +145,9 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
144 |
*/
|
145 |
public function _runTransaction(Varien_Object $payment, $amount)
|
146 |
{
|
|
|
|
|
|
|
147 |
$MerchantID = $this->getConfigData('merchantid');
|
148 |
$Password = $this->getConfigData('password');
|
149 |
$SecretKey = $this->getConfigData('secretkey');
|
@@ -284,6 +288,11 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
284 |
case 0:
|
285 |
// status code of 0 - means transaction successful
|
286 |
$boError = false;
|
|
|
|
|
|
|
|
|
|
|
287 |
$szLogMessage = "Transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
|
288 |
Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
|
289 |
break;
|
@@ -291,6 +300,8 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
291 |
// status code of 3 - means 3D Secure authentication required
|
292 |
$boError = false;
|
293 |
$szLogMessage = "3D Secure Authentication required for OrderID: ".$szOrderID.". Result object details: ";
|
|
|
|
|
294 |
|
295 |
$szPaReq = $todTransactionOutputData->getThreeDSecureOutputData()->getPaREQ();
|
296 |
$szCrossReference = $todTransactionOutputData->getCrossReference();
|
@@ -355,6 +366,9 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
355 |
*/
|
356 |
public function _redirectTransaction(Varien_Object $payment, $amount)
|
357 |
{
|
|
|
|
|
|
|
358 |
$szMerchantID = $this->getConfigData('merchantid');
|
359 |
$szPassword = $this->getConfigData('password');
|
360 |
$szCallbackURL = Mage::getUrl('tpg/payment/callbackhostedpayment');
|
@@ -479,6 +493,9 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
479 |
*/
|
480 |
public function _transparentRedirectTransaction(Varien_Object $payment, $amount)
|
481 |
{
|
|
|
|
|
|
|
482 |
$szMerchantID = $this->getConfigData('merchantid');
|
483 |
$szPassword = $this->getConfigData('password');
|
484 |
$szPreSharedKey = $this->getConfigData('presharedkey');
|
@@ -575,7 +592,10 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
575 |
*/
|
576 |
public function _run3DSecureTransaction($szPaRes, $szMD)
|
577 |
{
|
|
|
578 |
$szOrderID = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
|
|
|
|
579 |
|
580 |
$MerchantID = $this->getConfigData('merchantid');
|
581 |
$Password = $this->getConfigData('password');
|
@@ -615,6 +635,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
615 |
// status code of 0 - means transaction successful
|
616 |
$GLOBALS['m_bo3DSecureError'] = false;
|
617 |
$szLogMessage = "3D Secure transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
|
|
|
618 |
break;
|
619 |
case 5:
|
620 |
// status code of 5 - means transaction declined
|
@@ -652,6 +673,8 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
652 |
// log 3DS payment result
|
653 |
$szLogMessage = $szLogMessage.print_r($tdsarThreeDSecureAuthenticationResult, 1);
|
654 |
Mage::log($szLogMessage);
|
|
|
|
|
655 |
}
|
656 |
}
|
657 |
|
@@ -751,4 +774,29 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
|
751 |
|
752 |
return $szISO3Code;
|
753 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
754 |
}
|
8 |
// GLOBAL 3D Secure authorization result variables:
|
9 |
$m_sz3DSecureMessage;
|
10 |
$m_bo3DSecureError;
|
11 |
+
$m_boPayInvoice;
|
12 |
|
13 |
class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
|
14 |
{
|
145 |
*/
|
146 |
public function _runTransaction(Varien_Object $payment, $amount)
|
147 |
{
|
148 |
+
$GLOBALS['m_boPayInvoice'] = false;
|
149 |
+
$payment->setIsTransactionPending(true);
|
150 |
+
|
151 |
$MerchantID = $this->getConfigData('merchantid');
|
152 |
$Password = $this->getConfigData('password');
|
153 |
$SecretKey = $this->getConfigData('secretkey');
|
288 |
case 0:
|
289 |
// status code of 0 - means transaction successful
|
290 |
$boError = false;
|
291 |
+
$GLOBALS['m_boPayInvoice'] = true;
|
292 |
+
$payment->setIsTransactionPending(false);
|
293 |
+
|
294 |
+
$this->updateOrderState($order, 'processing', $szNotificationMessage);
|
295 |
+
|
296 |
$szLogMessage = "Transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
|
297 |
Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
|
298 |
break;
|
300 |
// status code of 3 - means 3D Secure authentication required
|
301 |
$boError = false;
|
302 |
$szLogMessage = "3D Secure Authentication required for OrderID: ".$szOrderID.". Result object details: ";
|
303 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, '3D Secure authentication required');
|
304 |
+
$GLOBALS['m_boPayInvoice'] = false;
|
305 |
|
306 |
$szPaReq = $todTransactionOutputData->getThreeDSecureOutputData()->getPaREQ();
|
307 |
$szCrossReference = $todTransactionOutputData->getCrossReference();
|
366 |
*/
|
367 |
public function _redirectTransaction(Varien_Object $payment, $amount)
|
368 |
{
|
369 |
+
$GLOBALS['m_boPayInvoice'] = false;
|
370 |
+
$payment->setIsTransactionPending(true);
|
371 |
+
|
372 |
$szMerchantID = $this->getConfigData('merchantid');
|
373 |
$szPassword = $this->getConfigData('password');
|
374 |
$szCallbackURL = Mage::getUrl('tpg/payment/callbackhostedpayment');
|
493 |
*/
|
494 |
public function _transparentRedirectTransaction(Varien_Object $payment, $amount)
|
495 |
{
|
496 |
+
$GLOBALS['m_boPayInvoice'] = false;
|
497 |
+
$payment->setIsTransactionPending(true);
|
498 |
+
|
499 |
$szMerchantID = $this->getConfigData('merchantid');
|
500 |
$szPassword = $this->getConfigData('password');
|
501 |
$szPreSharedKey = $this->getConfigData('presharedkey');
|
592 |
*/
|
593 |
public function _run3DSecureTransaction($szPaRes, $szMD)
|
594 |
{
|
595 |
+
$szStatus = 'canceled';
|
596 |
$szOrderID = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
597 |
+
$order = Mage::getModel('sales/order');
|
598 |
+
$order->loadByIncrementId($szOrderID);
|
599 |
|
600 |
$MerchantID = $this->getConfigData('merchantid');
|
601 |
$Password = $this->getConfigData('password');
|
635 |
// status code of 0 - means transaction successful
|
636 |
$GLOBALS['m_bo3DSecureError'] = false;
|
637 |
$szLogMessage = "3D Secure transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
|
638 |
+
$szStatus = 'processing';
|
639 |
break;
|
640 |
case 5:
|
641 |
// status code of 5 - means transaction declined
|
673 |
// log 3DS payment result
|
674 |
$szLogMessage = $szLogMessage.print_r($tdsarThreeDSecureAuthenticationResult, 1);
|
675 |
Mage::log($szLogMessage);
|
676 |
+
|
677 |
+
$this->updateOrderState($order, $szStatus, $GLOBALS['m_sz3DSecureMessage']);
|
678 |
}
|
679 |
}
|
680 |
|
774 |
|
775 |
return $szISO3Code;
|
776 |
}
|
777 |
+
|
778 |
+
public function updateOrderState($order, $szStatus, $szMessage)
|
779 |
+
{
|
780 |
+
if($order)
|
781 |
+
{
|
782 |
+
if($szStatus == 'processing')
|
783 |
+
{
|
784 |
+
$order->addStatusToHistory($szStatus, $szMessage, false);
|
785 |
+
//$order->sendNewOrderEmail();
|
786 |
+
//$order->setEmailSent(true);
|
787 |
+
$order->save();
|
788 |
+
}
|
789 |
+
else if($szStatus == 'canceled')
|
790 |
+
{
|
791 |
+
$order->addStatusToHistory($szStatus, $szMessage, false);
|
792 |
+
$order->cancel();
|
793 |
+
$order->save();
|
794 |
+
}
|
795 |
+
else
|
796 |
+
{
|
797 |
+
$order->addStatusToHistory($szStatus, $szMessage, false);
|
798 |
+
$order->save();
|
799 |
+
}
|
800 |
+
}
|
801 |
+
}
|
802 |
}
|
app/code/local/Iridiumcorp/Tpg/controllers/PaymentController.php
CHANGED
@@ -140,9 +140,13 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
140 |
*/
|
141 |
public function callbackhostedpaymentAction()
|
142 |
{
|
143 |
-
$
|
144 |
$formVariables = array();
|
145 |
$model = Mage::getModel('tpg/direct');
|
|
|
|
|
|
|
|
|
146 |
|
147 |
try
|
148 |
{
|
@@ -175,56 +179,68 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
175 |
|
176 |
if(!IRC_PaymentFormHelper::compareHostedPaymentFormHashDigest($formVariables, $szPassword, $hmHashMethod, $szPreSharedKey))
|
177 |
{
|
178 |
-
$
|
|
|
179 |
Mage::log("The Hosted Payment Form transaction couldn't be completed for the following reason: ".$error. " Form variables: ".$formVariables);
|
180 |
}
|
181 |
}
|
182 |
catch (Exception $exc)
|
183 |
{
|
184 |
-
$
|
|
|
185 |
Mage::logException($exc);
|
186 |
Mage::log($error." Order ID: ".$formVariables['OrderID'].". Exception details: ".$exc);
|
187 |
}
|
188 |
|
189 |
// check the incoming hash digest
|
190 |
-
if($
|
191 |
{
|
192 |
-
|
193 |
-
$this->_redirect('checkout/onepage/failure');
|
194 |
}
|
195 |
else
|
196 |
{
|
|
|
197 |
switch ($formVariables['StatusCode'])
|
198 |
{
|
199 |
case "0":
|
200 |
// TODO : maybe to update the order processing status in the Magento backend
|
201 |
Mage::log("Hosted Payment Form transaction successfully completed. Transaction details: ".print_r($formVariables, 1));
|
202 |
-
|
203 |
-
$
|
204 |
break;
|
205 |
case "20":
|
206 |
Mage::log("Duplicate Hosted Payment Form transaction. Transaction details: ".print_r($formVariables, 1));
|
207 |
$szNotificationMessage = "Payment Processor Response: ".$szMessage.". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction - Previous Transaction Response: ".$formVariables['PreviousMessage'];
|
208 |
if($formVariables['PreviousStatusCode'] == "0")
|
209 |
{
|
210 |
-
|
211 |
-
$this->_redirect('checkout/onepage/success');
|
212 |
}
|
213 |
else
|
214 |
{
|
215 |
-
|
216 |
-
$this->_redirect('checkout/onepage/failure');
|
217 |
}
|
218 |
break;
|
219 |
case "5":
|
220 |
case "30":
|
221 |
default:
|
222 |
Mage::log("Hosted Payment Form transaction couldn't be completed. Transaction details: ".print_r($formVariables, 1));
|
223 |
-
|
224 |
-
$this->_redirect('checkout/onepage/failure');
|
225 |
break;
|
226 |
}
|
227 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
}
|
229 |
|
230 |
public function callbacktransparentredirectAction()
|
@@ -335,8 +351,13 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
335 |
|
336 |
private function _paymentComplete($szPassword, $hmHashMethod, $szPreSharedKey)
|
337 |
{
|
338 |
-
$
|
339 |
$formVariables = array();
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
$formVariables['HashDigest'] = $this->getRequest()->getPost('HashDigest');
|
342 |
$formVariables['MerchantID'] = $this->getRequest()->getPost('MerchantID');
|
@@ -362,47 +383,59 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
|
|
362 |
|
363 |
if(!IRC_PaymentFormHelper::comparePaymentCompleteHashDigest($formVariables, $szPassword, $hmHashMethod, $szPreSharedKey))
|
364 |
{
|
365 |
-
$
|
|
|
366 |
Mage::log("The Transparent Redirect transaction couldn't be completed for the following reason: ".$error." Form variables: ".print_r($formVariables, 1));
|
367 |
}
|
368 |
|
369 |
-
if($
|
370 |
{
|
371 |
-
|
372 |
-
$this->_redirect('checkout/onepage/failure');
|
373 |
}
|
374 |
else
|
375 |
{
|
|
|
|
|
376 |
switch ($formVariables['StatusCode'])
|
377 |
{
|
378 |
case "0":
|
379 |
-
// TODO : maybe to update the order processing status in the Magento backend
|
380 |
Mage::log("Transparent Redirect transaction successfully completed. Transaction details: ".print_r($formVariables, 1));
|
381 |
-
|
382 |
-
$
|
383 |
break;
|
384 |
case "20":
|
385 |
Mage::log("Duplicate Transparent Redirect transaction. Transaction details: ".print_r($formVariables, 1));
|
386 |
$szNotificationMessage = "Payment Processor Response: ".$formVariables['Message'].". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction - Previous Transaction Response: ".$formVariables['PreviousMessage'];
|
387 |
if($formVariables['PreviousStatusCode'] == "0")
|
388 |
{
|
389 |
-
|
390 |
-
$
|
391 |
}
|
392 |
else
|
393 |
{
|
394 |
-
|
395 |
-
$this->_redirect('checkout/onepage/failure');
|
396 |
}
|
397 |
break;
|
398 |
case "5":
|
399 |
case "30":
|
400 |
default:
|
401 |
Mage::log("Transparent Redirect transaction couldn't be completed. Transaction details: ".print_r($formVariables, 1));
|
402 |
-
|
403 |
-
$this->_redirect('checkout/onepage/failure');
|
404 |
break;
|
405 |
}
|
406 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
}
|
408 |
}
|
140 |
*/
|
141 |
public function callbackhostedpaymentAction()
|
142 |
{
|
143 |
+
$boError = false;
|
144 |
$formVariables = array();
|
145 |
$model = Mage::getModel('tpg/direct');
|
146 |
+
$szOrderID = $this->getRequest()->getPost('OrderID');
|
147 |
+
$order = Mage::getModel('sales/order');
|
148 |
+
$order->loadByIncrementId($szOrderID);
|
149 |
+
$szStatus = 'canceled';
|
150 |
|
151 |
try
|
152 |
{
|
179 |
|
180 |
if(!IRC_PaymentFormHelper::compareHostedPaymentFormHashDigest($formVariables, $szPassword, $hmHashMethod, $szPreSharedKey))
|
181 |
{
|
182 |
+
$boError = true;
|
183 |
+
$szNotificationMessage = "The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
|
184 |
Mage::log("The Hosted Payment Form transaction couldn't be completed for the following reason: ".$error. " Form variables: ".$formVariables);
|
185 |
}
|
186 |
}
|
187 |
catch (Exception $exc)
|
188 |
{
|
189 |
+
$boError = true;
|
190 |
+
$szNotificationMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_183;
|
191 |
Mage::logException($exc);
|
192 |
Mage::log($error." Order ID: ".$formVariables['OrderID'].". Exception details: ".$exc);
|
193 |
}
|
194 |
|
195 |
// check the incoming hash digest
|
196 |
+
if($boError)
|
197 |
{
|
198 |
+
// do nothing
|
|
|
199 |
}
|
200 |
else
|
201 |
{
|
202 |
+
$szNotificationMessage = "Payment Processor Response: ".$formVariables['Message'];
|
203 |
switch ($formVariables['StatusCode'])
|
204 |
{
|
205 |
case "0":
|
206 |
// TODO : maybe to update the order processing status in the Magento backend
|
207 |
Mage::log("Hosted Payment Form transaction successfully completed. Transaction details: ".print_r($formVariables, 1));
|
208 |
+
$szStatus = 'processing';
|
209 |
+
$boError = false;
|
210 |
break;
|
211 |
case "20":
|
212 |
Mage::log("Duplicate Hosted Payment Form transaction. Transaction details: ".print_r($formVariables, 1));
|
213 |
$szNotificationMessage = "Payment Processor Response: ".$szMessage.". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction - Previous Transaction Response: ".$formVariables['PreviousMessage'];
|
214 |
if($formVariables['PreviousStatusCode'] == "0")
|
215 |
{
|
216 |
+
$boError = false;
|
|
|
217 |
}
|
218 |
else
|
219 |
{
|
220 |
+
$boError = true;
|
|
|
221 |
}
|
222 |
break;
|
223 |
case "5":
|
224 |
case "30":
|
225 |
default:
|
226 |
Mage::log("Hosted Payment Form transaction couldn't be completed. Transaction details: ".print_r($formVariables, 1));
|
227 |
+
$boError = true;
|
|
|
228 |
break;
|
229 |
}
|
230 |
}
|
231 |
+
|
232 |
+
$model->updateOrderState($order, $szStatus, $szNotificationMessage);
|
233 |
+
|
234 |
+
if($boError)
|
235 |
+
{
|
236 |
+
Mage::getSingleton('core/session')->addError($szNotificationMessage);
|
237 |
+
$this->_redirect('checkout/onepage/failure');
|
238 |
+
}
|
239 |
+
else
|
240 |
+
{
|
241 |
+
Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
|
242 |
+
$this->_redirect('checkout/onepage/success');
|
243 |
+
}
|
244 |
}
|
245 |
|
246 |
public function callbacktransparentredirectAction()
|
351 |
|
352 |
private function _paymentComplete($szPassword, $hmHashMethod, $szPreSharedKey)
|
353 |
{
|
354 |
+
$boError = false;
|
355 |
$formVariables = array();
|
356 |
+
$model = Mage::getModel('tpg/direct');
|
357 |
+
$szOrderID = $this->getRequest()->getPost('OrderID');
|
358 |
+
$order = Mage::getModel('sales/order');
|
359 |
+
$order->loadByIncrementId($szOrderID);
|
360 |
+
$szStatus = 'canceled';
|
361 |
|
362 |
$formVariables['HashDigest'] = $this->getRequest()->getPost('HashDigest');
|
363 |
$formVariables['MerchantID'] = $this->getRequest()->getPost('MerchantID');
|
383 |
|
384 |
if(!IRC_PaymentFormHelper::comparePaymentCompleteHashDigest($formVariables, $szPassword, $hmHashMethod, $szPreSharedKey))
|
385 |
{
|
386 |
+
$boError = true;
|
387 |
+
$szNotificationMessage = "The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
|
388 |
Mage::log("The Transparent Redirect transaction couldn't be completed for the following reason: ".$error." Form variables: ".print_r($formVariables, 1));
|
389 |
}
|
390 |
|
391 |
+
if($boError)
|
392 |
{
|
393 |
+
// do nothing
|
|
|
394 |
}
|
395 |
else
|
396 |
{
|
397 |
+
$szNotificationMessage = "Payment Processor Response: ".$formVariables['Message'];
|
398 |
+
|
399 |
switch ($formVariables['StatusCode'])
|
400 |
{
|
401 |
case "0":
|
|
|
402 |
Mage::log("Transparent Redirect transaction successfully completed. Transaction details: ".print_r($formVariables, 1));
|
403 |
+
$boError = false;
|
404 |
+
$szStatus = 'processing';
|
405 |
break;
|
406 |
case "20":
|
407 |
Mage::log("Duplicate Transparent Redirect transaction. Transaction details: ".print_r($formVariables, 1));
|
408 |
$szNotificationMessage = "Payment Processor Response: ".$formVariables['Message'].". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction - Previous Transaction Response: ".$formVariables['PreviousMessage'];
|
409 |
if($formVariables['PreviousStatusCode'] == "0")
|
410 |
{
|
411 |
+
$boError = false;
|
412 |
+
$szStatus = 'processing';
|
413 |
}
|
414 |
else
|
415 |
{
|
416 |
+
$boError = true;
|
|
|
417 |
}
|
418 |
break;
|
419 |
case "5":
|
420 |
case "30":
|
421 |
default:
|
422 |
Mage::log("Transparent Redirect transaction couldn't be completed. Transaction details: ".print_r($formVariables, 1));
|
423 |
+
$boError = true;
|
|
|
424 |
break;
|
425 |
}
|
426 |
}
|
427 |
+
|
428 |
+
$model->updateOrderState($order, $szStatus, $szNotificationMessage);
|
429 |
+
|
430 |
+
if($boError)
|
431 |
+
{
|
432 |
+
Mage::getSingleton('core/session')->addError($szNotificationMessage);
|
433 |
+
$this->_redirect('checkout/onepage/failure');
|
434 |
+
}
|
435 |
+
else
|
436 |
+
{
|
437 |
+
Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
|
438 |
+
$this->_redirect('checkout/onepage/success');
|
439 |
+
}
|
440 |
}
|
441 |
}
|
app/code/local/Iridiumcorp/Tpg/etc/config.xml
CHANGED
@@ -80,7 +80,6 @@
|
|
80 |
<tpg>
|
81 |
<active>1</active>
|
82 |
<model>tpg/direct</model>
|
83 |
-
<order_status>pending</order_status>
|
84 |
<title>Iridium Corporation</title>
|
85 |
<hashmethod>sha1</hashmethod>
|
86 |
<paymentprocessordomain>iridiumcorp.net</paymentprocessordomain>
|
80 |
<tpg>
|
81 |
<active>1</active>
|
82 |
<model>tpg/direct</model>
|
|
|
83 |
<title>Iridium Corporation</title>
|
84 |
<hashmethod>sha1</hashmethod>
|
85 |
<paymentprocessordomain>iridiumcorp.net</paymentprocessordomain>
|
app/code/local/Iridiumcorp/Tpg/etc/system.xml
CHANGED
@@ -47,7 +47,7 @@
|
|
47 |
<label>New order status</label>
|
48 |
<sort_order>40</sort_order>
|
49 |
<frontend_type>select</frontend_type>
|
50 |
-
<source_model>
|
51 |
<sort_order>50</sort_order>
|
52 |
<show_in_default>1</show_in_default>
|
53 |
<show_in_website>1</show_in_website>
|
47 |
<label>New order status</label>
|
48 |
<sort_order>40</sort_order>
|
49 |
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>tpg/source_orderStatus</source_model>
|
51 |
<sort_order>50</sort_order>
|
52 |
<show_in_default>1</show_in_default>
|
53 |
<show_in_website>1</show_in_website>
|
app/etc/modules/Iridiumcorp_All.xml
CHANGED
@@ -11,5 +11,9 @@
|
|
11 |
<active>true</active>
|
12 |
<codePool>local</codePool>
|
13 |
</Iridiumcorp_Checkout>
|
|
|
|
|
|
|
|
|
14 |
</modules>
|
15 |
</config>
|
11 |
<active>true</active>
|
12 |
<codePool>local</codePool>
|
13 |
</Iridiumcorp_Checkout>
|
14 |
+
<Iridiumcorp_Sales>
|
15 |
+
<active>true</active>
|
16 |
+
<codePool>local</codePool>
|
17 |
+
</Iridiumcorp_Sales>
|
18 |
</modules>
|
19 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Iridiumcorp_Tpg</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Magento payment extension for the Iridium payment gateway. This extension fully supports the processing of 3D secure (Verified By Visa and Mastercard SecureCode) transactions. It also supports all of the integration methods provided by Iridium.</description>
|
11 |
<notes>3D Secure transactions redirected to an outer ACS page rather than using iframe. System log file contains transaction specific result details.</notes>
|
12 |
<authors><author><name>Iridium Support</name><user>auto-converted</user><email>support@iridiumcorp.co.uk</email></author><author><name>Benjamin Kovac</name><user>auto-converted</user><email>ben.kovac@iridiumcorp.co.uk</email></author></authors>
|
13 |
-
<date>2010-06
|
14 |
-
<time>
|
15 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="9b2afd627d6e9e4f9ad43b0a7153962b"/><file name="info.phtml" hash="3164afadd87c4811b5f7d0879537f10e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="231e39bb2821718eeaec4c1d0ee3233d"/><file name="info.phtml" hash="7d72d07f3afa018d0402219e50573439"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iridiumcorp"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="14f3b6021a6ba4af74e2868746e8fc74"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="fd34804edc71d403ab5a132d835d1641"/></dir></dir></dir><dir name="Tpg"><dir name="Block"><file name="Error.php" hash="905367210beb53a0bc68dc6033e24127"/><file name="Form.php" hash="4b1d51aa84982486f3139510c41a221a"/><file name="Info.php" hash="f88445c4880bfe14914252bc76b6fc28"/><file name="Redirect.php" hash="121b7025034eff6316a0205b41ec2a0b"/><file name="Threedsecure.php" hash="43c2c7197a8b25eed6c2cf88d5ee0df4"/></dir><dir name="controllers"><file name="PaymentController.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Iridiumcorp_Tpg</name>
|
4 |
+
<version>1.6</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Magento payment extension for the Iridium payment gateway. This extension fully supports the processing of 3D secure (Verified By Visa and Mastercard SecureCode) transactions. It also supports all of the integration methods provided by Iridium.</description>
|
11 |
<notes>3D Secure transactions redirected to an outer ACS page rather than using iframe. System log file contains transaction specific result details.</notes>
|
12 |
<authors><author><name>Iridium Support</name><user>auto-converted</user><email>support@iridiumcorp.co.uk</email></author><author><name>Benjamin Kovac</name><user>auto-converted</user><email>ben.kovac@iridiumcorp.co.uk</email></author></authors>
|
13 |
+
<date>2010-07-06</date>
|
14 |
+
<time>17:18:56</time>
|
15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="9b2afd627d6e9e4f9ad43b0a7153962b"/><file name="info.phtml" hash="3164afadd87c4811b5f7d0879537f10e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="231e39bb2821718eeaec4c1d0ee3233d"/><file name="info.phtml" hash="7d72d07f3afa018d0402219e50573439"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iridiumcorp"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="14f3b6021a6ba4af74e2868746e8fc74"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="fd34804edc71d403ab5a132d835d1641"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="5def01c2198f4033cd647dc40fb8e297"/></dir><dir name="Model"><file name="Order.php" hash="dc17a304f7963aed4b469086c82bc478"/><dir name="Order"><file name="Invoice.php" hash="3bc77aa877a16a6d96474bb15f8f15ea"/></dir></dir></dir><dir name="Tpg"><dir name="Block"><file name="Error.php" hash="905367210beb53a0bc68dc6033e24127"/><file name="Form.php" hash="4b1d51aa84982486f3139510c41a221a"/><file name="Info.php" hash="f88445c4880bfe14914252bc76b6fc28"/><file name="Redirect.php" hash="121b7025034eff6316a0205b41ec2a0b"/><file name="Threedsecure.php" hash="43c2c7197a8b25eed6c2cf88d5ee0df4"/></dir><dir name="controllers"><file name="PaymentController.php" hash="1c684cffaf157db2488542910191e37d"/></dir><dir name="etc"><file name="config.xml" hash="2894d79c8fd69c96685c8d2d62c13aa4"/><file name="system.xml" hash="930cfa7d7f50fdcdaa777a7fa1a343f9"/></dir><dir name="Helper"><file name="Data.php" hash="a72fba87e718c94d993a57199e20ca96"/></dir><dir name="Model"><file name="Direct.php" hash="feac9c6b5f366bbe65ed0813add3899c"/><file name="Request.php" hash="a96e462ed3c1882048ea45f2c3a6662c"/><dir name="Source"><file name="HashMethod.php" hash="36d7fb4fc762feae459f0e67d51006f4"/><file name="PaymentAction.php" hash="bd8dc40852b9ff8c80c08fc01f35a988"/><file name="PaymentMode.php" hash="6849defade8a7da4cfaeff3227ae5b83"/><file name="ResultDeliveryMethod.php" hash="b79d6fc714a25aba26cdb0ab572ae06f"/></dir><dir name="Tpg"><file name="GlobalErrors.php" hash="06beaf8042e351b95259d0e8e4cb1142"/><file name="ISOCountries.php" hash="fc63d76fbe25458ba351f114782074cb"/><file name="ISOCurrencies.php" hash="89ac1e124e89c0713ef43a0cf6dd0e2b"/><file name="PaymentFormHelper.php" hash="f5c28f79cc818ff8693d4348e475bf36"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="4ad38bdb85f865e967153d9f253390cd"/><file name="SOAP.php" hash="504dcb0cb7c60c134b25652881349cc3"/><file name="TPG_Common.php" hash="df1033ef855c7e0e715076a105acb84a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iridiumcorp_All.xml" hash="f1a85eaa7631af1906f461b662519732"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|