Cardsave_Cardsaveonlinepayments - Version 1.14.0

Version Notes

Compilation issues resolved.
Status conflicts with other payment methods resolved.
"Start Date" removed from Direct/Transparent Redirect methods (no longer checked by issuing banks).
Revised error messages.
CardSave branding updated.
Reorganised module setup page.

Download this release

Release Info

Developer CardSave
Extension Cardsave_Cardsaveonlinepayments
Version 1.14.0
Comparing to
See all releases


Code changes from version 1.12.0 to 1.14.0

Files changed (22) hide show
  1. app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/GlobalErrors.php +5 -5
  2. app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ISOCountries.php +5 -1
  3. app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ISOCurrencies.php +5 -1
  4. app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/PaymentFormHelper.php +6 -2
  5. app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ThePaymentGateway/PaymentSystem.php +8 -2
  6. app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ThePaymentGateway/SOAP.php +6 -2
  7. app/code/local/Cardsave/Cardsaveonlinepayments/Model/Direct.php +38 -73
  8. app/code/local/Cardsave/Cardsaveonlinepayments/controllers/PaymentController.php +74 -165
  9. app/code/local/Cardsave/Cardsaveonlinepayments/etc/config.xml +1 -1
  10. app/code/local/Cardsave/Cardsaveonlinepayments/etc/system.xml +261 -243
  11. app/code/local/Cardsave/Checkout/Block/Onepage/Payment/Methods.php +3 -3
  12. app/code/local/Cardsave/Checkout/Model/Type/Onepage.php +106 -1096
  13. app/code/local/Cardsave/Sales/Model/Order.php +2 -2
  14. app/code/local/Cardsave/Sales/Model/Order/Payment.php +104 -535
  15. app/design/adminhtml/base/default/template/cardsaveonlinepayments/form.phtml +0 -21
  16. app/design/frontend/base/default/template/cardsaveonlinepayments/form.phtml +5 -5
  17. app/design/frontend/default/default/template/cardsaveonlinepayments/form.phtml +4 -25
  18. package.xml +17 -12
  19. skin/frontend/base/default/images/cardsave_online.jpg +0 -0
  20. skin/frontend/base/default/images/cardsave_online.png +0 -0
  21. skin/frontend/default/default/images/cardsave_online.jpg +0 -0
  22. skin/frontend/default/default/images/cardsave_online.png +0 -0
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/GlobalErrors.php CHANGED
@@ -7,19 +7,19 @@ class Cardsave_Cardsaveonlinepayments_Model_Common_GlobalErrors
7
  * error - payment gateway communication and hashing related issues
8
  */
9
  // failure - occurred in the processing of the final callback from the hosted payment form/transparent redirect
10
- const ERROR_183 = "The payment was not successful and checkout was cancelled.<br/>Please check your credit card details and try again.";
11
 
12
  // error - occurred during the partial processing of the callback from the transparent redirect page
13
  const ERROR_260 = "ERROR 260: The payment result couldn't be verified.";
14
 
15
  // error - direct integration transaction cannot be completed - problem in the communication with the payment gateway
16
- const ERROR_261 = "ERROR 261: Couldn't communicate with payment gateway.";
17
 
18
  // error - direct integration 3D Secure transaction couldn't be processed - problem in the communication with the paymwent gateway
19
- const ERROR_431 = "ERROR 431: Couldn't communicate with payment gateway to complete the 3D Secure authentication.";
20
 
21
  // failure - occurred during the processing of the data in the callback from the 3D Secure Authentication page
22
- const ERROR_7655 = "3D Secure payment was not successfull and checkout was cancelled.<br/>Please check your credit card details and try again.";
23
 
24
  // failure - server pull result related error: no URL variable present in the payment form to merchant webshop redirection
25
  const ERROR_309 ="ERROR 309: Missing parameters.";
@@ -28,7 +28,7 @@ class Cardsave_Cardsaveonlinepayments_Model_Common_GlobalErrors
28
  const ERROR_304 = "ERROR 304: The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
29
 
30
  // faulire - server pull result related error: Magento web request to the hosted PaymentFormHandler failed while trying to retrieve the transaction details using the CrossReference
31
- const ERROR_329 = "ERROR 329: Error happened while trying to validate the transaction result.";
32
 
33
  // failure - server pull result related error: empty response due to invalid CrossReference
34
  const ERROR_381 = "ERROR 381: Invalid transaction details.";
7
  * error - payment gateway communication and hashing related issues
8
  */
9
  // failure - occurred in the processing of the final callback from the hosted payment form/transparent redirect
10
+ const ERROR_183 = "Your payment attempt has been declined by your issuing bank.<br/>Please check your credit/debit card details and try again.";
11
 
12
  // error - occurred during the partial processing of the callback from the transparent redirect page
13
  const ERROR_260 = "ERROR 260: The payment result couldn't be verified.";
14
 
15
  // error - direct integration transaction cannot be completed - problem in the communication with the payment gateway
16
+ const ERROR_261 = "ERROR 261: Could not communicate with payment gateway.";
17
 
18
  // error - direct integration 3D Secure transaction couldn't be processed - problem in the communication with the paymwent gateway
19
+ const ERROR_431 = "ERROR 431: Could not communicate with payment gateway to complete the 3D Secure authentication.";
20
 
21
  // failure - occurred during the processing of the data in the callback from the 3D Secure Authentication page
22
+ const ERROR_7655 = "Your payment attempt has been declined by your issuing bank.<br/>Please check your credit/debit card details and try again.";
23
 
24
  // failure - server pull result related error: no URL variable present in the payment form to merchant webshop redirection
25
  const ERROR_309 ="ERROR 309: Missing parameters.";
28
  const ERROR_304 = "ERROR 304: The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
29
 
30
  // faulire - server pull result related error: Magento web request to the hosted PaymentFormHandler failed while trying to retrieve the transaction details using the CrossReference
31
+ const ERROR_329 = "ERROR 329: An error occurred while trying to validate the transaction result.";
32
 
33
  // failure - server pull result related error: empty response due to invalid CrossReference
34
  const ERROR_381 = "ERROR 381: Invalid transaction details.";
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ISOCountries.php CHANGED
@@ -1,6 +1,10 @@
1
  <?php
2
 
3
- include_once ("ThePaymentGateway/TPG_Common.php");
 
 
 
 
4
 
5
  class CSV_ISOCountries
6
  {
1
  <?php
2
 
3
+ if (!defined('COMPILER_INCLUDE_PATH')) {
4
+ include_once ("ThePaymentGateway/TPG_Common.php");
5
+ } else {
6
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ThePaymentGateway_TPG_Common.php");
7
+ }
8
 
9
  class CSV_ISOCountries
10
  {
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ISOCurrencies.php CHANGED
@@ -1,6 +1,10 @@
1
  <?php
2
 
3
- include_once ("ThePaymentGateway/TPG_Common.php");
 
 
 
 
4
 
5
  class CSV_ISOCurrencies
6
  {
1
  <?php
2
 
3
+ if (!defined('COMPILER_INCLUDE_PATH')) {
4
+ include_once ("ThePaymentGateway/TPG_Common.php");
5
+ } else {
6
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ThePaymentGateway_TPG_Common.php");
7
+ }
8
 
9
  class CSV_ISOCurrencies
10
  {
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/PaymentFormHelper.php CHANGED
@@ -1,6 +1,10 @@
1
  <?php
2
-
3
- require_once "app/code/local/Cardsave/Cardsaveonlinepayments/Model/Source/HashMethod.php";
 
 
 
 
4
 
5
  class CSV_ListItemList
6
  {
1
  <?php
2
+
3
+ if (!defined('COMPILER_INCLUDE_PATH')) {
4
+ require_once "app/code/local/Cardsave/Cardsaveonlinepayments/Model/Source/HashMethod.php";
5
+ } else {
6
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Source_HashMethod.php");
7
+ }
8
 
9
  class CSV_ListItemList
10
  {
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ThePaymentGateway/PaymentSystem.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
2
- require_once('TPG_Common.php');
3
- require_once('SOAP.php');
 
 
 
 
 
 
4
 
5
  /*****************/
6
  /* Input classes */
1
  <?php
2
+
3
+ if (!defined('COMPILER_INCLUDE_PATH')) {
4
+ include_once ("TPG_Common.php");
5
+ include_once ("SOAP.php");
6
+ } else {
7
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ThePaymentGateway_TPG_Common.php");
8
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ThePaymentGateway_SOAP.php");
9
+ }
10
 
11
  /*****************/
12
  /* Input classes */
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/ThePaymentGateway/SOAP.php CHANGED
@@ -1,6 +1,10 @@
1
  <?php
2
- //accessing external files
3
- require_once('TPG_Common.php');
 
 
 
 
4
 
5
  class CSV_SOAPNamespace
6
  {
1
  <?php
2
+
3
+ if (!defined('COMPILER_INCLUDE_PATH')) {
4
+ include_once ("TPG_Common.php");
5
+ } else {
6
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ThePaymentGateway_TPG_Common.php");
7
+ }
8
 
9
  class CSV_SOAPNamespace
10
  {
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Direct.php CHANGED
@@ -1,9 +1,16 @@
1
  <?php
2
 
3
- include ("Common/ThePaymentGateway/PaymentSystem.php");
4
- include_once ("Common/PaymentFormHelper.php");
5
- include ("Common/ISOCurrencies.php");
6
- include ("Common/ISOCountries.php");
 
 
 
 
 
 
 
7
 
8
  class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Method_Abstract
9
  {
@@ -21,8 +28,8 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
21
  protected $_canCapture = true;
22
  protected $_canCapturePartial = false;
23
  protected $_canRefund = true;
24
- protected $_canVoid = true;
25
- protected $_canUseInternal = true;
26
  protected $_canUseCheckout = true;
27
  protected $_canUseForMultishipping = true;
28
  protected $_canSaveCc = false;
@@ -195,13 +202,6 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
195
  {
196
  Mage::throwException($error);
197
  }
198
- else
199
- {
200
- if($nVersion == 1324 || $nVersion == 1330)
201
- {
202
- $payment->setIsInvoicePaid(true);
203
- }
204
- }
205
 
206
  return $this;
207
  }
@@ -396,11 +396,9 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
396
  ->setAcsurl($szACSURL)
397
  ->setPareq($szPaReq);
398
 
399
- if($nVersion >= 1410)
400
- {
401
- Mage::getSingleton('checkout/session')->setRedirectionmethod('_run3DSecureTransaction');
402
- $order->setIsThreeDSecurePending(true);
403
- }
404
  break;
405
  case 5:
406
  // status code of 5 - means transaction declined
@@ -452,13 +450,6 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
452
  $payment->setStatus('FAIL')
453
  ->setCcApproval('FAIL');
454
  }
455
- else
456
- {
457
- if($nVersion == 1324 || $nVersion == 1330)
458
- {
459
- $payment->setIsInvoicePaid(true);
460
- }
461
- }
462
 
463
  return $error;
464
  }
@@ -640,11 +631,8 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
640
  ->setServerresulturlformvariables($szServerResultURLFormVariables)
641
  ->setServerresulturlquerystringvariables($szServerResultURLQueryStringVariables);
642
 
643
- if($nVersion >= 1410)
644
- {
645
- $session->setRedirectionmethod('_runRedirectedPaymentComplete');
646
- $payment->getOrder()->setIsHostedPaymentPending(true);
647
- }
648
 
649
  /* serve out a dummy CrossReference as the TransactionId - this need to be done to enable the "Refund" button
650
  in the Magento CreditMemo internal refund mechanism */
@@ -761,11 +749,9 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
761
  ->setIssuenumber($szIssueNumber)
762
  ->setCv2($szCV2);
763
 
764
- if($nVersion >= 1410)
765
- {
766
- Mage::getSingleton('checkout/session')->setRedirectionmethod('_runRedirectedPaymentComplete');
767
- $payment->getOrder()->setIsHostedPaymentPending(true);
768
- }
769
 
770
  /* serve out a dummy CrossReference as the TransactionId - this need to be done to enable the "Refund" button
771
  in the Magento CreditMemo internal refund mechanism */
@@ -890,14 +876,6 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
890
  else
891
  {
892
  $payment->setStatus(self::STATUS_APPROVED);
893
-
894
-
895
-
896
- if($nVersion == 1324 || $nVersion == 1330)
897
- {
898
- $payment->setIsInvoicePaid(true);
899
- Mage::getSingleton('core/session')->addSuccess($message);
900
- }
901
  }
902
 
903
  return $this;
@@ -958,12 +936,6 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
958
  else
959
  {
960
  $payment->setStatus(self::STATUS_APPROVED);
961
-
962
- if($nVersion == 1324 || $nVersion ==1330)
963
- {
964
- $payment->setIsInvoicePaid(true);
965
- Mage::getSingleton('core/session')->addSuccess($message);
966
- }
967
  }
968
 
969
  return $this;
@@ -985,31 +957,26 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
985
  $session->getAcsurl() &&
986
  $session->getPareq())
987
  {
988
- // Direct (API) for 3D Secure payments
989
- if($nVersion >= 1410)
990
- {
991
- // need to re-add the ordered item quantity to stock as per not completed 3DS transaction
992
- if($mode != Cardsave_Cardsaveonlinepayments_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT)
993
- {
994
- $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
995
- $this->addOrderedItemsToStock($order);
996
- }
997
- }
998
 
999
  $result = Mage::getUrl('cardsaveonlinepayments/payment/threedsecure', array('_secure' => true));
1000
  }
1001
  if($session->getHashdigest())
1002
  {
1003
- // Hosted Payment Form and Transparent Redirect payments
1004
- if($nVersion >= 1410)
1005
- {
1006
- // need to re-add the ordered item quantity to stock as per not completed 3DS transaction
1007
- if(!Mage::getSingleton('checkout/session')->getPares())
1008
- {
1009
- $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
1010
- $this->addOrderedItemsToStock($order);
1011
- }
1012
- }
1013
 
1014
  $result = Mage::getUrl('cardsaveonlinepayments/payment/redirect', array('_secure' => true));
1015
  }
@@ -1151,8 +1118,7 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
1151
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
1152
  $isCustomStockManagementEnabled = Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('customstockmanagementenabled');
1153
 
1154
- if($nVersion >= 1410 &&
1155
- $isCustomStockManagementEnabled)
1156
  {
1157
  $items = $order->getAllItems();
1158
  foreach ($items as $itemId => $item)
@@ -1183,8 +1149,7 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
1183
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
1184
  $isCustomStockManagementEnabled = Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('customstockmanagementenabled');
1185
 
1186
- if($nVersion >= 1410 &&
1187
- $isCustomStockManagementEnabled)
1188
  {
1189
  $items = $order->getAllItems();
1190
  foreach ($items as $itemId => $item)
1
  <?php
2
 
3
+ if (!defined('COMPILER_INCLUDE_PATH')) {
4
+ include_once ("Common/ThePaymentGateway/PaymentSystem.php");
5
+ include_once ("Common/PaymentFormHelper.php");
6
+ include_once ("Common/ISOCurrencies.php");
7
+ include_once ("Common/ISOCountries.php");
8
+ } else {
9
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ThePaymentGateway_PaymentSystem.php");
10
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_PaymentFormHelper.php");
11
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ISOCurrencies.php");
12
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_ISOCountries.php");
13
+ }
14
 
15
  class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Method_Abstract
16
  {
28
  protected $_canCapture = true;
29
  protected $_canCapturePartial = false;
30
  protected $_canRefund = true;
31
+ protected $_canVoid = false;
32
+ protected $_canUseInternal = false;
33
  protected $_canUseCheckout = true;
34
  protected $_canUseForMultishipping = true;
35
  protected $_canSaveCc = false;
202
  {
203
  Mage::throwException($error);
204
  }
 
 
 
 
 
 
 
205
 
206
  return $this;
207
  }
396
  ->setAcsurl($szACSURL)
397
  ->setPareq($szPaReq);
398
 
399
+ Mage::getSingleton('checkout/session')->setRedirectionmethod('_run3DSecureTransaction');
400
+ $order->setIsThreeDSecurePending(true);
401
+
 
 
402
  break;
403
  case 5:
404
  // status code of 5 - means transaction declined
450
  $payment->setStatus('FAIL')
451
  ->setCcApproval('FAIL');
452
  }
 
 
 
 
 
 
 
453
 
454
  return $error;
455
  }
631
  ->setServerresulturlformvariables($szServerResultURLFormVariables)
632
  ->setServerresulturlquerystringvariables($szServerResultURLQueryStringVariables);
633
 
634
+ $session->setRedirectionmethod('_runRedirectedPaymentComplete');
635
+ $payment->getOrder()->setIsHostedPaymentPending(true);
 
 
 
636
 
637
  /* serve out a dummy CrossReference as the TransactionId - this need to be done to enable the "Refund" button
638
  in the Magento CreditMemo internal refund mechanism */
749
  ->setIssuenumber($szIssueNumber)
750
  ->setCv2($szCV2);
751
 
752
+ Mage::getSingleton('checkout/session')->setRedirectionmethod('_runRedirectedPaymentComplete');
753
+ $payment->getOrder()->setIsHostedPaymentPending(true);
754
+
 
 
755
 
756
  /* serve out a dummy CrossReference as the TransactionId - this need to be done to enable the "Refund" button
757
  in the Magento CreditMemo internal refund mechanism */
876
  else
877
  {
878
  $payment->setStatus(self::STATUS_APPROVED);
 
 
 
 
 
 
 
 
879
  }
880
 
881
  return $this;
936
  else
937
  {
938
  $payment->setStatus(self::STATUS_APPROVED);
 
 
 
 
 
 
939
  }
940
 
941
  return $this;
957
  $session->getAcsurl() &&
958
  $session->getPareq())
959
  {
960
+ // Direct (API) for 3D Secure payments
961
+ // need to re-add the ordered item quantity to stock as per not completed 3DS transaction
962
+ if($mode != Cardsave_Cardsaveonlinepayments_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT)
963
+ {
964
+ $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
965
+ $this->addOrderedItemsToStock($order);
966
+ }
967
+
 
 
968
 
969
  $result = Mage::getUrl('cardsaveonlinepayments/payment/threedsecure', array('_secure' => true));
970
  }
971
  if($session->getHashdigest())
972
  {
973
+
974
+ // need to re-add the ordered item quantity to stock as per not completed 3DS transaction
975
+ if(!Mage::getSingleton('checkout/session')->getPares())
976
+ {
977
+ $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
978
+ $this->addOrderedItemsToStock($order);
979
+ }
 
 
 
980
 
981
  $result = Mage::getUrl('cardsaveonlinepayments/payment/redirect', array('_secure' => true));
982
  }
1118
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
1119
  $isCustomStockManagementEnabled = Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('customstockmanagementenabled');
1120
 
1121
+ if($isCustomStockManagementEnabled)
 
1122
  {
1123
  $items = $order->getAllItems();
1124
  foreach ($items as $itemId => $item)
1149
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
1150
  $isCustomStockManagementEnabled = Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('customstockmanagementenabled');
1151
 
1152
+ if($isCustomStockManagementEnabled)
 
1153
  {
1154
  $items = $order->getAllItems();
1155
  foreach ($items as $itemId => $item)
app/code/local/Cardsave/Cardsaveonlinepayments/controllers/PaymentController.php CHANGED
@@ -1,6 +1,10 @@
1
  <?php
2
 
3
- require_once "app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/PaymentFormHelper.php";
 
 
 
 
4
 
5
  /**
6
  * Standard Checkout Controller
@@ -80,8 +84,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
80
  $cardsaveOrderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
81
  $szOrderStatus = $order->getStatus();
82
 
83
- if($szOrderStatus != 'csv_paid' &&
84
- $szOrderStatus != 'csv_preauth')
85
  {
86
  // cart is not empty
87
  // complete the 3D Secure transaction with the 3D Authorization result
@@ -118,27 +121,18 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
118
  $szPaymentProcessorResponse != '')
119
  {
120
  $szMessage .= '<br/>'.$szPaymentProcessorResponse;
121
- }
122
 
123
- if($nVersion >= 1410)
124
- {
125
- if($order)
126
- {
127
- $orderState = 'pending_payment';
128
- $orderStatus = 'csv_failed_threed_secure';
129
- $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('3D Secure Authentication Failed'));
130
- $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
131
- $order->save();
132
- }
133
- }
134
- if($nVersion == 1324 || $nVersion == 1330)
135
- {
136
- Mage::getSingleton('checkout/session')->addError($szMessage);
137
- }
138
- else
139
- {
140
- Mage::getSingleton('core/session')->addError($szMessage);
141
- }
142
 
143
  $this->_clearSessionVariables();
144
  // report out an fatal error
@@ -158,23 +152,12 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
158
  $order->sendNewOrderEmail();
159
  }
160
 
161
- if($nVersion >= 1410)
162
- {
163
- // TODO : no need to remove stock item as the system will do it in 1.6 version
164
- if($nVersion < 1600)
165
- {
166
- Mage::getModel('cardsaveonlinepayments/direct')->subtractOrderedItemsFromStock($order);
167
- }
168
- $this->_updateInvoices($order, $szPaymentProcessorResponse);
169
- }
170
 
171
- if($nVersion != 1324 && $nVersion != 1330)
172
- {
173
- if($szPaymentProcessorResponse != '')
174
- {
175
- Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
176
- }
177
- }
178
  }
179
 
180
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
@@ -187,7 +170,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
187
  */
188
  public function callbackhostedpaymentAction()
189
  {
190
- $boError = false;
191
  $formVariables = array();
192
  $model = Mage::getModel('cardsaveonlinepayments/direct');
193
  $szOrderID = $this->getRequest()->getPost('OrderID');
@@ -285,26 +268,18 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
285
 
286
  $model->setPaymentAdditionalInformation($order->getPayment(), $this->getRequest()->getPost('CrossReference'));
287
  //$order->getPayment()->setAdditionalData("CrossReference=".$this->getRequest()->getPost('CrossReference'));
 
 
 
 
 
 
 
 
 
 
 
288
 
289
- if($nVersion >= 1410)
290
- {
291
- if($order)
292
- {
293
- $orderState = 'pending_payment';
294
- $orderStatus = 'csv_failed_hosted_payment';
295
- $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('Hosted Payment Failed'));
296
- $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
297
- $order->save();
298
- }
299
- }
300
- if($nVersion == 1324 || $nVersion == 1330)
301
- {
302
- Mage::getSingleton('checkout/session')->addError($szNotificationMessage);
303
- }
304
- else
305
- {
306
- Mage::getSingleton('core/session')->addError($szNotificationMessage);
307
- }
308
  $order->save();
309
 
310
  $this->_clearSessionVariables();
@@ -321,25 +296,14 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
321
  if($order->getId())
322
  {
323
  $order->sendNewOrderEmail();
324
- }
325
-
326
- if($nVersion >= 1410)
327
- {
328
- // TODO : no need to remove stock item as the system will do it in 1.6 version
329
- if($nVersion < 1600)
330
- {
331
- $model->subtractOrderedItemsFromStock($order);
332
- }
333
- $this->_updateInvoices($order, $szPaymentProcessorResponse);
334
- }
335
-
336
- if($nVersion != 1324 && $nVersion != 1330)
337
- {
338
- if($szPaymentProcessorResponse != '')
339
- {
340
- Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
341
- }
342
- }
343
  }
344
 
345
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
@@ -399,16 +363,8 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
399
  // the shopping cart will be emptied rather than 'uncomplete'
400
  if($this->getRequest()->getPost('StatusCode') == '0')
401
  {
402
- Mage::getSingleton('checkout/session')->clear();
403
-
404
- if($nVersion >= 1410)
405
- {
406
- if($nVersion < 1600)
407
- {
408
- $model->subtractOrderedItemsFromStock($order);
409
- }
410
- $this->_updateInvoices($order, $szMessage);
411
- }
412
  }
413
 
414
  $this->getResponse()->setBody('StatusCode=0');
@@ -422,12 +378,12 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
422
  {
423
  $boError = false;
424
  $nStartIndex = false;
425
- //
426
  $szHashDigest = false;
427
  $szMerchantID = false;
428
  $szCrossReference = false;
429
  $szOrderID = false;
430
- //
431
  $nErrorNumber = false;
432
  $szErrorMessage = false;
433
  $model = Mage::getModel('cardsaveonlinepayments/direct');
@@ -537,9 +493,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
537
  $model->setPaymentAdditionalInformation($order->getPayment(), $szCrossReference);
538
  //$order->getPayment()->setAdditionalData("CrossReference=".$szCrossReference);
539
 
540
- if($nVersion >= 1410)
541
- {
542
- if($order)
543
  {
544
  $orderState = 'pending_payment';
545
  $orderStatus = 'csv_failed_hosted_payment';
@@ -547,15 +501,9 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
547
  $order->setState($orderState, $orderStatus, $szErrorMessage, false);
548
  $order->save();
549
  }
550
- }
551
- if($nVersion == 1324 || $nVersion == 1330)
552
- {
553
- Mage::getSingleton('checkout/session')->addError($szErrorMessage);
554
- }
555
- else
556
- {
557
- Mage::getSingleton('core/session')->addError($szErrorMessage);
558
- }
559
  $order->save();
560
 
561
  $this->_clearSessionVariables();
@@ -571,20 +519,11 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
571
  {
572
  $order->sendNewOrderEmail();
573
  }
 
 
574
 
575
- if($nVersion >= 1410)
576
- {
577
- if($nVersion < 1600)
578
- {
579
- $model->subtractOrderedItemsFromStock($order);
580
- }
581
- $this->_updateInvoices($order, $szMessage);
582
- }
583
 
584
- if($nVersion != 1324 && $nVersion != 1330)
585
- {
586
- Mage::getSingleton('core/session')->addSuccess('Payment Processor Response: '.$szMessage);
587
- }
588
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
589
  }
590
  }
@@ -632,9 +571,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
632
  $error = Cardsave_Cardsaveonlinepayments_Model_Common_GlobalErrors::ERROR_260;
633
  Mage::logException($exc);
634
 
635
- if($nVersion >= 1410)
636
- {
637
- if($order)
638
  {
639
  $orderState = 'pending_payment';
640
  $orderStatus = 'csv_failed_hosted_payment';
@@ -642,15 +579,9 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
642
  $order->setState($orderState, $orderStatus, $exc->getMessage(), false);
643
  $order->save();
644
  }
645
- }
646
- if($nVersion == 1324 || $nVersion == 1330)
647
- {
648
- Mage::getSingleton('checkout/session')->addError($error);
649
- }
650
- else
651
- {
652
- Mage::getSingleton('core/session')->addError($error);
653
- }
654
 
655
  $this->_clearSessionVariables();
656
  $this->_redirect('checkout/onepage/failure');
@@ -817,29 +748,19 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
817
 
818
  $model->setPaymentAdditionalInformation($order->getPayment(), $this->getRequest()->getPost('CrossReference'));
819
  //$order->getPayment()->setAdditionalData("CrossReference=".$this->getRequest()->getPost('CrossReference'));
820
-
821
- if($nVersion >= 1410)
822
- {
823
- if($order)
824
- {
825
- $orderState = 'pending_payment';
826
- $orderStatus = 'csv_failed_hosted_payment';
827
- $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('Transparent Redirect Payment Failed'));
828
- $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
829
- }
830
- }
831
 
832
  $order->save();
833
 
834
- if($nVersion == 1324 || $nVersion == 1330)
835
- {
836
- Mage::getSingleton('checkout/session')->addError($szNotificationMessage);
837
- }
838
- else
839
- {
840
- Mage::getSingleton('core/session')->addError($szNotificationMessage);
841
- }
842
-
843
  $this->_clearSessionVariables();
844
  $this->_redirect('checkout/onepage/failure');
845
  }
@@ -856,25 +777,13 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
856
  $order->sendNewOrderEmail();
857
  }
858
 
859
- if($nVersion >= 1410)
860
- {
861
- // TODO : no need to remove stock item as the system will do it in 1.6 version
862
- if($nVersion < 1600)
863
- {
864
- $model->subtractOrderedItemsFromStock($order);
865
- }
866
- $this->_updateInvoices($order, $szPaymentProcessorResponse);
867
- }
868
-
869
- if($nVersion != 1324 && $nVersion != 1330)
870
- {
871
- if($szPaymentProcessorResponse != '')
872
- {
873
- Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
874
- }
875
- }
876
- }
877
-
878
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
879
  }
