Cardsave_Cardsaveonlinepayments - Version 1.8.5

Version Notes

Added statuses

Download this release

Release Info

Developer Magento Core Team
Extension Cardsave_Cardsaveonlinepayments
Version 1.8.5
Comparing to
See all releases


Code changes from version 1.8.4 to 1.8.5

app/code/local/Cardsave/Cardsaveonlinepayments/controllers/PaymentController.php CHANGED
@@ -144,7 +144,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
144
  }
145
 
146
  $this->_subtractOrderedItemsFromStock($order);
147
- $this->_updateInvoices($order);
148
 
149
  if($szPaymentProcessorResponse != '')
150
  {
@@ -256,7 +256,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
256
  }
257
 
258
  $this->_subtractOrderedItemsFromStock($order);
259
- $this->_updateInvoices($order);
260
 
261
  if($szPaymentProcessorResponse != '')
262
  {
@@ -276,13 +276,14 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
276
  $model = Mage::getModel('cardsaveonlinepayments/direct');
277
  $checkout = Mage::getSingleton('checkout/type_onepage');
278
  $szOrderID = $this->getRequest()->getPost('OrderID');
 
279
 
280
  try
281
  {
282
  // finish off the transaction: if StatusCode = 0 create an order otherwise do nothing
283
  $checkout->saveOrderAfterRedirectedPaymentAction(true,
284
  $this->getRequest()->getPost('StatusCode'),
285
- $this->getRequest()->getPost('Message'),
286
  $this->getRequest()->getPost('PreviousStatusCode'),
287
  $this->getRequest()->getPost('PreviousMessage'),
288
  $this->getRequest()->getPost('OrderID'));
@@ -318,7 +319,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
318
  {
319
  Mage::getSingleton('checkout/session')->clear();
320
  $this->_subtractOrderedItemsFromStock($order);
321
- $this->_updateInvoices($order);
322
  }
323
 
324
  $this->getResponse()->setBody('StatusCode=0');
@@ -467,7 +468,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
467
  }
468
 
469
  $this->_subtractOrderedItemsFromStock($order);
470
- $this->_updateInvoices($order);
471
 
472
  Mage::getSingleton('core/session')->addSuccess('Payment Processor Response: '.$szMessage);
473
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
@@ -688,7 +689,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
688
  }
689
 
690
  $this->_subtractOrderedItemsFromStock($order);
691
- $this->_updateInvoices($order);
692
 
693
  if($szPaymentProcessorResponse != '')
694
  {
@@ -787,13 +788,19 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
787
  ->setCardsaveonlinepaymentsOrderId(null);
788
  }
789
 
790
- private function _updateInvoices($order)
791
  {
792
  $invoices = $order->getInvoiceCollection();
 
 
793
  foreach ($invoices as $invoice)
794
  {
795
  // set the invoice state to be "Paid"
796
  $invoice->pay()->save();
797
  }
 
 
 
 
798
  }
799
  }
144
  }
145
 
146
  $this->_subtractOrderedItemsFromStock($order);
147
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
148
 
149
  if($szPaymentProcessorResponse != '')
150
  {
256
  }
257
 
258
  $this->_subtractOrderedItemsFromStock($order);
259
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
260
 
261
  if($szPaymentProcessorResponse != '')
262
  {
276
  $model = Mage::getModel('cardsaveonlinepayments/direct');
277
  $checkout = Mage::getSingleton('checkout/type_onepage');
278
  $szOrderID = $this->getRequest()->getPost('OrderID');
279
+ $szMessage = $this->getRequest()->getPost('Message');
280
 
281
  try
282
  {
283
  // finish off the transaction: if StatusCode = 0 create an order otherwise do nothing
284
  $checkout->saveOrderAfterRedirectedPaymentAction(true,
285
  $this->getRequest()->getPost('StatusCode'),
286
+ $szMessage,
287
  $this->getRequest()->getPost('PreviousStatusCode'),
288
  $this->getRequest()->getPost('PreviousMessage'),
289
  $this->getRequest()->getPost('OrderID'));
319
  {
320
  Mage::getSingleton('checkout/session')->clear();
321
  $this->_subtractOrderedItemsFromStock($order);
322
+ $this->_updateInvoices($order, $szMessage);
323
  }
324
 
325
  $this->getResponse()->setBody('StatusCode=0');
468
  }
469
 
470
  $this->_subtractOrderedItemsFromStock($order);
471
+ $this->_updateInvoices($order, $szMessage);
472
 
473
  Mage::getSingleton('core/session')->addSuccess('Payment Processor Response: '.$szMessage);
474
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
689
  }
690
 
691
  $this->_subtractOrderedItemsFromStock($order);
692
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
693
 
694
  if($szPaymentProcessorResponse != '')
695
  {
788
  ->setCardsaveonlinepaymentsOrderId(null);
789
  }
790
 