880
  }
1
  <?php
2
 
3
+ if (!defined('COMPILER_INCLUDE_PATH')) {
4
+ require_once "app/code/local/Cardsave/Cardsaveonlinepayments/Model/Common/PaymentFormHelper.php";
5
+ } else {
6
+ include_once ("Cardsave_Cardsaveonlinepayments_Model_Common_PaymentFormHelper.php");
7
+ }
8
 
9
  /**
10
  * Standard Checkout Controller
84
  $cardsaveOrderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
85
  $szOrderStatus = $order->getStatus();
86
 
87
+ if($szOrderStatus != 'csv_paid' && $szOrderStatus != 'csv_preauth')
 
88
  {
89
  // cart is not empty
90
  // complete the 3D Secure transaction with the 3D Authorization result
121
  $szPaymentProcessorResponse != '')
122
  {
123
  $szMessage .= '<br/>'.$szPaymentProcessorResponse;
124
+ }
125
 
126
+ if($order)
127
+ {
128
+ $orderState = 'pending_payment';
129
+ $orderStatus = 'csv_failed_threed_secure';
130
+ $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('3D Secure Authentication Failed'));
131
+ $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
132
+ $order->save();
133
+ }
134
+
135
+ Mage::getSingleton('core/session')->addError($szMessage);
 
 
 
 
 
 
 
 
 
136
 
137
  $this->_clearSessionVariables();
138
  // report out an fatal error
152
  $order->sendNewOrderEmail();
153
  }
154
 
155
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
 
 
 
 
 
 
 
 
156
 
157
+ if($szPaymentProcessorResponse != '')
158
+ {
159
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
160
+ }
 
 
 
161
  }
162
 
163
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
170
  */
171
  public function callbackhostedpaymentAction()
172
  {
173
+ $boError = false;
174
  $formVariables = array();
175
  $model = Mage::getModel('cardsaveonlinepayments/direct');
176
  $szOrderID = $this->getRequest()->getPost('OrderID');
268
 
269
  $model->setPaymentAdditionalInformation($order->getPayment(), $this->getRequest()->getPost('CrossReference'));
270
  //$order->getPayment()->setAdditionalData("CrossReference=".$this->getRequest()->getPost('CrossReference'));
271
+
272
+ if($order)
273
+ {
274
+ $orderState = 'pending_payment';
275
+ $orderStatus = 'csv_failed_hosted_payment';
276
+ $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('Hosted Payment Failed'));
277
+ $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
278
+ $order->save();
279
+ }
280
+
281
+ Mage::getSingleton('core/session')->addError($szNotificationMessage);
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  $order->save();
284
 
285
  $this->_clearSessionVariables();
296
  if($order->getId())
297
  {
298
  $order->sendNewOrderEmail();
299
+ }
300
+
301
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
302
+
303
+ if($szPaymentProcessorResponse != '')
304
+ {
305
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
306
+ }
 
 
 
 
 
 
 
 
 
 
 
307
  }
308
 
309
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
363
  // the shopping cart will be emptied rather than 'uncomplete'
364
  if($this->getRequest()->getPost('StatusCode') == '0')
365
  {
366
+ Mage::getSingleton('checkout/session')->clear();
367
+ $this->_updateInvoices($order, $szMessage);
 
 
 
 
 
 
 
 
368
  }
369
 
370
  $this->getResponse()->setBody('StatusCode=0');
378
  {
379
  $boError = false;
380
  $nStartIndex = false;
381
+
382
  $szHashDigest = false;
383
  $szMerchantID = false;
384
  $szCrossReference = false;
385
  $szOrderID = false;
386
+
387
  $nErrorNumber = false;
388
  $szErrorMessage = false;
389
  $model = Mage::getModel('cardsaveonlinepayments/direct');
493
  $model->setPaymentAdditionalInformation($order->getPayment(), $szCrossReference);
494
  //$order->getPayment()->setAdditionalData("CrossReference=".$szCrossReference);
495
 
496
+ if($order)
 
 
497
  {
498
  $orderState = 'pending_payment';
499
  $orderStatus = 'csv_failed_hosted_payment';
501
  $order->setState($orderState, $orderStatus, $szErrorMessage, false);
502
  $order->save();
503
  }
504
+
505
+ Mage::getSingleton('core/session')->addError($szErrorMessage);
506
+
 
 
 
 
 
 
507
  $order->save();
508
 
509
  $this->_clearSessionVariables();
519
  {
520
  $order->sendNewOrderEmail();
521
  }
522
+
523
+ $this->_updateInvoices($order, $szMessage);
524
 
525
+ Mage::getSingleton('core/session')->addSuccess('Payment Processor Response: '.$szMessage);
 
 
 
 
 
 
 
526
 
 
 
 
 
527
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
528
  }
529
  }
571
  $error = Cardsave_Cardsaveonlinepayments_Model_Common_GlobalErrors::ERROR_260;
572
  Mage::logException($exc);
573
 
574
+ if($order)
 
 
575
  {
576
  $orderState = 'pending_payment';
577
  $orderStatus = 'csv_failed_hosted_payment';
579
  $order->setState($orderState, $orderStatus, $exc->getMessage(), false);
580
  $order->save();
581
  }
582
+
583
+ Mage::getSingleton('core/session')->addError($error);
584
+
 
 
 
 
 
 
585
 
586
  $this->_clearSessionVariables();
587
  $this->_redirect('checkout/onepage/failure');
748
 
749
  $model->setPaymentAdditionalInformation($order->getPayment(), $this->getRequest()->getPost('CrossReference'));
750
  //$order->getPayment()->setAdditionalData("CrossReference=".$this->getRequest()->getPost('CrossReference'));
751
+
752
+ if($order)
753
+ {
754
+ $orderState = 'pending_payment';
755
+ $orderStatus = 'csv_failed_hosted_payment';
756
+ $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('Transparent Redirect Payment Failed'));
757
+ $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
758
+ }
 
 
 
759
 
760
  $order->save();
761
 
762
+ Mage::getSingleton('core/session')->addError($szNotificationMessage);
763
+
 
 
 
 
 
 
 
764
  $this->_clearSessionVariables();
765
  $this->_redirect('checkout/onepage/failure');
766
  }
777
  $order->sendNewOrderEmail();
778
  }
779
 
780
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
781
+
782
+ if($szPaymentProcessorResponse != '')
783
+ {
784
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
785
+ }
786
+ }
 
 
 
 
 
 
 
 
 
 
 
 
787
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
788
  }
789
  }
app/code/local/Cardsave/Cardsaveonlinepayments/etc/config.xml CHANGED
@@ -107,7 +107,7 @@
107
  <hostedpaymentactionurl>https://mms.cardsaveonlinepayments.com/Pages/PublicPages/PaymentForm.aspx</hostedpaymentactionurl>
108
  <transparentredirectactionurl>https://mms.cardsaveonlinepayments.com/Pages/PublicPages/TransparentRedirect.aspx</transparentredirectactionurl>
109
  <serverpullresultactionurl>https://mms.cardsaveonlinepayments.com/Pages/PublicPages/PaymentFormResultHandler.ashx</serverpullresultactionurl>
110
- <payment_action>capture</payment_action>
111
  <mode>direct</mode>
112
  <cv2mandatory>1</cv2mandatory>
113
  <address1mandatory>1</address1mandatory>
107
  <hostedpaymentactionurl>https://mms.cardsaveonlinepayments.com/Pages/PublicPages/PaymentForm.aspx</hostedpaymentactionurl>
108
  <transparentredirectactionurl>https://mms.cardsaveonlinepayments.com/Pages/PublicPages/TransparentRedirect.aspx</transparentredirectactionurl>
109
  <serverpullresultactionurl>https://mms.cardsaveonlinepayments.com/Pages/PublicPages/PaymentFormResultHandler.ashx</serverpullresultactionurl>
110
+ <payment_action>authorize_capture</payment_action>
111
  <mode>direct</mode>
112
  <cv2mandatory>1</cv2mandatory>
113
  <address1mandatory>1</address1mandatory>
app/code/local/Cardsave/Cardsaveonlinepayments/etc/system.xml CHANGED
@@ -1,246 +1,264 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <sections>
4
- <payment>
5
- <groups>
6
- <cardsaveonlinepayments translate="label">
7
- <label>CardSave</label>
8
- <comment>
9
- <![CDATA[
10
- <div style="color:Blue;font-weight:bold;">
11
- Merchant Management System (MMS) <a href="https://mms.cardsaveonlinepayments.com" target="_blank">login</a>
12
- </div>
13
- ]]>
14
- </comment>
15
- <sort_order>670</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- <fields>
20
- <title translate="label">
21
- <label>Title</label>
22
- <frontend_type>text</frontend_type>
23
- <sort_order>10</sort_order>
24
- <show_in_default>1</show_in_default>
25
- <show_in_website>1</show_in_website>
26
- <show_in_store>0</show_in_store>
27
- </title>
28
- <active translate="label">
29
- <label>Enabled</label>
30
- <sort_order>20</sort_order>
31
- <frontend_type>select</frontend_type>
32
- <source_model>adminhtml/system_config_source_yesno</source_model>
33
- <show_in_default>1</show_in_default>
34
- <show_in_website>1</show_in_website>
35
- <show_in_store>0</show_in_store>
36
- </active>
37
- <debug translate="label">
38
- <label>Debug</label>
39
- <frontend_type>select</frontend_type>
40
- <source_model>adminhtml/system_config_source_yesno</source_model>
41
- <sort_order>30</sort_order>
42
- <show_in_default>1</show_in_default>
43
- <show_in_website>1</show_in_website>
44
- <show_in_store>0</show_in_store>
45
- </debug>
46
- <order_status translate="label">
47
- <label>New order status</label>
48
- <sort_order>40</sort_order>
49
- <frontend_type>select</frontend_type>
50
- <source_model>cardsaveonlinepayments/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>
54
- <show_in_store>0</show_in_store>
55
- </order_status>
56
- <merchantid translate="label">
57
- <label>Merchant ID</label>
58
- <frontend_type>text</frontend_type>
59
- <sort_order>60</sort_order>
60
- <show_in_default>1</show_in_default>
61
- <show_in_website>1</show_in_website>
62
- <show_in_store>0</show_in_store>
63
- </merchantid>
64
- <password translate="label">
65
- <label>Password</label>
66
- <frontend_type>password</frontend_type>
67
- <sort_order>70</sort_order>
68
- <show_in_default>1</show_in_default>
69
- <show_in_website>1</show_in_website>
70
- <show_in_store>0</show_in_store>
71
- </password>
72
- <presharedkey translate="label">
73
- <label>Pre Shared Key</label>
74
- <frontend_type>text</frontend_type>
75
- <sort_order>80</sort_order>
76
- <show_in_default>1</show_in_default>
77
- <show_in_website>1</show_in_website>
78
- <show_in_store>0</show_in_store>
79
- </presharedkey>
80
- <hashmethod translate="label">
81
- <label>Hash Method</label>
82
- <frontend_type>select</frontend_type>
83
- <sort_order>81</sort_order>
84
- <source_model>cardsaveonlinepayments/source_hashMethod</source_model>
85
- <show_in_default>1</show_in_default>
86
- <show_in_website>1</show_in_website>
87
- <show_in_store>0</show_in_store>
88
- </hashmethod>
89
- <paymentprocessordomain translate="label">
90
- <label>Payment Processor Domain</label>
91
- <frontend_type>label</frontend_type>
92
- <sort_order>100</sort_order>
93
- <show_in_default>1</show_in_default>
94
- <show_in_website>1</show_in_website>
95
- <show_in_store>0</show_in_store>
96
- </paymentprocessordomain>
97
- <paymentprocessorport translate="label">
98
- <label>Payment Processor Port</label>
99
- <frontend_type>label</frontend_type>
100
- <sort_order>110</sort_order>
101
- <show_in_default>1</show_in_default>
102
- <show_in_website>1</show_in_website>
103
- <show_in_store>0</show_in_store>
104
- </paymentprocessorport>
105
- <payment_action translate="label">
106
- <label>Payment Action</label>
107
- <sort_order>120</sort_order>
108
- <frontend_type>select</frontend_type>
109
- <source_model>cardsaveonlinepayments/source_paymentAction</source_model>
110
- <show_in_default>1</show_in_default>
111
- <show_in_website>1</show_in_website>
112
- <show_in_store>0</show_in_store>
113
- </payment_action>
114
- <mode translate="label">
115
- <label>Payment Integration Method</label>
116
- <sort_order>130</sort_order>
117
- <frontend_type>select</frontend_type>
118
- <source_model>cardsaveonlinepayments/source_paymentMode</source_model>
119
- <show_in_default>1</show_in_default>
120
- <show_in_website>1</show_in_website>
121
- <show_in_store>0</show_in_store>
122
- </mode>
123
- <hostedpaymentactionurl>
124
- <label>Hosted Payment Form Action URL</label>
125
- <frontend_type>label</frontend_type>
126
- <sort_order>131</sort_order>
127
- <show_in_default>1</show_in_default>
128
- <show_in_website>1</show_in_website>
129
- <show_in_store>0</show_in_store>
130
- </hostedpaymentactionurl>
131
- <transparentredirectactionurl>
132
- <label>Transparent Redirect Action URL</label>
133
- <frontend_type>label</frontend_type>
134
- <sort_order>132</sort_order>
135
- <show_in_default>1</show_in_default>
136
- <show_in_website>1</show_in_website>
137
- <show_in_store>0</show_in_store>
138
- </transparentredirectactionurl>
139
- <serverpullresultactionurl>
140
- <label>Server Pull Result Action URL</label>
141
- <frontend_type>label</frontend_type>
142
- <sort_order>133</sort_order>
143
- <show_in_default>1</show_in_default>
144
- <show_in_website>1</show_in_website>
145
- <show_in_store>0</show_in_store>
146
- </serverpullresultactionurl>
147
- <cv2mandatory>
148
- <label>CV2 Mandatory <![CDATA[<span style="color:Red;font-weight:bold;font-size:12px;">(ON FORM ONLY)</span>]]></label>
149
- <sort_order>140</sort_order>
150
- <frontend_type>select</frontend_type>
151
- <source_model>adminhtml/system_config_source_yesno</source_model>
152
- <show_in_default>1</show_in_default>
153
- <show_in_website>1</show_in_website>
154
- <show_in_store>0</show_in_store>
155
- <comment><![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode. If you want to change the CV2 behaviour, please log into the <span style="font-weight:bold;color:Blue;">MMS</span> and update your Account Settings]]></comment>
156
- </cv2mandatory>
157
- <address1mandatory>
158
- <label>Address1 Mandatory</label>
159
- <sort_order>150</sort_order>
160
- <frontend_type>select</frontend_type>
161
- <source_model>adminhtml/system_config_source_yesno</source_model>
162
- <show_in_default>1</show_in_default>
163
- <show_in_website>1</show_in_website>
164
- <show_in_store>0</show_in_store>
165
- <comment>
166
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
167
- </comment>
168
- </address1mandatory>
169
- <citymandatory>
170
- <label>City Mandatory</label>
171
- <sort_order>160</sort_order>
172
- <frontend_type>select</frontend_type>
173
- <source_model>adminhtml/system_config_source_yesno</source_model>
174
- <show_in_default>1</show_in_default>
175
- <show_in_website>1</show_in_website>
176
- <show_in_store>0</show_in_store>
177
- <comment>
178
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
179
- </comment>
180
- </citymandatory>
181
- <postcodemandatory>
182
- <label>PostCode Mandatory</label>
183
- <sort_order>170</sort_order>
184
- <frontend_type>select</frontend_type>
185
- <source_model>adminhtml/system_config_source_yesno</source_model>
186
- <show_in_default>1</show_in_default>
187
- <show_in_website>1</show_in_website>
188
- <show_in_store>0</show_in_store>
189
- <comment>
190
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
191
- </comment>
192
- </postcodemandatory>
193
- <statemandatory>
194
- <label>State Mandatory</label>
195
- <sort_order>180</sort_order>
196
- <frontend_type>select</frontend_type>
197
- <source_model>adminhtml/system_config_source_yesno</source_model>
198
- <show_in_default>1</show_in_default>
199
- <show_in_website>1</show_in_website>
200
- <show_in_store>0</show_in_store>
201
- <comment>
202
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
203
- </comment>
204
- </statemandatory>
205
- <countrymandatory>
206
- <label>Country Mandatory</label>
207
- <sort_order>190</sort_order>
208
- <frontend_type>select</frontend_type>
209
- <source_model>adminhtml/system_config_source_yesno</source_model>
210
- <show_in_default>1</show_in_default>
211
- <show_in_website>1</show_in_website>
212
- <show_in_store>0</show_in_store>
213
- <comment>
214
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
215
- </comment>
216
- </countrymandatory>
217
- <resultdeliverymethod>
218
- <label>Result Delivery Method</label>
219
- <sort_order>200</sort_order>
220
- <frontend_type>select</frontend_type>
221
- <source_model>cardsaveonlinepayments/source_resultDeliveryMethod</source_model>
222
- <show_in_default>1</show_in_default>
223
- <show_in_website>1</show_in_website>
224
- <show_in_store>0</show_in_store>
225
- <comment>
226
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
227
- </comment>
228
- </resultdeliverymethod>
229
- <customstockmanagementenabled>
230
- <label>Custom Stock Management Enabled</label>
231
- <sort_order>210</sort_order>
232
- <frontend_type>select</frontend_type>
233
- <source_model>adminhtml/system_config_source_yesno</source_model>
234
- <show_in_default>1</show_in_default>
235
- <show_in_website>1</show_in_website>
236
- <show_in_store>0</show_in_store>
237
- <comment>
238
- <![CDATA[<strong>Please note</strong>: The above setting is only applicable to Magento version 1.4.1.0 and above]]>
239
- </comment>
240
- </customstockmanagementenabled>
241
- </fields>
242
- </cardsaveonlinepayments>
243
- </groups>
244
- </payment>
245
- </sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <cardsaveonlinepayments translate="label">
7
+ <label>CardSave</label>
8
+ <comment>
9
+ <![CDATA[
10
+ <a href="https://mms.cardsaveonlinepayments.com" target="_blank">CardSave Merchant Management System (MMS)</a><br />
11
+ <a href="mailto:ecomm@cardsave.net" target="_blank">CardSave Integration Support</a><br />
12
+ <a href="http://www.cardsave.net/" target="_blank">CardSave Website</a>]]>
13
+ </comment>
14
+ <sort_order>670</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <fields>
19
+ <heading_modulesettings translate="label">
20
+ <label>Module Settings</label>
21
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
22
+ <sort_order>5</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ </heading_modulesettings>
26
+ <active translate="label">
27
+ <label>Enabled</label>
28
+ <sort_order>10</sort_order>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>0</show_in_store>
34
+ </active>
35
+ <debug translate="label">
36
+ <label>Debug Mode</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>20</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>0</show_in_store>
43
+ </debug>
44
+ <title translate="label">
45
+ <label>Title</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>30</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ <comment>The name of this payment method to be displayed to the customer in the checkout.</comment>
52
+ </title>
53
+ <heading_gatewaysettings translate="label">
54
+ <label>Gateway Settings</label>
55
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
56
+ <sort_order>50</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ </heading_gatewaysettings>
60
+ <merchantid translate="label">
61
+ <label>Merchant ID</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>60</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </merchantid>
68
+ <password translate="label">
69
+ <label>Password</label>
70
+ <frontend_type>password</frontend_type>
71
+ <sort_order>70</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </password>
76
+ <presharedkey translate="label">
77
+ <label>Pre Shared Key</label>
78
+ <frontend_type>text</frontend_type>
79
+ <sort_order>80</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>0</show_in_store>
83
+ </presharedkey>
84
+ <hashmethod translate="label">
85
+ <label>Hash Method</label>
86
+ <frontend_type>select</frontend_type>
87
+ <sort_order>81</sort_order>
88
+ <source_model>cardsaveonlinepayments/source_hashMethod</source_model>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>0</show_in_store>
92
+ </hashmethod>
93
+ <payment_action translate="label">
94
+ <label>Transaction Type</label>
95
+ <sort_order>120</sort_order>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>cardsaveonlinepayments/source_paymentAction</source_model>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>0</show_in_store>
101
+ </payment_action>
102
+ <mode translate="label">
103
+ <label>Payment Integration Method</label>
104
+ <sort_order>130</sort_order>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>cardsaveonlinepayments/source_paymentMode</source_model>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>0</show_in_store>
110
+ <comment>
111
+ <![CDATA[<b>Please note:</b> The Direct (API) Integration method requires Outgoing Port 4430 TCP is open in your servers firewall to communicate with the CardSave Payment Gateway.]]>
112
+ </comment>
113
+ </mode>
114
+ <resultdeliverymethod>
115
+ <label>Result Delivery Method</label>
116
+ <sort_order>131</sort_order>
117
+ <frontend_type>select</frontend_type>
118
+ <source_model>cardsaveonlinepayments/source_resultDeliveryMethod</source_model>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>0</show_in_store>
122
+ <comment>
123
+ <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
124
+ </comment>
125
+ </resultdeliverymethod>
126
+ <heading_mandatoryfields translate="label">
127
+ <label>Hosted Payment Form Mandatory Fields</label>
128
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
129
+ <sort_order>148</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ </heading_mandatoryfields>
133
+ <cv2mandatory>
134
+ <label>CV2 Mandatory</label>
135
+ <sort_order>149</sort_order>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>0</show_in_store>
141
+ </cv2mandatory>
142
+ <address1mandatory>
143
+ <label>Address1 Mandatory</label>
144
+ <sort_order>150</sort_order>
145
+ <frontend_type>select</frontend_type>
146
+ <source_model>adminhtml/system_config_source_yesno</source_model>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>0</show_in_store>
150
+ </address1mandatory>
151
+ <citymandatory>
152
+ <label>City Mandatory</label>
153
+ <sort_order>160</sort_order>
154
+ <frontend_type>select</frontend_type>
155
+ <source_model>adminhtml/system_config_source_yesno</source_model>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>0</show_in_store>
159
+ </citymandatory>
160
+ <postcodemandatory>
161
+ <label>PostCode Mandatory</label>
162
+ <sort_order>170</sort_order>
163
+ <frontend_type>select</frontend_type>
164
+ <source_model>adminhtml/system_config_source_yesno</source_model>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>0</show_in_store>
168
+ </postcodemandatory>
169
+ <statemandatory>
170
+ <label>State Mandatory</label>
171
+ <sort_order>180</sort_order>
172
+ <frontend_type>select</frontend_type>
173
+ <source_model>adminhtml/system_config_source_yesno</source_model>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>0</show_in_store>
177
+ </statemandatory>
178
+ <countrymandatory>
179
+ <label>Country Mandatory</label>
180
+ <sort_order>190</sort_order>
181
+ <frontend_type>select</frontend_type>
182
+ <source_model>adminhtml/system_config_source_yesno</source_model>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>0</show_in_store>
186
+ </countrymandatory>
187
+ <heading_additionalsettings translate="label">
188
+ <label>Additional Settings</label>
189
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
190
+ <sort_order>197</sort_order>
191
+ <show_in_default>1</show_in_default>
192
+ <show_in_website>1</show_in_website>
193
+ </heading_additionalsettings>
194
+ <customstockmanagementenabled>
195
+ <label>Custom Stock Management Enabled</label>
196
+ <sort_order>198</sort_order>
197
+ <frontend_type>select</frontend_type>
198
+ <source_model>adminhtml/system_config_source_yesno</source_model>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>0</show_in_store>
202
+ </customstockmanagementenabled>
203
+ <order_status translate="label">
204
+ <label>New order status</label>
205
+ <sort_order>199</sort_order>
206
+ <frontend_type>select</frontend_type>
207
+ <source_model>cardsaveonlinepayments/source_orderStatus</source_model>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>0</show_in_store>
211
+ </order_status>
212
+ <heading_technicalinfo translate="label">
213
+ <label>Additional Technical Information</label>
214
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
215
+ <sort_order>200</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>1</show_in_website>
218
+ </heading_technicalinfo>
219
+ <paymentprocessordomain translate="label">
220
+ <label>Payment Processor Domain</label>
221
+ <frontend_type>label</frontend_type>
222
+ <sort_order>201</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>0</show_in_store>
226
+ </paymentprocessordomain>
227
+ <paymentprocessorport translate="label">
228
+ <label>Payment Processor Port</label>
229
+ <frontend_type>label</frontend_type>
230
+ <sort_order>202</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ <show_in_store>0</show_in_store>
234
+ </paymentprocessorport>
235
+ <hostedpaymentactionurl>
236
+ <label>Hosted Payment Form Action URL</label>
237
+ <frontend_type>label</frontend_type>
238
+ <sort_order>203</sort_order>
239
+ <show_in_default>1</show_in_default>
240
+ <show_in_website>1</show_in_website>
241
+ <show_in_store>0</show_in_store>
242
+ </hostedpaymentactionurl>
243
+ <transparentredirectactionurl>
244
+ <label>Transparent Redirect Action URL</label>
245
+ <frontend_type>label</frontend_type>
246
+ <sort_order>204</sort_order>
247
+ <show_in_default>1</show_in_default>
248
+ <show_in_website>1</show_in_website>
249
+ <show_in_store>0</show_in_store>
250
+ </transparentredirectactionurl>
251
+ <serverpullresultactionurl>
252
+ <label>Server Pull Result Action URL</label>
253
+ <frontend_type>label</frontend_type>
254
+ <sort_order>205</sort_order>
255
+ <show_in_default>1</show_in_default>
256
+ <show_in_website>1</show_in_website>
257
+ <show_in_store>0</show_in_store>
258
+ </serverpullresultactionurl>
259
+ </fields>
260
+ </cardsaveonlinepayments>
261
+ </groups>
262
+ </payment>
263
+ </sections>
264
  </config>