791
+ private function _updateInvoices($order, $message)
792
  {
793
  $invoices = $order->getInvoiceCollection();
794
+ $status = Mage_Sales_Model_Order::STATE_PROCESSING;
795
+
796
  foreach ($invoices as $invoice)
797
  {
798
  // set the invoice state to be "Paid"
799
  $invoice->pay()->save();
800
  }
801
+ // add a comment to the order comments
802
+ //$order->addStatusToHistory($status, $message, false);
803
+ $order->setState($orderState, 'cardsave_paid', $message, false);
804
+ $order->save();
805
  }
806
  }
app/code/local/Cardsave/Sales/Model/Order/Payment.php CHANGED
@@ -68,16 +68,16 @@ class Cardsave_Sales_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
68
  {
69
  $orderState = 'pending_payment';
70
  $orderStatus = 'cardsave_pending_threed_secure';
 
71
  $orderIsNotified = false;
72
- $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('Pending 3D Secure Authentication.'));
73
  }
74
  else if($order->getIsHostedPaymentPending())
75
  {
76
  $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true)->save();
77
  $orderState = 'pending_payment';
78
  $orderStatus = 'cardsave_pending_hosted_payment';
 
79
  $orderIsNotified = false;
80
- $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('Pending Hosted Payment.'));
81
  }
82
  else
83
  {
@@ -89,8 +89,13 @@ class Cardsave_Sales_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
89
  }
90
 
91
  $isCustomerNotified = (null !== $orderIsNotified) ? $orderIsNotified : $order->getCustomerNoteNotify();
92
- $message = $order->getCustomerNote();
93
-
 
 
 
 
 
94
  // add message if order was put into review during authorization or capture
95
  if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW)
96
  {
68
  {
69
  $orderState = 'pending_payment';
70
  $orderStatus = 'cardsave_pending_threed_secure';
71
+ $message = '3D Secure authentication need to be completed';
72
  $orderIsNotified = false;
 
73
  }
74
  else if($order->getIsHostedPaymentPending())
75
  {
76
  $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true)->save();
77
  $orderState = 'pending_payment';
78
  $orderStatus = 'cardsave_pending_hosted_payment';
79
+ $message = 'Hosted Payment need to be completed';
80
  $orderIsNotified = false;
 
81
  }
82
  else
83
  {
89
  }
90
 
91
  $isCustomerNotified = (null !== $orderIsNotified) ? $orderIsNotified : $order->getCustomerNoteNotify();
92
+ //$message = $order->getCustomerNote();
93
+ if(!$order->getIsThreeDSecurePending() &&
94
+ !$order->getIsHostedPaymentPending())
95
+ {
96
+ $message = $order->getCustomerNote();
97
+ }
98
+
99
  // add message if order was put into review during authorization or capture
100
  if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW)