app/code/local/Cardsave/Checkout/Block/Onepage/Payment/Methods.php CHANGED
@@ -15,7 +15,7 @@ class Cardsave_Checkout_Block_Onepage_Payment_Methods extends Mage_Checkout_Bloc
15
  *
16
  * @return mixed
17
  */
18
- public function getSelectedMethodCode()
19
  {
20
  $method = false;
21
  $model = Mage::getModel('cardsaveonlinepayments/direct');
@@ -31,8 +31,8 @@ class Cardsave_Checkout_Block_Onepage_Payment_Methods extends Mage_Checkout_Bloc
31
  {
32
  $method = 'cardsaveonlinepayments';
33
  }
34
- }*/
35
 
36
  return $method;
37
- }
38
  }
15
  *
16
  * @return mixed
17
  */
18
+ /*public function getSelectedMethodCode()
19
  {
20
  $method = false;
21
  $model = Mage::getModel('cardsaveonlinepayments/direct');
31
  {
32
  $method = 'cardsaveonlinepayments';
33
  }
34
+ }*//*
35
 
36
  return $method;
37
+ }*/
38
  }
app/code/local/Cardsave/Checkout/Model/Type/Onepage.php CHANGED
@@ -1,1097 +1,107 @@
1
- <?php
2
-
3
- class Cardsave_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
4
- {
5
- /**
6
- * Create an order
7
- *
8
- * @return Mage_Checkout_Model_Type_Onepage
9
- */
10
- public function saveOrder()
11
- {
12
- $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
13
-
14
- if($nVersion >= 1600)
15
- {
16
- $this->validate();
17
- $isNewCustomer = false;
18
- switch ($this->getCheckoutMethod())
19
- {
20
- case self::METHOD_GUEST:
21
- $this->_prepareGuestQuote();
22
- break;
23
- case self::METHOD_REGISTER:
24
- $this->_prepareNewCustomerQuote();
25
- $isNewCustomer = true;
26
- break;
27
- default:
28
- $this->_prepareCustomerQuote();
29
- break;
30
- }
31
-
32
- $service = Mage::getModel('sales/service_quote', $this->getQuote());
33
- $service->submitAll();
34
-
35
- if ($isNewCustomer)
36
- {
37
- try
38
- {
39
- $this->_involveNewCustomer();
40
- }
41
- catch (Exception $e)
42
- {
43
- Mage::logException($e);
44
- }
45
- }
46
-
47
- $this->_checkoutSession->setLastQuoteId($this->getQuote()->getId())
48
- ->setLastSuccessQuoteId($this->getQuote()->getId())
49
- ->clearHelperData();
50
-
51
- $order = $service->getOrder();
52
- if ($order)
53
- {
54
- Mage::dispatchEvent('checkout_type_onepage_save_order_after',
55
- array('order'=>$order, 'quote'=>$this->getQuote()));
56
-
57
- /**
58
- * a flag to set that there will be redirect to third party after confirmation
59
- * eg: paypal standard ipn
60
- */
61
- $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
62
- /**
63
- * we only want to send to customer about new order when there is no redirect to third party
64
- */
65
- if (!$redirectUrl && $order->getCanSendNewEmailFlag())
66
- {
67
- try
68
- {
69
- $order->sendNewOrderEmail();
70
- }
71
- catch (Exception $e)
72
- {
73
- Mage::logException($e);
74
- }
75
- }
76
-
77
- // add order information to the session
78
- $this->_checkoutSession->setLastOrderId($order->getId())
79
- ->setRedirectUrl($redirectUrl)
80
- ->setLastRealOrderId($order->getIncrementId());
81
-
82
- // as well a billing agreement can be created
83
- $agreement = $order->getPayment()->getBillingAgreement();
84
- if ($agreement)
85
- {
86
- $this->_checkoutSession->setLastBillingAgreementId($agreement->getId());
87
- }
88
- }
89
-
90
- // add recurring profiles information to the session
91
- $profiles = $service->getRecurringPaymentProfiles();
92
- if ($profiles)
93
- {
94
- $ids = array();
95
- foreach ($profiles as $profile)
96
- {
97
- $ids[] = $profile->getId();
98
- }
99
- $this->_checkoutSession->setLastRecurringProfileIds($ids);
100
- // TODO: send recurring profile emails
101
- }
102
-
103
- Mage::dispatchEvent(
104
- 'checkout_submit_all_after',
105
- array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles)
106
- );
107
- }
108
- else if($nVersion >= 1410)
109
- {
110
- // logic for version 1.4.1.0 and above
111
- $this->validate();
112
- $isNewCustomer = false;
113
-
114
- switch ($this->getCheckoutMethod())
115
- {
116
- case self::METHOD_GUEST:
117
- $this->_prepareGuestQuote();
118
- break;
119
- case self::METHOD_REGISTER:
120
- $this->_prepareNewCustomerQuote();
121
- $isNewCustomer = true;
122
- break;
123
- default:
124
- $this->_prepareCustomerQuote();
125
- break;
126
- }
127
-
128
- $service = Mage::getModel('sales/service_quote', $this->getQuote());
129
- $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
130
-
131
- if(!$redirectUrl ||
132
- $this->getQuote()->getPayment()->getMethodInstance()->getCode() != 'cardsaveonlinepayments')
133
- {
134
- $service->submitAll();
135
- }
136
-
137
- if ($isNewCustomer)
138
- {
139
- try
140
- {
141
- $this->_involveNewCustomer();
142
- }
143
- catch (Exception $e)
144
- {
145
- Mage::logException($e);
146
- }
147
- }
148
-
149
- $this->_checkoutSession->setLastQuoteId($this->getQuote()->getId())
150
- ->setLastSuccessQuoteId($this->getQuote()->getId());
151
- #->clearHelperData();
152
-
153
- $order = $service->getOrder();
154
- if ($order)
155
- {
156
- Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
157
-
158
- /**
159
- * a flag to set that there will be redirect to third party after confirmation
160
- * eg: paypal standard ipn
161
- */
162
- $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
163
- /**
164
- * we only want to send to customer about new order when there is no redirect to third party
165
- */
166
- if(!$redirectUrl)
167
- {
168
- try
169
- {
170
- $order->sendNewOrderEmail();
171
- }
172
- catch (Exception $e)
173
- {
174
- Mage::logException($e);
175
- }
176
- }
177
-
178
- // add order information to the session
179
- $this->_checkoutSession->setLastOrderId($order->getId())
180
- ->setRedirectUrl($redirectUrl)
181
- ->setLastRealOrderId($order->getIncrementId());
182
-
183
- // as well a billing agreement can be created
184
- $agreement = $order->getPayment()->getBillingAgreement();
185
- if ($agreement)
186
- {
187
- $this->_checkoutSession->setLastBillingAgreementId($agreement->getId());
188
- }
189
- }
190
-
191
- // add recurring profiles information to the session
192
- $profiles = $service->getRecurringPaymentProfiles();
193
- if ($profiles)
194
- {
195
- $ids = array();
196
- foreach($profiles as $profile)
197
- {
198
- $ids[] = $profile->getId();
199
- }
200
- $this->_checkoutSession->setLastRecurringProfileIds($ids);
201
- // TODO: send recurring profile emails
202
- }
203
- }
204
- else if($nVersion == 1400 || $nVersion == 1401)
205
- {
206
- // logic for version below 1.4.0.1 and below
207
- $this->validateOrder();
208
- $billing = $this->getQuote()->getBillingAddress();
209
-
210
- if (!$this->getQuote()->isVirtual())
211
- {
212
- $shipping = $this->getQuote()->getShippingAddress();
213
- }
214
-
215
- switch ($this->getQuote()->getCheckoutMethod())
216
- {
217
- case Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST:
218
- if (!$this->getQuote()->isAllowedGuestCheckout())
219
- {
220
- Mage::throwException(Mage::helper('checkout')->__('Sorry, guest checkout is not enabled. Please try again or contact store owner.'));
221
- }
222
- $this->getQuote()->setCustomerId(null)
223
- ->setCustomerEmail($billing->getEmail())
224
- ->setCustomerIsGuest(true)
225
- ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
226
- break;
227
-
228
- case Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER:
229
- $customer = Mage::getModel('customer/customer');
230
-
231
- $customerBilling = $billing->exportCustomerAddress();
232
- $customer->addAddress($customerBilling);
233
-
234
- if (!$this->getQuote()->isVirtual() &&
235
- !$shipping->getSameAsBilling())
236
- {
237
- $customerShipping = $shipping->exportCustomerAddress();
238
- $customer->addAddress($customerShipping);
239
- }
240
-
241
- if ($this->getQuote()->getCustomerDob() &&
242
- !$billing->getCustomerDob())
243
- {
244
- $billing->setCustomerDob($this->getQuote()->getCustomerDob());
245
- }
246
-
247
- Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer);
248
-
249
- $customer->setPassword($customer->decryptPassword($this->getQuote()->getPasswordHash()));
250
- $customer->setPasswordHash($customer->hashPassword($customer->getPassword()));
251
-
252
- $this->getQuote()->setCustomer($customer);
253
- Mage::log(time());
254
- break;
255
-
256
- default:
257
- $customer = Mage::getSingleton('customer/session')->getCustomer();
258
-
259
- if (!$billing->getCustomerId() ||
260
- $billing->getSaveInAddressBook())
261
- {
262
- $customerBilling = $billing->exportCustomerAddress();
263
- $customer->addAddress($customerBilling);
264
- }
265
- if (!$this->getQuote()->isVirtual() &&
266
- ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
267
- (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())))
268
- {
269
- $customerShipping = $shipping->exportCustomerAddress();
270
- $customer->addAddress($customerShipping);
271
- }
272
- $customer->setSavedFromQuote(true);
273
- $customer->save();
274
-
275
- $changed = false;
276
- if (isset($customerBilling) &&
277
- !$customer->getDefaultBilling())
278
- {
279
- $customer->setDefaultBilling($customerBilling->getId());
280
- $changed = true;
281
- }
282
- if (!$this->getQuote()->isVirtual() &&
283
- isset($customerBilling) &&
284
- !$customer->getDefaultShipping() &&
285
- $shipping->getSameAsBilling())
286
- {
287
- $customer->setDefaultShipping($customerBilling->getId());
288
- $changed = true;
289
- }
290
- elseif (!$this->getQuote()->isVirtual() &&
291
- isset($customerShipping) &&
292
- !$customer->getDefaultShipping())
293
- {
294
- $customer->setDefaultShipping($customerShipping->getId());
295
- $changed = true;
296
- }
297
-
298
- if ($changed)
299
- {
300
- $customer->save();
301
- }
302
- }
303
-
304
- $this->getQuote()->reserveOrderId();
305
- $convertQuote = Mage::getModel('sales/convert_quote');
306
- // @var $convertQuote Mage_Sales_Model_Convert_Quote
307
- if ($this->getQuote()->isVirtual())
308
- {
309
- $order = $convertQuote->addressToOrder($billing);
310
- }
311
- else
312
- {
313
- $order = $convertQuote->addressToOrder($shipping);
314
- }
315
- // @var $order Mage_Sales_Model_Order
316
- $order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
317
-
318
- if (!$this->getQuote()->isVirtual())
319
- {
320
- $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
321
- }
322
-
323
- $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
324
-
325
- foreach ($this->getQuote()->getAllItems() as $item)
326
- {
327
- $orderItem = $convertQuote->itemToOrderItem($item);
328
- if ($item->getParentItem())
329
- {
330
- $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
331
- }
332
- $order->addItem($orderItem);
333
- }
334
-
335
- // We can use configuration data for declare new order status
336
- Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$this->getQuote()));
337
- // check again, if customer exists
338
- if ($this->getQuote()->getCheckoutMethod() == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER)
339
- {
340
- if ($this->_customerEmailExists($customer->getEmail(), Mage::app()->getWebsite()->getId()))
341
- {
342
- Mage::throwException(Mage::helper('checkout')->__('There is already a customer registered using this email address'));
343
- }
344
- }
345
-
346
- // clear 3dSecure session variables
347
- Mage::getSingleton('checkout/session')->setThreedsecurerequired(null)
348
- ->setMd(null)
349
- ->setPares(null)
350
- ->setAcsurl(null);
351
-
352
- $order->place();
353
-
354
- if ($this->getQuote()->getCheckoutMethod()==Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER)
355
- {
356
- $customer->save();
357
- $customerBillingId = $customerBilling->getId();
358
- if (!$this->getQuote()->isVirtual())
359
- {
360
- $customerShippingId = isset($customerShipping) ? $customerShipping->getId() : $customerBillingId;
361
- $customer->setDefaultShipping($customerShippingId);
362
- }
363
- $customer->setDefaultBilling($customerBillingId);
364
- $customer->save();
365
-
366
- $this->getQuote()->setCustomerId($customer->getId());
367
-
368
- $order->setCustomerId($customer->getId());
369
- Mage::helper('core')->copyFieldset('customer_account', 'to_order', $customer, $order);
370
-
371
- $billing->setCustomerId($customer->getId())->setCustomerAddressId($customerBillingId);
372
- if (!$this->getQuote()->isVirtual())
373
- {
374
- $shipping->setCustomerId($customer->getId())->setCustomerAddressId($customerShippingId);
375
- }
376
-
377
- if ($customer->isConfirmationRequired())
378
- {
379
- $customer->sendNewAccountEmail('confirmation');
380
- }
381
- else
382
- {
383
- $customer->sendNewAccountEmail();
384
- }
385
- }
386
-
387
- /**
388
- * a flag to set that there will be redirect to third party after confirmation
389
- * eg: paypal standard ipn
390
- */
391
- $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
392
- if(!$redirectUrl)
393
- {
394
- $order->setEmailSent(true);
395
- }
396
-
397
- if(!$redirectUrl ||
398
- $this->getQuote()->getPayment()->getMethodInstance()->getCode() != 'cardsaveonlinepayments')
399
- {
400
- $order->save();
401
- }
402
-
403
- Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
404
-
405
-
406
- /**
407
- * need to have some logic to set order as new status to make sure order is not finished yet
408
- * quote will be still active when we send the customer to paypal
409
- */
410
-
411
- $orderId = $order->getIncrementId();
412
- $this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
413
- $this->getCheckout()->setLastOrderId($order->getId());
414
- $this->getCheckout()->setLastRealOrderId($order->getIncrementId());
415
- $this->getCheckout()->setRedirectUrl($redirectUrl);
416
-
417
- /**
418
- * we only want to send to customer about new order when there is no redirect to third party
419
- */
420
- if(!$redirectUrl)
421
- {
422
- $order->sendNewOrderEmail();
423
- }
424
-
425
- if ($this->getQuote()->getCheckoutMethod(true) == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER &&
426
- !Mage::getSingleton('customer/session')->isLoggedIn())
427
- {
428
- /**
429
- * we need to save quote here to have it saved with Customer Id.
430
- * so when loginById() executes checkout/session method loadCustomerQuote
431
- * it would not create new quotes and merge it with old one.
432
- */
433
- $this->getQuote()->save();
434
- if ($customer->isConfirmationRequired())
435
- {
436
- Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.',
437
- Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())
438
- ));
439
- }
440
- else
441
- {
442
- Mage::getSingleton('customer/session')->loginById($customer->getId());
443
- }
444
- }
445
-
446
- //Setting this one more time like control flag that we haves saved order
447
- //Must be checkout on success page to show it or not.
448
- $this->getCheckout()->setLastSuccessQuoteId($this->getQuote()->getId());
449
-
450
- /*
451
- * Fix for v1.4.1.0 and above - need to comment the below lines
452
- */
453
- //$this->getQuote()->setIsActive(false);
454
- //$this->getQuote()->save();
455
- }
456
- else if($nVersion == 1324 || $nVersion == 1330)
457
- {
458
- $this->validateOrder();
459
- $billing = $this->getQuote()->getBillingAddress();
460
-
461
- if (!$this->getQuote()->isVirtual())
462
- {
463
- $shipping = $this->getQuote()->getShippingAddress();
464
- }
465
-
466
- switch ($this->getQuote()->getCheckoutMethod())
467
- {
468
- case Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST:
469
- if (!$this->getQuote()->isAllowedGuestCheckout())
470
- {
471
- Mage::throwException(Mage::helper('checkout')->__('Sorry, guest checkout is not enabled. Please try again or contact store owner.'));
472
- }
473
- $this->getQuote()->setCustomerId(null)
474
- ->setCustomerEmail($billing->getEmail())
475
- ->setCustomerIsGuest(true)
476
- ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
477
- break;
478
-
479
- case Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER:
480
- $customer = Mage::getModel('customer/customer');
481
-
482
- $customerBilling = $billing->exportCustomerAddress();
483
- $customer->addAddress($customerBilling);
484
-
485
- if (!$this->getQuote()->isVirtual() &&
486
- !$shipping->getSameAsBilling())
487
- {
488
- $customerShipping = $shipping->exportCustomerAddress();
489
- $customer->addAddress($customerShipping);
490
- }
491
-
492
- if ($this->getQuote()->getCustomerDob() &&
493
- !$billing->getCustomerDob())
494
- {
495
- $billing->setCustomerDob($this->getQuote()->getCustomerDob());
496
- }
497
-
498
- if ($this->getQuote()->getCustomerTaxvat() && !$billing->getCustomerTaxvat())
499
- {
500
- $billing->setCustomerTaxvat($this->getQuote()->getCustomerTaxvat());
501
- }
502
-
503
- Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer);
504
-
505
- $customer->setPassword($customer->decryptPassword($this->getQuote()->getPasswordHash()));
506
- $customer->setPasswordHash($customer->hashPassword($customer->getPassword()));
507
-
508
- $this->getQuote()->setCustomer($customer);
509
- Mage::log(time());
510
- break;
511
-
512
- default:
513
- $customer = Mage::getSingleton('customer/session')->getCustomer();
514
-
515
- if (!$billing->getCustomerId() ||
516
- $billing->getSaveInAddressBook())
517
- {
518
- $customerBilling = $billing->exportCustomerAddress();
519
- $customer->addAddress($customerBilling);
520
- }
521
- if (!$this->getQuote()->isVirtual() &&
522
- ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
523
- (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())))
524
- {
525
- $customerShipping = $shipping->exportCustomerAddress();
526
- $customer->addAddress($customerShipping);
527
- }
528
- $customer->setSavedFromQuote(true);
529
- $customer->save();
530
-
531
- $changed = false;
532
- if (isset($customerBilling) &&
533
- !$customer->getDefaultBilling())
534
- {
535
- $customer->setDefaultBilling($customerBilling->getId());
536
- $changed = true;
537
- }
538
- if (!$this->getQuote()->isVirtual() &&
539
- isset($customerBilling) &&
540
- !$customer->getDefaultShipping() &&
541
- $shipping->getSameAsBilling())
542
- {
543
- $customer->setDefaultShipping($customerBilling->getId());
544
- $changed = true;
545
- }
546
- elseif (!$this->getQuote()->isVirtual() &&
547
- isset($customerShipping) &&
548
- !$customer->getDefaultShipping())
549
- {
550
- $customer->setDefaultShipping($customerShipping->getId());
551
- $changed = true;
552
- }
553
-
554
- if ($changed)
555
- {
556
- $customer->save();
557
- }
558
- }
559
-
560
- $this->getQuote()->reserveOrderId();
561
- $convertQuote = Mage::getModel('sales/convert_quote');
562
- // @var $convertQuote Mage_Sales_Model_Convert_Quote
563
- if ($this->getQuote()->isVirtual())
564
- {
565
- $order = $convertQuote->addressToOrder($billing);
566
- }
567
- else
568
- {
569
- $order = $convertQuote->addressToOrder($shipping);
570
- }
571
- // @var $order Mage_Sales_Model_Order
572
- $order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
573
-
574
- if (!$this->getQuote()->isVirtual())
575
- {
576
- $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
577
- }
578
-
579
- $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
580
-
581
- foreach ($this->getQuote()->getAllItems() as $item)
582
- {
583
- $orderItem = $convertQuote->itemToOrderItem($item);
584
- if ($item->getParentItem())
585
- {
586
- $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
587
- }
588
- $order->addItem($orderItem);
589
- }
590
-
591
- // We can use configuration data for declare new order status
592
- Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$this->getQuote()));
593
- // check again, if customer exists
594
- if ($this->getQuote()->getCheckoutMethod() == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER)
595
- {
596
- if ($this->_customerEmailExists($customer->getEmail(), Mage::app()->getWebsite()->getId()))
597
- {
598
- Mage::throwException(Mage::helper('checkout')->__('There is already a customer registered using this email address'));
599
- }
600
- }
601
-
602
- // clear 3dSecure session variables
603
- Mage::getSingleton('checkout/session')->setThreedsecurerequired(null);
604
- Mage::getSingleton('checkout/session')->setMd(null);
605
- Mage::getSingleton('checkout/session')->setPares(null);
606
- Mage::getSingleton('checkout/session')->setAcsurl(null);
607
-
608
- $order->place();
609
-
610
- if ($this->getQuote()->getCheckoutMethod()==Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER)
611
- {
612
- $customer->save();
613
- $customerBillingId = $customerBilling->getId();
614
- if (!$this->getQuote()->isVirtual())
615
- {
616
- $customerShippingId = isset($customerShipping) ? $customerShipping->getId() : $customerBillingId;
617
- $customer->setDefaultShipping($customerShippingId);
618
- }
619
- $customer->setDefaultBilling($customerBillingId);
620
- $customer->save();
621
-
622
- $this->getQuote()->setCustomerId($customer->getId());
623
-
624
- $order->setCustomerId($customer->getId());
625
- Mage::helper('core')->copyFieldset('customer_account', 'to_order', $customer, $order);
626
-
627
- $billing->setCustomerId($customer->getId())->setCustomerAddressId($customerBillingId);
628
- if (!$this->getQuote()->isVirtual())
629
- {
630
- $shipping->setCustomerId($customer->getId())->setCustomerAddressId($customerShippingId);
631
- }
632
-
633
- if ($customer->isConfirmationRequired())
634
- {
635
- $customer->sendNewAccountEmail('confirmation');
636
- }
637
- else
638
- {
639
- $customer->sendNewAccountEmail();
640
- }
641
- }
642
-
643
- /**
644
- * a flag to set that there will be redirect to third party after confirmation
645
- * eg: paypal standard ipn
646
- */
647
- $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
648
- if(!$redirectUrl)
649
- {
650
- $order->setEmailSent(true);
651
- }
652
-
653
- if(!$redirectUrl ||
654
- $this->getQuote()->getPayment()->getMethodInstance()->getCode() != 'cardsaveonlinepayments')
655
- {
656
- $order->save();
657
- }
658
-
659
- Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
660
-
661
-
662
- /**
663
- * need to have somelogic to set order as new status to make sure order is not finished yet
664
- * quote will be still active when we send the customer to paypal
665
- */
666
-
667
- $orderId = $order->getIncrementId();
668
- $this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
669
- $this->getCheckout()->setLastOrderId($order->getId());
670
- $this->getCheckout()->setLastRealOrderId($order->getIncrementId());
671
- $this->getCheckout()->setRedirectUrl($redirectUrl);
672
-
673
- /**
674
- * we only want to send to customer about new order when there is no redirect to third party
675
- */
676
- if(!$redirectUrl)
677
- {
678
- $order->sendNewOrderEmail();
679
- }
680
-
681
- if ($this->getQuote()->getCheckoutMethod(true) == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER &&
682
- !Mage::getSingleton('customer/session')->isLoggedIn())
683
- {
684
- /**
685
- * we need to save quote here to have it saved with Customer Id.
686
- * so when loginById() executes checkout/session method loadCustomerQuote
687
- * it would not create new quotes and merge it with old one.
688
- */
689
- $this->getQuote()->save();
690
- if ($customer->isConfirmationRequired())
691
- {
692
- Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.',
693
- Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())
694
- ));
695
- }
696
- else
697
- {
698
- Mage::getSingleton('customer/session')->loginById($customer->getId());
699
- }
700
- }
701
-
702
- //Setting this one more time like control flag that we haves saved order
703
- //Must be checkout on success page to show it or not.
704
- $this->getCheckout()->setLastSuccessQuoteId($this->getQuote()->getId());
705
-
706
- $this->getQuote()->setIsActive(false);
707
- $this->getQuote()->save();
708
- }
709
-
710
- return $this;
711
- }
712
-
713
- /**
714
- * Create an order for a Direct (API) 3D Secure enabled payment on the callback
715
- *
716
- * @param unknown_type $pares
717
- * @param unknown_type $md
718
- * @return unknown
719
- */
720
- public function saveOrderAfter3dSecure($pares, $md)
721
- {
722
- $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
723
- $orderId;
724
-
725
- if($nVersion >= 1410)
726
- {
727
- $orderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
728
- $_order = Mage::getModel('sales/order')->load($orderId);
729
-
730
- if(!$_order->getId())
731
- {
732
- Mage::throwException('Could not load order.');
733
- }
734
-
735
- Mage::getSingleton('checkout/session')->setThreedsecurerequired(true)
736
- ->setMd($md)
737
- ->setPares($pares);
738
-
739
- $method = Mage::getSingleton('checkout/session')->getRedirectionmethod();
740
- $_order->getPayment()->getMethodInstance()->{$method}($_order->getPayment(), $pares, $md);
741
-
742
- if ($_order->getFailedThreed() !== true &&
743
- $_order->getPayment()->getMethodInstance()->getCode() == 'cardsaveonlinepayments' &&
744
- $_order->getStatus() != 'pending')
745
- {
746
- $order_status = Mage::getStoreConfig('payment/cardsaveonlinepayments/order_status', Mage::app()->getStore()->getId());
747
- $_order->addStatusToHistory($order_status);
748
- $_order->setStatus($order_status);
749
- }
750
-
751
- $_order->save();
752
-
753
- Mage::getSingleton('checkout/session')->setThreedsecurerequired(null)
754
- ->setMd(null)
755
- ->setPareq(null)
756
- ->setAcsurl(null)
757
- ->setCardsaveonlinepaymentsOrderId(null);
758
- }
759
- else if($nVersion == 1400 || $nVersion == 1401 || $nVersion == 1324 || $nVersion == 1330)
760
- {
761
- $this->validateOrder();
762
- $billing = $this->getQuote()->getBillingAddress();
763
- if (!$this->getQuote()->isVirtual())
764
- {
765
- $shipping = $this->getQuote()->getShippingAddress();
766
- }
767
-
768
- switch ($this->getQuote()->getCheckoutMethod())
769
- {
770
- case 'guest':
771
- $this->getQuote()->setCustomerEmail($billing->getEmail())
772
- ->setCustomerIsGuest(true)
773
- ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
774
- break;
775
-
776
- default:
777
- $customer = Mage::getSingleton('customer/session')->getCustomer();
778
-
779
- if (!$billing->getCustomerId() ||
780
- $billing->getSaveInAddressBook())
781
- {
782
- $customerBilling = $billing->exportCustomerAddress();
783
- $customer->addAddress($customerBilling);
784
- }
785
- if (!$this->getQuote()->isVirtual() &&
786
- ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
787
- (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())))
788
- {
789
- $customerShipping = $shipping->exportCustomerAddress();
790
- $customer->addAddress($customerShipping);
791
- }
792
- $customer->setSavedFromQuote(true);
793
- $customer->save();
794
-
795
- $changed = false;
796
- if (isset($customerBilling) &&
797
- !$customer->getDefaultBilling())
798
- {
799
- $customer->setDefaultBilling($customerBilling->getId());
800
- $changed = true;
801
- }
802
- if (!$this->getQuote()->isVirtual() &&
803
- isset($customerBilling) &&
804
- !$customer->getDefaultShipping() &&
805
- $shipping->getSameAsBilling())
806
- {
807
- $customer->setDefaultShipping($customerBilling->getId());
808
- $changed = true;
809
- }
810
- elseif (!$this->getQuote()->isVirtual() &&
811
- isset($customerShipping) &&
812
- !$customer->getDefaultShipping())
813
- {
814
- $customer->setDefaultShipping($customerShipping->getId());
815
- $changed = true;
816
- }
817
-
818
- if ($changed)
819
- {
820
- $customer->save();
821
- }
822
- }
823
-
824
- $this->getQuote()->reserveOrderId();
825
- $convertQuote = Mage::getModel('sales/convert_quote');
826
- // @var $convertQuote Mage_Sales_Model_Convert_Quote
827
- if ($this->getQuote()->isVirtual())
828
- {
829
- $order = $convertQuote->addressToOrder($billing);
830
- }
831
- else
832
- {
833
- $order = $convertQuote->addressToOrder($shipping);
834
- }
835
- /* @var $order Mage_Sales_Model_Order */
836
- $order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
837
-
838
- if (!$this->getQuote()->isVirtual())
839
- {
840
- $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
841
- }
842
-
843
- $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
844
-
845
- foreach ($this->getQuote()->getAllItems() as $item)
846
- {
847
- $order->addItem($convertQuote->itemToOrderItem($item));
848
- }
849
-
850
- /**
851
- * We can use configuration data for declare new order status
852
- */
853
- Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$this->getQuote()));
854
-
855
- Mage::getSingleton('checkout/session')->setThreedsecurerequired(true)
856
- ->setMd($md)
857
- ->setPares($pares);
858
-
859
- $order->place();
860
-
861
- if ( $order->getPayment()->getMethodInstance()->getCode() == 'cardsaveonlinepayments' &&
862
- $order->getStatus() != 'pending' )
863
- {
864
- $order_status = Mage::getStoreConfig('payment/cardsaveonlinepayments/order_status', Mage::app()->getStore()->getId());
865
-
866
- $order->addStatusToHistory($order_status);
867
- $order->setStatus($order_status);
868
- }
869
-
870
- $order->save();
871
-
872
- Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
873
-
874
-
875
- $this->getQuote()->setIsActive(false);
876
- $this->getQuote()->save();
877
-
878
- $orderId = $order->getIncrementId();
879
- $this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
880
- $this->getCheckout()->setLastOrderId($order->getId());
881
- $this->getCheckout()->setLastRealOrderId($order->getIncrementId());
882
- // $this->getCheckout()->setRedirectUrl($redirectUrl);
883
-
884
- /**
885
- * we only want to send to customer about new order when there is no redirect to third party
886
- */
887
- /*if(!$redirectUrl){
888
- $order->sendNewOrderEmail();
889
- }*/
890
-
891
- if ($this->getQuote()->getCheckoutMethod() == 'register')
892
- {
893
- Mage::getSingleton('customer/session')->loginById($customer->getId());
894
- }
895
- }
896
- return $this;
897
- }
898
-
899
- /**
900
- * Create an order for a Hosted Payment Form/Transparent Redirect payment on the callback
901
- *
902
- * @param unknown_type $boIsHostedPaymentAction
903
- * @param unknown_type $szStatusCode
904
- * @param unknown_type $szMessage
905
- * @param unknown_type $szPreviousStatusCode
906
- * @param unknown_type $szPreviousMessage
907
- * @param unknown_type $szOrderID
908
- * @return unknown
909
- */
910
- public function saveOrderAfterRedirectedPaymentAction($boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID, $szCrossReference)
911
- {
912
- $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
913
-
914
- if($nVersion >= 1410)
915
- {
916
- $_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId());
917
-
918
- if(!$_order->getId())
919
- {
920
- Mage::throwException('Could not load order.');
921
- }
922
-
923
- Mage::getSingleton('checkout/session')->setRedirectedpayment(true)
924
- ->setIshostedpayment($boIsHostedPaymentAction)
925
- ->setStatuscode($szStatusCode)
926
- ->setMessage($szMessage)
927
- ->setPreviousstatuscode($szPreviousStatusCode)
928
- ->setPreviousmessage($szPreviousMessage)
929
- ->setOrderid($szOrderID);
930
-
931
- $method = Mage::getSingleton('checkout/session')->getRedirectionmethod();
932
- $_order->getPayment()->getMethodInstance()->{$method}($_order->getPayment(), $boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID, $szCrossReference);
933
-
934
- if ($_order->getFailedThreed() !== true &&
935
- $_order->getPayment()->getMethodInstance()->getCode() == 'cardsaveonlinepayments' &&
936
- $_order->getStatus() != 'pending')
937
- {
938
- $order_status = Mage::getStoreConfig('payment/cardsaveonlinepayments/order_status', Mage::app()->getStore()->getId());
939
- $_order->addStatusToHistory($order_status);
940
- $_order->setStatus($order_status);
941
- }
942
-
943
- $_order->save();
944
-
945
- Mage::getSingleton('checkout/session')->setRedirectedpayment(null)
946
- ->setIshostedpayment(null)
947
- ->setStatuscode(null)
948
- ->setMessage(null)
949
- ->setPreviousstatuscode(null)
950
- ->setPreviousmessage(null)
951
- ->setOrderid(null)
952
- ->setCardsaveonlinepaymentsOrderId(null);
953
- }
954
- else if($nVersion == 1400 || $nVersion == 1401 || $nVersion == 1324 || $nVersion == 1330)
955
- {
956
- $this->validateOrder();
957
- $billing = $this->getQuote()->getBillingAddress();
958
-
959
- if (!$this->getQuote()->isVirtual())
960
- {
961
- $shipping = $this->getQuote()->getShippingAddress();
962
- }
963
-
964
- switch ($this->getQuote()->getCheckoutMethod())
965
- {
966
- case 'guest':
967
- $this->getQuote()->setCustomerEmail($billing->getEmail())
968
- ->setCustomerIsGuest(true)
969
- ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
970
- break;
971
-
972
- default:
973
- $customer = Mage::getSingleton('customer/session')->getCustomer();
974
-
975
- if (!$billing->getCustomerId() ||
976
- $billing->getSaveInAddressBook())
977
- {
978
- $customerBilling = $billing->exportCustomerAddress();
979
- $customer->addAddress($customerBilling);
980
- }
981
- if (!$this->getQuote()->isVirtual() &&
982
- ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
983
- (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())))
984
- {
985
- $customerShipping = $shipping->exportCustomerAddress();
986
- $customer->addAddress($customerShipping);
987
- }
988
- $customer->setSavedFromQuote(true);
989
- $customer->save();
990
-
991
- $changed = false;
992
- if (isset($customerBilling) &&
993
- !$customer->getDefaultBilling())
994
- {
995
- $customer->setDefaultBilling($customerBilling->getId());
996
- $changed = true;
997
- }
998
- if (!$this->getQuote()->isVirtual() &&
999
- isset($customerBilling) &&
1000
- !$customer->getDefaultShipping() &&
1001
- $shipping->getSameAsBilling())
1002
- {
1003
- $customer->setDefaultShipping($customerBilling->getId());
1004
- $changed = true;
1005
- }
1006
- elseif (!$this->getQuote()->isVirtual() &&
1007
- isset($customerShipping) &&
1008
- !$customer->getDefaultShipping())
1009
- {
1010
- $customer->setDefaultShipping($customerShipping->getId());
1011
- $changed = true;
1012
- }
1013
-
1014
- if ($changed)
1015
- {
1016
- $customer->save();
1017
- }
1018
- }
1019
-
1020
- $this->getQuote()->reserveOrderId();
1021
- $convertQuote = Mage::getModel('sales/convert_quote');
1022
- // @var $convertQuote Mage_Sales_Model_Convert_Quote
1023
- if ($this->getQuote()->isVirtual())
1024
- {
1025
- $order = $convertQuote->addressToOrder($billing);
1026
- }
1027
- else
1028
- {
1029
- $order = $convertQuote->addressToOrder($shipping);
1030
- }
1031
- /* @var $order Mage_Sales_Model_Order */
1032
- $order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
1033
-
1034
- if (!$this->getQuote()->isVirtual())
1035
- {
1036
- $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
1037
- }
1038
-
1039
- $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
1040
-
1041
- foreach ($this->getQuote()->getAllItems() as $item)
1042
- {
1043
- $order->addItem($convertQuote->itemToOrderItem($item));
1044
- }
1045
-
1046
- /**
1047
- * We can use configuration data for declare new order status
1048
- */
1049
- Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$this->getQuote()));
1050
-
1051
- Mage::getSingleton('checkout/session')->setRedirectedpayment(true)
1052
- ->setIshostedpayment($boIsHostedPaymentAction)
1053
- ->setStatuscode($szStatusCode)
1054
- ->setMessage($szMessage)
1055
- ->setPreviousstatuscode($szPreviousStatusCode)
1056
- ->setPreviousmessage($szPreviousMessage)
1057
- ->setOrderid($szOrderID);
1058
-
1059
- $order->place();
1060
-
1061
- if ( $order->getPayment()->getMethodInstance()->getCode() == 'cardsaveonlinepayments' &&
1062
- $order->getStatus() != 'pending' )
1063
- {
1064
- $order_status = Mage::getStoreConfig('payment/cardsaveonlinepayments/order_status', Mage::app()->getStore()->getId());
1065
-
1066
- $order->addStatusToHistory($order_status);
1067
- $order->setStatus($order_status);
1068
- }
1069
-
1070
- $order->save();
1071
-
1072
- Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
1073
-
1074
- $this->getQuote()->setIsActive(false);
1075
- $this->getQuote()->save();
1076
-
1077
- $orderId = $order->getIncrementId();
1078
- $this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
1079
- $this->getCheckout()->setLastOrderId($order->getId());
1080
- $this->getCheckout()->setLastRealOrderId($order->getIncrementId());
1081
-
1082
- /**
1083
- * we only want to send to customer about new order when there is no redirect to third party
1084
- */
1085
- //if(!$redirectUrl){
1086
- $order->sendNewOrderEmail();
1087
- //}
1088
-
1089
- if ($this->getQuote()->getCheckoutMethod()=='register')
1090
- {
1091
- Mage::getSingleton('customer/session')->loginById($customer->getId());
1092
- }
1093
- }
1094
-
1095
- return $this;
1096
- }
1097
  }
1
+ <?php
2
+
3
+ class Cardsave_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
4
+ {
5
+ /**
6
+ * Create an order for a Direct (API) 3D Secure enabled payment on the callback
7
+ *
8
+ * @param unknown_type $pares
9
+ * @param unknown_type $md
10
+ * @return unknown
11
+ */
12
+ public function saveOrderAfter3dSecure($pares, $md)
13
+ {
14
+ $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
15
+ $orderId;
16
+
17
+ $orderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
18
+ $_order = Mage::getModel('sales/order')->load($orderId);
19
+
20
+ if(!$_order->getId())
21
+ {
22
+ Mage::throwException('Could not load order.');
23
+ }
24
+
25
+ Mage::getSingleton('checkout/session')->setThreedsecurerequired(true)
26
+ ->setMd($md)
27
+ ->setPares($pares);
28
+
29
+ $method = Mage::getSingleton('checkout/session')->getRedirectionmethod();
30
+ $_order->getPayment()->getMethodInstance()->{$method}($_order->getPayment(), $pares, $md);
31
+
32
+ if ($_order->getFailedThreed() !== true &&
33
+ $_order->getPayment()->getMethodInstance()->getCode() == 'cardsaveonlinepayments' &&
34
+ $_order->getStatus() != 'pending')
35
+ {
36
+ $order_status = Mage::getStoreConfig('payment/cardsaveonlinepayments/order_status', Mage::app()->getStore()->getId());
37
+ $_order->addStatusToHistory($order_status);
38
+ $_order->setStatus($order_status);
39
+ }
40
+
41
+ $_order->save();
42
+
43
+ Mage::getSingleton('checkout/session')->setThreedsecurerequired(null)
44
+ ->setMd(null)
45
+ ->setPareq(null)
46
+ ->setAcsurl(null)
47
+ ->setCardsaveonlinepaymentsOrderId(null);
48
+
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * Create an order for a Hosted Payment Form/Transparent Redirect payment on the callback
54
+ *
55
+ * @param unknown_type $boIsHostedPaymentAction
56
+ * @param unknown_type $szStatusCode
57
+ * @param unknown_type $szMessage
58
+ * @param unknown_type $szPreviousStatusCode
59
+ * @param unknown_type $szPreviousMessage
60
+ * @param unknown_type $szOrderID
61
+ * @return unknown
62
+ */
63
+ public function saveOrderAfterRedirectedPaymentAction($boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID, $szCrossReference)
64
+ {
65
+ $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
66
+
67
+ $_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId());
68
+
69
+ if(!$_order->getId())
70
+ {
71
+ Mage::throwException('Could not load order.');
72
+ }
73
+
74
+ Mage::getSingleton('checkout/session')->setRedirectedpayment(true)
75
+ ->setIshostedpayment($boIsHostedPaymentAction)
76
+ ->setStatuscode($szStatusCode)
77
+ ->setMessage($szMessage)
78
+ ->setPreviousstatuscode($szPreviousStatusCode)
79
+ ->setPreviousmessage($szPreviousMessage)
80
+ ->setOrderid($szOrderID);
81
+
82
+ $method = Mage::getSingleton('checkout/session')->getRedirectionmethod();
83
+ $_order->getPayment()->getMethodInstance()->{$method}($_order->getPayment(), $boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID, $szCrossReference);
84
+
85
+ if ($_order->getFailedThreed() !== true &&
86
+ $_order->getPayment()->getMethodInstance()->getCode() == 'cardsaveonlinepayments' &&
87
+ $_order->getStatus() != 'pending')
88
+ {
89
+ $order_status = Mage::getStoreConfig('payment/cardsaveonlinepayments/order_status', Mage::app()->getStore()->getId());
90
+ $_order->addStatusToHistory($order_status);
91
+ $_order->setStatus($order_status);
92
+ }
93
+
94
+ $_order->save();
95
+
96
+ Mage::getSingleton('checkout/session')->setRedirectedpayment(null)
97
+ ->setIshostedpayment(null)
98
+ ->setStatuscode(null)
99
+ ->setMessage(null)
100
+ ->setPreviousstatuscode(null)
101
+ ->setPreviousmessage(null)
102
+ ->setOrderid(null)
103
+ ->setCardsaveonlinepaymentsOrderId(null);
104
+
105
+ return $this;
106
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
app/code/local/Cardsave/Sales/Model/Order.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class Cardsave_Sales_Model_Order extends Mage_Sales_Model_Order
4
  {
5
- protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
6
  {
7
  // attempt to set the specified state
8
  if ($shouldProtectState)
@@ -28,5 +28,5 @@ class Cardsave_Sales_Model_Order extends Mage_Sales_Model_Order
28
  $history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility
29
  }
30
  return $this;
31
- }
32
  }
2
 
3
  class Cardsave_Sales_Model_Order extends Mage_Sales_Model_Order
4
  {
5
+ /*protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
6
  {
7
  // attempt to set the specified state
8
  if ($shouldProtectState)
28
  $history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility
29
  }
30
  return $this;
31
+ }*/
32
  }
app/code/local/Cardsave/Sales/Model/Order/Payment.php CHANGED
@@ -1,171 +1,7 @@
1
  <?php
2
 
3
  class Cardsave_Sales_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
4
- {
5
- /**
6
- * Capture payment
7
- *
8
- * @return Mage_Sales_Model_Order_Payment
9
- */
10
- public function capture($invoice)
11
- {
12
- $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
13
-
14
- if($nVersion >= 1411 || $nVersion == 1410)
15
- {
16
- if (is_null($invoice))
17
- {
18
- $invoice = $this->_invoice();
19
- $this->setCreatedInvoice($invoice);
20
- return $this; // @see Mage_Sales_Model_Order_Invoice::capture()
21
- }
22
- $amountToCapture = $this->_formatAmount($invoice->getBaseGrandTotal());
23
- $order = $this->getOrder();
24
-
25
- // prepare parent transaction and its amount
26
- $paidWorkaround = 0;
27
- if (!$invoice->wasPayCalled())
28
- {
29
- $paidWorkaround = (float)$amountToCapture;
30
- }
31
- $this->_isCaptureFinal($paidWorkaround);
32
-
33
- $this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $this->getAuthorizationTransaction());
34
-
35
- Mage::dispatchEvent('sales_order_payment_capture', array('payment' => $this, 'invoice' => $invoice));
36
-
37
- /**
38
- * Fetch an update about existing transaction. It can determine whether the transaction can be paid
39
- * Capture attempt will happen only when invoice is not yet paid and the transaction can be paid
40
- */
41
- if ($invoice->getTransactionId())
42
- {
43
- $this->getMethodInstance()->setStore($order->getStoreId())->fetchTransactionInfo($this, $invoice->getTransactionId());
44
- }
45
- $status = true;
46
- if (!$invoice->getIsPaid() && !$this->getIsTransactionPending())
47
- {
48
- // attempt to capture: this can trigger "is_transaction_pending"
49
- $this->getMethodInstance()->setStore($order->getStoreId())->capture($this, $amountToCapture);
50
-
51
- $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true);
52
-
53
- if ($this->getIsTransactionPending())
54
- {
55
- $message = Mage::helper('sales')->__('Capturing amount of %s is pending approval on gateway.', $this->_formatPrice($amountToCapture));
56
- $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
57
- if ($this->getIsFraudDetected())
58
- {
59
- $status = 'fraud';
60
- }
61
- $invoice->setIsPaid(false);
62
- }
63
- else
64
- { // normal online capture: invoice is marked as "paid"
65
- $message = Mage::helper('sales')->__('Captured amount of %s online.', $this->_formatPrice($amountToCapture));
66
- $state = Mage_Sales_Model_Order::STATE_PROCESSING;
67
- $invoice->setIsPaid(true);
68
- $this->_updateTotals(array('base_amount_paid_online' => $amountToCapture));
69
- }
70
- if ($order->isNominal())
71
- {
72
- $message = $this->_prependMessage(Mage::helper('sales')->__('Nominal order registered.'));
73
- }
74
- else
75
- {
76
- $message = $this->_prependMessage($message);
77
- $message = $this->_appendTransactionToMessage($transaction, $message);
78
- }
79
- $order->setState($state, $status, $message);
80
- $this->getMethodInstance()->processInvoice($invoice, $this); // should be deprecated
81
- return $this;
82
- }
83
- Mage::throwException(Mage::helper('sales')->__('The transaction "%s" cannot be captured yet.', $invoice->getTransactionId()));
84
- }
85
- if($nVersion == 1400 || $nVersion == 1401)
86
- {
87
- if (is_null($invoice))
88
- {
89
- $invoice = $this->_invoice();
90
- $this->setCreatedInvoice($invoice);
91
- return $this; // @see Mage_Sales_Model_Order_Invoice::capture()
92
- }
93
- $amountToCapture = $this->_formatAmount($invoice->getBaseGrandTotal());
94
-
95
- $paidWorkaround = 0;
96
- if (!$invoice->wasPayCalled())
97
- {
98
- $paidWorkaround = (float)$amountToCapture;
99
- }
100
- $this->_isCaptureFinal($paidWorkaround);
101
- $baseTransaction = false;
102
- if ($invoice->getTransactionId())
103
- {
104
- $baseTransaction = $this->_lookupTransaction($invoice->getTransactionId());
105
- }
106
- else
107
- {
108
- $baseTransaction = $this->getAuthorizationTransaction();
109
- }
110
- $this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $baseTransaction);
111
-
112
- Mage::dispatchEvent('sales_order_payment_capture', array('payment' => $this, 'invoice' => $invoice));
113
-
114
- $this->getMethodInstance()
115
- ->setStore($this->getOrder()->getStoreId())
116
- ->capture($this, $amountToCapture);
117
-
118
- // update transactions, set order state (order will close itself if required)
119
- $transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true);
120
- /**
121
- * Check if payment transaction is under pending state.
122
- * Gateway can accept peyment transaction but mark it as pending.
123
- * We need hold such kind of orders
124
- */
125
- if ($this->getIsTransactionPending())
126
- {
127
- $message = Mage::helper('sales')->__('Amount of %s pending approval on gateway.', $this->_formatPrice($amountToCapture));
128
- $message = $this->_prependMessage($message);
129
- $message = $this->_appendTransactionToMessage($transaction, $message);
130
- $status = $this->getTransactionPendingStatus() ? $this->getTransactionPendingStatus() : true;
131
- $this->getOrder()->setState(Mage_Sales_Model_Order::STATE_HOLDED, $status, $message);
132
- $invoice->setIsPaid(false);
133
- }
134
- else
135
- {
136
- $this->_updateTotals(array('base_amount_paid_online' => $amountToCapture));
137
- $message = Mage::helper('sales')->__('Captured amount of %s online.', $this->_formatPrice($amountToCapture));
138
- $message = $this->_prependMessage($message);
139
- $message = $this->_appendTransactionToMessage($transaction, $message);
140
- $this->getOrder()->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
141
- $invoice->setIsPaid(true);
142
- }
143
-
144
- $this->getMethodInstance()->processInvoice($invoice, $this); // should be deprecated
145
- return $this;
146
- }
147
- if($nVersion == 1324 || $nVersion == 1330)
148
- {
149
- if (is_null($invoice))
150
- {
151
- $invoice = $this->_invoice();
152
- }
153
-
154
- Mage::dispatchEvent('sales_order_payment_capture', array('payment' => $this, 'invoice' => $invoice));
155
-
156
- $this->getMethodInstance()
157
- ->setStore($this->getOrder()->getStoreId())
158
- ->capture($this, sprintf('%.2f', $invoice->getBaseGrandTotal()));
159
- if($this->getIsInvoicePaid())
160
- {
161
- $invoice->setIsPaid(true);
162
- }
163
- $this->getMethodInstance()->processInvoice($invoice, $this);
164
-
165
- return $this;
166
- }
167
- }
168
-
169
  /**
170
  * Authorize or authorize and capture payment on gateway, if applicable
171
  * This method is supposed to be called only when order is placed
@@ -173,381 +9,114 @@ class Cardsave_Sales_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
173
  * @return Mage_Sales_Model_Order_Payment
174
  */