101
  {
app/code/local/Cardsave/Sales/etc/config.xml CHANGED
@@ -19,6 +19,9 @@
19
  <sales>
20
  <order>
21
  <statuses>
 
 
 
22
  <cardsave_pending_threed_secure translate="label">
23
  <label>CardSave - Pending 3D Secure</label>
24
  </cardsave_pending_threed_secure>
@@ -32,7 +35,7 @@
32
  <label>CardSave - Pending Hosted Payment</label>
33
  </cardsave_pending_hosted_payment>
34
  <cardsave_failed_hosted_payment translate="label">
35
- <label>CardSave - Failed Hosted Payment</label>
36
  </cardsave_failed_hosted_payment>
37
  </statuses>
38
  </order>
19
  <sales>
20
  <order>
21
  <statuses>
22
+ <cardsave_paid translate="label">
23
+ <label>CardSave - Successful Payment</label>
24
+ </cardsave_paid>
25
  <cardsave_pending_threed_secure translate="label">
26
  <label>CardSave - Pending 3D Secure</label>
27
  </cardsave_pending_threed_secure>
35
  <label>CardSave - Pending Hosted Payment</label>
36
  </cardsave_pending_hosted_payment>
37
  <cardsave_failed_hosted_payment translate="label">
38
+ <label>CardSave - Failed Payment</label>
39
  </cardsave_failed_hosted_payment>
40
  </statuses>
41
  </order>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardsave_Cardsaveonlinepayments</name>
4
- <version>1.8.4</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Cardsave Payment Extension</summary>
10
  <description>Fully supports 3D secure transactions. Also supports all of the integration methods provided by Cardsave.</description>
11
- <notes>Invoice status issue fixed for payments completed on external hosted pages</notes>
12
  <authors><author><name>cardsave</name><user>auto-converted</user><email>integrationsupport@cardsaveonlinepayments.com</email></author></authors>
13
- <date>2010-10-20</date>
14
- <time>10:50:11</time>
15
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="2b0b8a72c9f4a6d2ab9f0ea020c8f2ed"/><file name="info.phtml" hash="935e10cad0632d558b2db1913cb80a2a"/></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="206c8703ef4d160dfc6c739c128ab47b"/><file name="info.phtml" hash="7256464904bbad66a821dea898d657a6"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><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="1715396760374c5bf11cc7e86d75e6ce"/></dir><dir name="controllers"><file name="PaymentController.php" hash="e8546b075a7949366be428248a3517e7"/></dir><dir name="etc"><file name="config.xml" hash="14507a95509d6366272555a05ba110c9"/><file name="system.xml" hash="4d0eab1c1a11d3e2078802499ad49f1e"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><file name="Direct.php" hash="b49148a9a4647226b29575e734b912e5"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/><dir name="Common"><file name="GlobalErrors.php" hash="04d277d4a763efa508bf36d29c7dc8c4"/><file name="ISOCountries.php" hash="78dc558da68ca9a6ef44898a3980ecf2"/><file name="ISOCurrencies.php" hash="a32bc47b2d9896c293ecdcbf847144f9"/><file name="PaymentFormHelper.php" hash="75d4ea669fae3eb62df24c45f83a5a60"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e4d4df170c21b7e3571b3ba1205ca979"/><file name="SOAP.php" hash="a0e5474dce51dc90ba4d37b5de3cdd84"/><file name="TPG_Common.php" hash="d86997c977cfd55b8ab577a514ab149c"/></dir></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="fa94be37c18bbb2f6301bdad1db3698d"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></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="e3d27996d67ced85884ab3dbd9dd1199"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="01b499b658358c8d6f608d8f01158e54"/></dir><dir name="Model"><file name="Order.php" hash="9ffa9e06b0d5d8d2d810ab50017e81fa"/><dir name="Order"><file name="Invoice.php" hash="9d826794c5b0652d2e6e5d3e315a5cc6"/><file name="Payment.php" hash="caba45b28b4e369c89deae6f81f5a8b2"/></dir><dir name="Service"><file name="Quote.php" hash="2cca459cf3338bf53501fe836b8b9f96"/></dir></dir></dir></dir></target><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></target><target name="mageetc"><dir name="modules"><file name="Cardsave_All.xml" hash="e1d59fd8c4d4b5d87607f43fecf47e59"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardsave_Cardsaveonlinepayments</name>
4
+ <version>1.8.5</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Cardsave Payment Extension</summary>
10
  <description>Fully supports 3D secure transactions. Also supports all of the integration methods provided by Cardsave.</description>
11
+ <notes>Added statuses</notes>
12
  <authors><author><name>cardsave</name><user>auto-converted</user><email>integrationsupport@cardsaveonlinepayments.com</email></author></authors>
13
+ <date>2010-10-29</date>
14
+ <time>14:51:37</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="2b0b8a72c9f4a6d2ab9f0ea020c8f2ed"/><file name="info.phtml" hash="935e10cad0632d558b2db1913cb80a2a"/></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="206c8703ef4d160dfc6c739c128ab47b"/><file name="info.phtml" hash="7256464904bbad66a821dea898d657a6"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><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="1715396760374c5bf11cc7e86d75e6ce"/></dir><dir name="controllers"><file name="PaymentController.php" hash="5fe65e38ce415b0957f725eb261f7142"/></dir><dir name="etc"><file name="config.xml" hash="14507a95509d6366272555a05ba110c9"/><file name="system.xml" hash="4d0eab1c1a11d3e2078802499ad49f1e"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><file name="Direct.php" hash="b49148a9a4647226b29575e734b912e5"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/><dir name="Common"><file name="GlobalErrors.php" hash="04d277d4a763efa508bf36d29c7dc8c4"/><file name="ISOCountries.php" hash="78dc558da68ca9a6ef44898a3980ecf2"/><file name="ISOCurrencies.php" hash="a32bc47b2d9896c293ecdcbf847144f9"/><file name="PaymentFormHelper.php" hash="75d4ea669fae3eb62df24c45f83a5a60"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e4d4df170c21b7e3571b3ba1205ca979"/><file name="SOAP.php" hash="a0e5474dce51dc90ba4d37b5de3cdd84"/><file name="TPG_Common.php" hash="d86997c977cfd55b8ab577a514ab149c"/></dir></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="fa94be37c18bbb2f6301bdad1db3698d"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></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="e3d27996d67ced85884ab3dbd9dd1199"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="7b59887dda2117c9843b582a4721ade2"/></dir><dir name="Model"><file name="Order.php" hash="9ffa9e06b0d5d8d2d810ab50017e81fa"/><dir name="Order"><file name="Invoice.php" hash="9d826794c5b0652d2e6e5d3e315a5cc6"/><file name="Payment.php" hash="0b725d11e47c08917e67ba0bd1feaa26"/></dir><dir name="Service"><file name="Quote.php" hash="2cca459cf3338bf53501fe836b8b9f96"/></dir></dir></dir></dir></target><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></target><target name="mageetc"><dir name="modules"><file name="Cardsave_All.xml" hash="e1d59fd8c4d4b5d87607f43fecf47e59"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>