175
  public function place()
176
- {
177
- $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
178
- $paymentAction = Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('payment_action');
179
-
180
- if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE)
181
- {
182
- $csvOrderStatus = "csv_paid";
183
- }
184
- else if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE)
185
- {
186
- $csvOrderStatus = "csv_preauth";
187
- }
188
- else
189
- {
190
- $csvOrderStatus = null;
191
- }
192
-
193
- if($nVersion >= 1411 || $nVersion == 1410 || $nVersion == 1401 || $nVersion == 1400)
194
- {
195
- Mage::dispatchEvent('sales_order_payment_place_start', array('payment' => $this));
196
- $order = $this->getOrder();
197
-
198
- $this->setAmountOrdered($order->getTotalDue());
199
- $this->setBaseAmountOrdered($order->getBaseTotalDue());
200
- $this->setShippingAmount($order->getShippingAmount());
201
- $this->setBaseShippingAmount($order->getBaseShippingAmount());
202
-
203
- $methodInstance = $this->getMethodInstance();
204
- $methodInstance->setStore($order->getStoreId());
205
-
206
- $orderState = Mage_Sales_Model_Order::STATE_NEW;
207
- $orderStatus= false;
208
-
209
- $stateObject = new Varien_Object();
210
-
211
- /**
212
- * Do order payment validation on payment method level
213
- */
214
- $methodInstance->validate();
215
- $action = $methodInstance->getConfigPaymentAction();
216
- if ($action)
217
- {
218
- if ($methodInstance->isInitializeNeeded())
219
- {
220
- /**
221
- * For method initialization we have to use original config value for payment action
222
- */
223
- $methodInstance->initialize($methodInstance->getConfigData('payment_action'), $stateObject);
224
- }
225
- else
226
- {
227
- $orderState = Mage_Sales_Model_Order::STATE_PROCESSING;
228
- switch ($action)
229
- {
230
- case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
231
- $this->_authorize(true, $order->getBaseTotalDue()); // base amount will be set inside
232
- $this->setAmountAuthorized($order->getTotalDue());
233
- break;
234
- case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
235
- $this->setAmountAuthorized($order->getTotalDue());
236
- $this->setBaseAmountAuthorized($order->getBaseTotalDue());
237
- $this->capture(null);
238
- break;
239
- default:
240
- break;
241
- }
242
- }
243
- }
244
-
245
- if($nVersion >= 1411 || $nVersion == 1410)
246
- {
247
- $this->_createBillingAgreement();
248
- $orderStateHelper = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
249
- }
250
- else
251
- {
252
- $orderStateHelper = Mage_Sales_Model_Order::STATE_HOLDED;
253
- }
254
-
255
- $orderIsNotified = null;
256
- if ($stateObject->getState() && $stateObject->getStatus())
257
- {
258
- $orderState = $stateObject->getState();
259
- if($csvOrderStatus == null)
260
- {
261
- $orderStatus = $stateObject->getStatus();
262
- }
263
- else
264
- {
265
- $orderStatus = $csvOrderStatus;
266
- }
267
- $orderIsNotified = $stateObject->getIsNotified();
268
- }
269
- else if($order->getIsThreeDSecurePending())
270
- {
271
- $orderState = 'pending_payment';
272
- $orderStatus = 'csv_pending_threed_secure';
273
- $message = '3D Secure authentication need to be completed';
274
- $orderIsNotified = false;
275
- }
276
- else if($order->getIsHostedPaymentPending())
277
- {
278
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true)->save();
279
- $orderStateHelper = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
280
- $orderState = 'pending_payment';
281
- $orderStatus = 'csv_pending_hosted_payment';
282
- $message = 'Hosted Payment need to be completed';
283
- $orderIsNotified = false;
284
- }
285
- else
286
- {
287
- if($csvOrderStatus == null)
288
- {
289
- $orderStatus = $methodInstance->getConfigData('order_status');
290
- if (!$orderStatus || $order->getIsVirtual())
291
- {
292
- $orderStatus = $order->getConfig()->getStateDefaultStatus($orderState);
293
- }
294
- }
295
- else
296
- {
297
- $orderStatus = $csvOrderStatus;
298
- }
299
- }
300
-
301
- $isCustomerNotified = (null !== $orderIsNotified) ? $orderIsNotified : $order->getCustomerNoteNotify();
302
- //$message = $order->getCustomerNote();
303
- if(!$order->getIsThreeDSecurePending() &&
304
- !$order->getIsHostedPaymentPending())
305
- {
306
- $message = $order->getCustomerNote();
307
- }
308
-
309
- // add message if order was put into review during authorization or capture
310
- //if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW)$orderState
311
- if ($order->getState() == $orderStateHelper)
312
- {
313
- if ($message)
314
- {
315
- $order->addStatusToHistory($order->getStatus(), $message, $isCustomerNotified);
316
- }
317
-
318
- if($nVersion >= 1400 || $nVersion == 1401)
319
- {
320
- $order->setHoldBeforeState($orderState);
321
- $order->setHoldBeforeStatus($orderStatus);
322
- }
323
- }
324
- // add message to history if order state already declared
325
- elseif ($order->getState() && ($orderStatus !== $order->getStatus() || $message))
326
- {
327
- $order->setState($orderState, $orderStatus, $message, $isCustomerNotified);
328
- }
329
- // set order state
330
- elseif (($order->getState() != $orderState) || ($order->getStatus() != $orderStatus) || $message)
331
- {
332
- $order->setState($orderState, $orderStatus, $message, $isCustomerNotified);
333
- }
334
-
335
- Mage::dispatchEvent('sales_order_payment_place_end', array('payment' => $this));
336
-
337
- return $this;
338
- }
339
- if($nVersion == 1324 || $nVersion == 1330)
340
- {
341
- Mage::dispatchEvent('sales_order_payment_place_start', array('payment' => $this));
342
-
343
- $this->setAmountOrdered($this->getOrder()->getTotalDue());
344
- $this->setBaseAmountOrdered($this->getOrder()->getBaseTotalDue());
345
-
346
- $this->setShippingAmount($this->getOrder()->getShippingAmount());
347
- $this->setBaseShippingAmount($this->getOrder()->getBaseShippingAmount());
348
-
349
- $methodInstance = $this->getMethodInstance()->setStore($this->getOrder()->getStoreId());
350
-
351
- $orderState = Mage_Sales_Model_Order::STATE_NEW;
352
- $orderStatus= false;
353
-
354
- $stateObject = new Varien_Object();
355
-
356
- /**
357
- * validating payment method again
358
- */
359
- $methodInstance->validate();
360
- if ($action = $methodInstance->getConfigData('payment_action')) {
361
- /**
362
- * Run action declared for payment method in configuration
363
- */
364
-
365
- if ($methodInstance->isInitializeNeeded()) {
366
- $methodInstance->initialize($action, $stateObject);
367
- } else {
368
- switch ($action) {
369
- case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
370
- case Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH:
371
- $methodInstance->authorize($this, $this->getOrder()->getBaseTotalDue());
372
-
373
- $this->setAmountAuthorized($this->getOrder()->getTotalDue());
374
- $this->setBaseAmountAuthorized($this->getOrder()->getBaseTotalDue());
375
-
376
- $orderState = Mage_Sales_Model_Order::STATE_PROCESSING;
377
- break;
378
- case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
379
- case Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_SALE:
380
- $invoice = $this->_invoice();
381
-
382
- $this->setAmountAuthorized($this->getOrder()->getTotalDue());
383
- $this->setBaseAmountAuthorized($this->getOrder()->getBaseTotalDue());
384
-
385
- $orderState = $this->getOrder()->getIsVirtual()
386
- ? Mage_Sales_Model_Order::STATE_COMPLETE
387
- : Mage_Sales_Model_Order::STATE_PROCESSING;
388
- break;
389
- default:
390
- break;
391
- }
392
- }
393
- }
394
-
395
- $orderIsNotified = null;
396
- if ($stateObject->getState() && $stateObject->getStatus())
397
- {
398
- $orderState = $stateObject->getState();
399
- if($csvOrderStatus == null)
400
- {
401
- $orderStatus = $stateObject->getStatus();
402
- }
403
- else
404
- {
405
- $orderStatus = $csvOrderStatus;
406
- }
407
- $orderIsNotified = $stateObject->getIsNotified();
408
- }
409
- else
410
- {
411
- /*
412
- * this flag will set if the order went to as authorization under fraud service for payflowpro
413
- */
414
- if ($this->getFraudFlag())
415
- {
416
- $orderStatus = $methodInstance->getConfigData('fraud_order_status');
417
- $orderState = Mage_Sales_Model_Order::STATE_HOLDED;
418
- }
419
- else
420
- {
421
- $orderStatus = $methodInstance->getConfigData('order_status');
422
-
423
- }
424
-
425
- if($csvOrderStatus == null)
426
- {
427
- if (!$orderStatus || $this->getOrder()->getIsVirtual())
428
- {
429
- $orderStatus = $this->getOrder()->getConfig()->getStateDefaultStatus($orderState);
430
- }
431
- }
432
- else
433
- {
434
- $orderStatus = $csvOrderStatus;
435
- }
436
- }
437
-
438
- $this->getOrder()->setState($orderState);
439
- $this->getOrder()->addStatusToHistory(
440
- $orderStatus,
441
- $this->getOrder()->getCustomerNote(),
442
- (null !== $orderIsNotified ? $orderIsNotified : $this->getOrder()->getCustomerNoteNotify())
443
- );
444
-
445
- Mage::dispatchEvent('sales_order_payment_place_end', array('payment' => $this));
446
-
447
- return $this;
448
- }
449
- }
450
-
451
- /**
452
- * Create transaction,
453
- * prepare its insertion into hierarchy and add its information to payment and comments
454
- *
455
- * To add transactions and related information,
456
- * the following information should be set to payment before processing:
457
- * - transaction_id
458
- * - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
459
- * - parent_transaction_id (optional)
460
- * - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
461
- *
462
- * If the sales document is specified, it will be linked to the transaction as related for future usage.
463
- * Currently transaction ID is set into the sales object
464
- * This method writes the added transaction ID into last_trans_id field of the payment object
465
- *
466
- * To make sure transaction object won't cause trouble before saving, use $failsafe = true
467
- *
468
- * @param string $type
469
- * @param Mage_Sales_Model_Abstract $salesDocument
470
- * @param bool $failsafe
471
- * @return null|Mage_Sales_Model_Order_Payment_Transaction
472
- */
473
- protected function _addTransaction($type, $salesDocument = null, $failsafe = false)
474
- {
475
- $model = Mage::getModel('cardsaveonlinepayments/direct');
476
- $nVersion = $model->getVersion();
477
-
478
- if($nVersion >= 1501)
479
- {
480
- if ($this->getSkipTransactionCreation())
481
- {
482
- $this->unsTransactionId();
483
- return null;
484
- }
485
- }
486
-
487
- // look for set transaction ids
488
- $transactionId = $this->getTransactionId();
489
- if (null !== $transactionId)
490
- {
491
- // set transaction parameters
492
- $transaction = false;
493
- if ($this->getOrder()->getId())
494
- {
495
- $transaction = $this->_lookupTransaction($transactionId);
496
- }
497
-
498
- if (!$transaction)
499
- {
500
- $transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
501
- }
502
- $transaction
503
- ->setOrderPaymentObject($this)
504
- ->setTxnType($type)
505
- ->isFailsafe($failsafe);
506
-
507
- if ($this->hasIsTransactionClosed())
508
- {
509
- $transaction->setIsClosed((int)$this->getIsTransactionClosed());
510
- }
511
-
512
- //set transaction addition information
513
- if ($this->_transactionAdditionalInfo)
514
- {
515
- foreach ($this->_transactionAdditionalInfo as $key => $value)
516
- {
517
- $transaction->setAdditionalInformation($key, $value);
518
  }
519
  }
 
520
 
521
- // link with sales entities
522
- $this->setLastTransId($transactionId);
523
- $this->setCreatedTransaction($transaction);
524
- $this->getOrder()->addRelatedObject($transaction);
525
- if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract)
526
- {
527
- $salesDocument->setTransactionId($transactionId);
528
- // TODO: linking transaction with the sales document
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  }
530
-
531
- // link with parent transaction
532
- $parentTransactionId = $this->getParentTransactionId();
533
-
534
- if ($parentTransactionId)
535
- {
536
- $transaction->setParentTxnId($parentTransactionId);
537
- if ($this->getShouldCloseParentTransaction())
538
- {
539
- $parentTransaction = $this->_lookupTransaction($parentTransactionId);
540
- if ($parentTransaction)
541
- {
542
- if (!$parentTransaction->getIsClosed())
543
- {
544
- $parentTransaction->isFailsafe($failsafe)->close(false);
545
- }
546
- $this->getOrder()->addRelatedObject($parentTransaction);
547
- }
548
- }
549
  }
550
- return $transaction;
551
  }
 
 
 
 
 
 
 
 
 
 
 
 
552
  }
553
  }
1
  <?php
2
 
3
  class Cardsave_Sales_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
4
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  /**
6
  * Authorize or authorize and capture payment on gateway, if applicable
7
  * This method is supposed to be called only when order is placed
9
  * @return Mage_Sales_Model_Order_Payment
10
  */
11
  public function place()
12
+ {
13
+
14
+ Mage::dispatchEvent('sales_order_payment_place_start', array('payment' => $this));
15
+ $order = $this->getOrder();
16
+
17
+ $this->setAmountOrdered($order->getTotalDue());
18
+ $this->setBaseAmountOrdered($order->getBaseTotalDue());
19
+ $this->setShippingAmount($order->getShippingAmount());
20
+ $this->setBaseShippingAmount($order->getBaseShippingAmount());
21
+
22
+ $methodInstance = $this->getMethodInstance();
23
+ $methodInstance->setStore($order->getStoreId());
24
+
25
+ $orderState = Mage_Sales_Model_Order::STATE_NEW;
26
+ $orderStatus= false;
27
+
28
+ $stateObject = new Varien_Object();
29
+
30
+ /**
31
+ * Do order payment validation on payment method level
32
+ */
33
+ $methodInstance->validate();
34
+ $action = $methodInstance->getConfigPaymentAction();
35
+ if ($action) {
36
+ if ($methodInstance->isInitializeNeeded()) {
37
+ /**
38
+ * For method initialization we have to use original config value for payment action
39
+ */
40
+ $methodInstance->initialize($methodInstance->getConfigData('payment_action'), $stateObject);
41
+ } else {
42
+ $orderState = Mage_Sales_Model_Order::STATE_PROCESSING;
43
+ switch ($action) {
44
+ case Mage_Payment_Model_Method_Abstract::ACTION_ORDER:
45
+ $this->_order($order->getBaseTotalDue());
46
+ break;
47
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
48
+ $this->_authorize(true, $order->getBaseTotalDue()); // base amount will be set inside
49
+ $this->setAmountAuthorized($order->getTotalDue());
50
+ break;
51
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
52
+ $this->setAmountAuthorized($order->getTotalDue());
53
+ $this->setBaseAmountAuthorized($order->getBaseTotalDue());
54
+ $this->capture(null);
55
+ break;
56
+ default:
57
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
  }
60
+ }
61
 
62
+ $this->_createBillingAgreement();
63
+
64
+ $orderIsNotified = null;
65
+
66
+ if ($order->getIsThreeDSecurePending()) {
67
+ $orderState = 'pending_payment';
68
+ $orderStatus = 'csv_pending_threed_secure';
69
+ $message = '3D Secure authentication need to be completed';
70
+ $orderIsNotified = false;
71
+ } else if ($order->getIsHostedPaymentPending()) {
72
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true)->save();
73
+ $orderStateHelper = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
74
+ $orderState = 'pending_payment';
75
+ $orderStatus = 'csv_pending_hosted_payment';
76
+ $message = 'Hosted Payment need to be completed';
77
+ } else if ($order->getPayment()->getMethodInstance()->getCode() == 'cardsaveonlinepayments') {
78
+ $orderState = 'processing';
79
+ if(Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('payment_action') == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE) {
80
+ $orderStatus = "csv_paid";
81
+ } else if (Mage::getModel('cardsaveonlinepayments/direct')->getConfigData('payment_action') == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE) {
82
+ $orderStatus = "csv_preauth";
83
+ }
84
+ $message = '';
85
+ $orderIsNotified = false;
86
+ } else if ($stateObject->getState() && $stateObject->getStatus()) {
87
+ $orderState = $stateObject->getState();
88
+ $orderStatus = $stateObject->getStatus();
89
+ $orderIsNotified = $stateObject->getIsNotified();
90
+ } else {
91
+ $orderIsNotified = false;
92
+ $orderStatus = $methodInstance->getConfigData('order_status');
93
+ if (!$orderStatus) {
94
+ $orderStatus = $order->getConfig()->getStateDefaultStatus($orderState);
95
  }
96
+ }
97
+ $isCustomerNotified = (null !== $orderIsNotified) ? $orderIsNotified : $order->getCustomerNoteNotify();
98
+ $ordernote = $order->getCustomerNote();
99
+ if ($ordernote) {
100
+ $order->addStatusToHistory($order->getStatus(), $ordernote, $isCustomerNotified);
101
+ }
102
+
103
+ // add message if order was put into review during authorization or capture
104
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
105
+ if ($message) {
106
+ $order->addStatusToHistory($order->getStatus(), $message, $isCustomerNotified);
 
 
 
 
 
 
 
 
107
  }
 
108
  }
109
+ // add message to history if order state already declared
110
+ elseif ($order->getState() && ($orderStatus !== $order->getStatus() || $message)) {
111
+ $order->setState($orderState, $orderStatus, $message, $isCustomerNotified);
112
+ }
113
+ // set order state
114
+ elseif (($order->getState() != $orderState) || ($order->getStatus() != $orderStatus) || $message) {
115
+ $order->setState($orderState, $orderStatus, $message, $isCustomerNotified);
116
+ }
117
+
118
+ Mage::dispatchEvent('sales_order_payment_place_end', array('payment' => $this));
119
+
120
+ return $this;
121
  }
122
  }
app/design/adminhtml/base/default/template/cardsaveonlinepayments/form.phtml CHANGED
@@ -47,27 +47,6 @@
47
  </div>
48
  </div>
49
  </li>
50
- <li>
51
- <label for="<?php echo $_code; ?>_cc_ss_start_month"><?php echo $this->__('Start Date') ?></label><br />
52
- <div class="input-box">
53
- <div class="v-fix">
54
- <select id="<?php echo $_code; ?>_cc_ss_start_month" name="payment<?php echo $fieldCode; ?>[cc_ss_start_month]" class="month">
55
- <?php $_ccStartMonth = $this->getInfoData('cc_ss_start_month') ?>
56
- <?php foreach ($this->getCcStartMonths() as $k=>$v): ?>
57
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
58
- <?php endforeach ?>
59
- </select>
60
- </div>
61
- <div class="v-fix">
62
- <?php $_ccStartYear = $this->getInfoData('cc_ss_start_year') ?>
63
- <select id="<?php echo $_code ?>_cc_ss_start_year" name="payment<?php echo $fieldCode; ?>[cc_ss_start_year]" class="year">
64
- <?php foreach ($this->getCcStartYears() as $k=>$v): ?>
65
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
66
- <?php endforeach ?>
67
- </select>
68
- </div>
69
- </div>
70
- </li>
71
  <li>
72
  <div class="input-box">
73
  <label for="<?php echo $_code; ?>_cc_ss_issue"><?php echo $this->__('Issue Number') ?></label><br />
47
  </div>
48
  </div>
49
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  <li>
51
  <div class="input-box">
52
  <label for="<?php echo $_code; ?>_cc_ss_issue"><?php echo $this->__('Issue Number') ?></label><br />
app/design/frontend/base/default/template/cardsaveonlinepayments/form.phtml CHANGED
@@ -1,18 +1,18 @@
1
  <?php $direct = Mage::getModel('cardsaveonlinepayments/direct'); ?>
2
- <?php $_code = $this->getMethodCode() ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
 
5
  <?php if ($direct->getConfigData('mode') == Cardsave_Cardsaveonlinepayments_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
  <fieldset class="form-list">
7
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
  <li>
9
- <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.jpg'); ?>">
10
  </li>
11
  <li>
12
  <?php echo $this->__('You will be redirected to a secure page where you can complete your payment.') ?>
13
  </li>
14
- <li class='notice-msg'>
15
- <?php echo $this->__('Please do not attempt to click the "BACK" button in your browser once you were redirected to the secure payment page to complete your payment. If you need to change your order you can do it before placing your order.') ?>
16
  </li>
17
  </ul>
18
  </fieldset>
@@ -20,7 +20,7 @@
20
  <fieldset class="form-list">
21
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
22
  <li>
23
- <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.jpg'); ?>">
24
  </li>
25
  <li>
26
  <div class="input-box">
1
  <?php $direct = Mage::getModel('cardsaveonlinepayments/direct'); ?>
2
+ <?php $_code = $this->getMethodCode(); ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
 
5
  <?php if ($direct->getConfigData('mode') == Cardsave_Cardsaveonlinepayments_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
  <fieldset class="form-list">
7
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
  <li>
9
+ <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.png'); ?>">
10
  </li>
11
  <li>
12
  <?php echo $this->__('You will be redirected to a secure page where you can complete your payment.') ?>
13
  </li>
14
+ <li class='notice-msg'>
15
+ <?php echo $this->__('Do not attempt to click the "BACK" button in your browser once you have been redirected to the secure payment page to complete your payment. If you need make changes your order, please do so before confirming your order.') ?>
16
  </li>
17
  </ul>
18
  </fieldset>
20
  <fieldset class="form-list">
21
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
22
  <li>
23
+ <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.png'); ?>">
24
  </li>
25
  <li>
26
  <div class="input-box">
app/design/frontend/default/default/template/cardsaveonlinepayments/form.phtml CHANGED
@@ -1,18 +1,18 @@
1
  <?php $direct = Mage::getModel('cardsaveonlinepayments/direct'); ?>
2
- <?php $_code=$this->getMethodCode(); ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
 
5
  <?php if ($direct->getConfigData('mode') == Cardsave_Cardsaveonlinepayments_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
  <fieldset class="form-list">
7
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
  <li>
9
- <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.jpg'); ?>">
10
  </li>
11
  <li>
12
  <?php echo $this->__('You will be redirected to a secure page where you can complete your payment.') ?>
13
  </li>
14
  <li class='notice-msg'>
15
- <?php echo $this->__('Please do not attempt to click the "BACK" button in your browser once you were redirected to the secure payment page to complete your payment. If you need to change your order you can do it before placing your order.') ?>
16
  </li>
17
  </ul>
18
  </fieldset>
@@ -20,7 +20,7 @@
20
  <fieldset class="form-list">
21
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
22
  <li>
23
- <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.jpg'); ?>">
24
  </li>
25
  <li>
26
  <div class="input-box">
@@ -56,27 +56,6 @@
56
  </div>
57
  </div>
58
  </li>
59
- <li>
60
- <label for="<?php echo $_code; ?>_cc_ss_start_month"><?php echo $this->__('Start Date') ?></label><br />
61
- <div class="input-box">
62
- <div class="v-fix">
63
- <select id="<?php echo $_code; ?>_cc_ss_start_month" name="payment<?php echo $fieldCode; ?>[cc_ss_start_month]" class="month">
64
- <?php $_ccStartMonth = $this->getInfoData('cc_ss_start_month') ?>
65
- <?php foreach ($this->getCcStartMonths() as $k=>$v): ?>
66
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
67
- <?php endforeach ?>
68
- </select>
69
- </div>
70
- <div class="v-fix">
71
- <?php $_ccStartYear = $this->getInfoData('cc_ss_start_year') ?>
72
- <select id="<?php echo $_code ?>_cc_ss_start_year" name="payment<?php echo $fieldCode; ?>[cc_ss_start_year]" class="year">
73
- <?php foreach ($this->getCcStartYears() as $k=>$v): ?>
74
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
75
- <?php endforeach ?>
76
- </select>
77
- </div>
78
- </div>
79
- </li>
80
  <li>
81
  <div class="input-box">
82
  <label for="<?php echo $_code; ?>_cc_ss_issue"><?php echo $this->__('Issue Number') ?></label><br />
1
  <?php $direct = Mage::getModel('cardsaveonlinepayments/direct'); ?>
2
+ <?php $_code = $this->getMethodCode(); ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
 
5
  <?php if ($direct->getConfigData('mode') == Cardsave_Cardsaveonlinepayments_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
  <fieldset class="form-list">
7
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
  <li>
9
+ <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.png'); ?>">
10
  </li>
11
  <li>
12
  <?php echo $this->__('You will be redirected to a secure page where you can complete your payment.') ?>
13
  </li>
14
  <li class='notice-msg'>
15
+ <?php echo $this->__('Do not attempt to click the "BACK" button in your browser once you have been redirected to the secure payment page to complete your payment. If you need make changes your order, please do so before confirming your order.') ?>
16
  </li>
17
  </ul>
18
  </fieldset>
20
  <fieldset class="form-list">
21
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
22
  <li>
23
+ <img alt="<?php echo $this->__('CardSave Online Payment Logo'); ?>" src="<?php echo $this->getSkinUrl('images/cardsave_online.png'); ?>">
24
  </li>
25
  <li>
26
  <div class="input-box">
56
  </div>
57
  </div>
58
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  <li>
60
  <div class="input-box">
61
  <label for="<?php echo $_code; ?>_cc_ss_issue"><?php echo $this->__('Issue Number') ?></label><br />
package.xml CHANGED
@@ -1,20 +1,25 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardsave_Cardsaveonlinepayments</name>
4
- <version>1.12.0</version>
5
  <stability>stable</stability>
6
- <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Cardsave payment extension compatible with Magento v 1.3, 1.4, 1.5 and 1.6</summary>
10
- <description>Fully supports 3D secure and CrossReference transactions. Also supports all of the integration methods provided by CardSave.</description>
11
- <notes>Option to select transaction type: PREAUTH or SALE.&#xD;
12
- CrossReference feature added with new transaction types: VOID, REFUND and COLLECTION.&#xD;
13
- Fixed stock management bug on Hosted Payment Form payment when clicking on BACK button before payment is processed.</notes>
14
- <authors><author><name>Cardsave</name><user>auto-converted</user><email>integrationsupport@cardsaveonlinepayments.com</email></author></authors>
15
- <date>2012-02-17</date>
16
- <time>11:09:00</time>
17
- <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><file name="cardsaveonlinepayments.js" hash="e7b2422644d39f0eb98e63d54a55ae4d"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="bf8cf94001d912f6d1e77b1d2b03cf6e"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir><dir name="payment"><dir name="info"><file name="cc_cardsaveonlinepayments.phtml" hash="88065460669f1112779264bdbf710af4"/></dir></dir></dir><dir name="layout"><file name="cardsaveonlinepayments.xml" hash="65e413716658a000d659271cd174b1e2"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="ad3f2b6304ce7e83e82195aa16fdb43a"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="8a0c644988ade86287a61ab812c8be1f"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="f6bf28657333e31a856074d02c1ef1f8"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardsave_All.xml" hash="e1d59fd8c4d4b5d87607f43fecf47e59"/></dir></target><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Payment.php" hash="1cff6196bd79d3989b960506cc87201e"/></dir></dir></dir><file name="Error.php" hash="660d3cbde48910ef271df9e05130a6d7"/><file name="Form.php" hash="ea5b3817c9607a94f4685d53d0b18569"/><file name="Info.php" hash="57a4bfec1a1c769de063be2b922f4a97"/><file name="Redirect.php" hash="b5a1f7af807dc9a41ec5b9db5c74e87e"/><file name="Threedsecure.php" hash="9d75776f34c5acaf6ea265f35f302c69"/></dir><dir name="controllers"><file name="PaymentController.php" hash="e5e744834c4d5c82a803ce7455157237"/></dir><dir name="etc"><file name="config.xml" hash="64182ccad38661fcbf72e3d0506abfc4"/><file name="system.xml" hash="946f07b53a3e5e321cdacb1bad97a469"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><dir name="Common"><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e206301745383a47a283cc69e4c5a8a9"/><file name="SOAP.php" hash="ed4585a1acc60a67fac72f6022084688"/><file name="TPG_Common.php" hash="0170a3c7f6a01faf9aee9b0f94da6d2a"/></dir><file name="GlobalErrors.php" hash="04d277d4a763efa508bf36d29c7dc8c4"/><file name="ISOCountries.php" hash="78dc558da68ca9a6ef44898a3980ecf2"/><file name="ISOCurrencies.php" hash="a32bc47b2d9896c293ecdcbf847144f9"/><file name="PaymentFormHelper.php" hash="41e22f61e8b71b8e8b6ca78b90da44e5"/></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="3aab84053c69af1de2e743ee590fdf0c"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="b2a7e887464ff91517dbb4fd62f13c66"/></dir></dir></dir><file name="Direct.php" hash="b30f8f15c34ebf4900d3119e1a89a1bd"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/></dir><dir name="sql"><dir name="cardsaveonlinepayments_setup"><file name="mysql4-install-0.1.0.php" hash="bda643d24b75e0dc527dc2caa6d47689"/></dir></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="695d628564f6e1e0c85e3821699e6b45"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="9dbd58b6b32491d65e5c7d5850aa3420"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="8122652860c5f9ac512b25e2088d1099"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="41f8d7978cb7e4cfffa0272d80e8f7bd"/></dir><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="9be99f3fbe1c4fe98fb110d3daa8afe6"/><file name="Payment.php" hash="d413361faad1910189a63b53ed84df62"/></dir><dir name="Service"><file name="Quote.php" hash="a514922157b5690772d716c29f4a653e"/></dir><file name="Order.php" hash="9ffa9e06b0d5d8d2d810ab50017e81fa"/></dir></dir></dir></target></contents>
 
 
 
 
 
18
  <compatible/>
19
- <dependencies/>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardsave_Cardsaveonlinepayments</name>
4
+ <version>1.14.0</version>
5
  <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Payment Plugin for the CardSave Payment Gateway.</summary>
10
+ <description>Fully supports 3D secure transactions and all of the integration methods provided by CardSave.</description>
11
+ <notes>Compilation issues resolved.&#xD;
12
+ Status conflicts with other payment methods resolved.&#xD;
13
+ "Start Date" removed from Direct/Transparent Redirect methods (no longer checked by issuing banks).&#xD;
14
+ Revised error messages.&#xD;
15
+ CardSave branding updated.&#xD;
16
+ Reorganised module setup page.&#xD;
17
+ &#xD;
18
+ </notes>
19
+ <authors><author><name>CardSave</name><user>CardSave</user><email>alistair.richardson@cardsave.net</email></author></authors>
20
+ <date>2012-11-06</date>
21
+ <time>15:50:08</time>
22
+ <contents><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Payment.php" hash="1cff6196bd79d3989b960506cc87201e"/></dir></dir></dir><file name="Error.php" hash="660d3cbde48910ef271df9e05130a6d7"/><file name="Form.php" hash="ea5b3817c9607a94f4685d53d0b18569"/><file name="Info.php" hash="57a4bfec1a1c769de063be2b922f4a97"/><file name="Redirect.php" hash="b5a1f7af807dc9a41ec5b9db5c74e87e"/><file name="Threedsecure.php" hash="9d75776f34c5acaf6ea265f35f302c69"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><dir name="Common"><file name="GlobalErrors.php" hash="e0f9062ca2db4c85d17e6939f9bd7641"/><file name="ISOCountries.php" hash="6c59574f190f6a67e38578d876c14edf"/><file name="ISOCurrencies.php" hash="2568f980f09bd8a7d4beaf3d16456d28"/><file name="PaymentFormHelper.php" hash="ce56bd0eb009c6ee64183d1b5b47a930"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e7d13200c853536cf641bde7f714b54e"/><file name="SOAP.php" hash="2b966f946889c6f151b222c322d7a0ee"/><file name="TPG_Common.php" hash="0170a3c7f6a01faf9aee9b0f94da6d2a"/></dir></dir><file name="Direct.php" hash="ceec1e292df3c0c316533da0756e6ace"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="b2a7e887464ff91517dbb4fd62f13c66"/></dir></dir></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="3aab84053c69af1de2e743ee590fdf0c"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="607cac41c1700d37f72365e656a5471a"/></dir><dir name="etc"><file name="config.xml" hash="a2ccf758ed448c19a2d9cb95ddd13316"/><file name="system.xml" hash="67d9e6f182704f8c2e44b55229e2c8bf"/></dir><dir name="sql"><dir name="cardsaveonlinepayments_setup"><file name="mysql4-install-0.1.0.php" hash="bda643d24b75e0dc527dc2caa6d47689"/></dir></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="75a8a2961be74499d47ab398a8e1ba8a"/></dir></dir></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="2dc7e8f4e2b0292dc9160e4f9cf9ae5b"/></dir></dir><dir name="etc"><file name="config.xml" hash="9dbd58b6b32491d65e5c7d5850aa3420"/></dir></dir><dir name="Sales"><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="9be99f3fbe1c4fe98fb110d3daa8afe6"/><file name="Payment.php" hash="10102812cd1906c0cceced21f88a78ff"/></dir><file name="Order.php" hash="e84594434822e321f271e3e463ddbcb9"/><dir name="Service"><file name="Quote.php" hash="a514922157b5690772d716c29f4a653e"/></dir></dir><dir name="etc"><file name="config.xml" hash="41f8d7978cb7e4cfffa0272d80e8f7bd"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="45978066fc7ee981dec117306a33bb02"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="cardsaveonlinepayments.xml" hash="65e413716658a000d659271cd174b1e2"/></dir><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="bf8cf94001d912f6d1e77b1d2b03cf6e"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir><dir name="payment"><dir name="info"><file name="cc_cardsaveonlinepayments.phtml" hash="88065460669f1112779264bdbf710af4"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="d8c32fe9d0d9584ac03ff7148c18e24a"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/><file name="form.phtml" hash="d8c32fe9d0d9584ac03ff7148c18e24a"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="0c09fc73b4fd3ecf44bb4928e9bd3320"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardsave_All.xml" hash="e1d59fd8c4d4b5d87607f43fecf47e59"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="cardsaveonlinepayments.js" hash="e7b2422644d39f0eb98e63d54a55ae4d"/></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><file name="cardsave_online.png" hash="d24a379083a48ade742bddda6aa09103"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="images"><file name="cardsave_online.png" hash="d24a379083a48ade742bddda6aa09103"/></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0</min><max>1.7.5</max></package></required></dependencies>
25
  </package>
skin/frontend/base/default/images/cardsave_online.jpg DELETED
Binary file
skin/frontend/base/default/images/cardsave_online.png ADDED
Binary file
skin/frontend/default/default/images/cardsave_online.jpg DELETED
Binary file
skin/frontend/default/default/images/cardsave_online.png ADDED
Binary file