Iridiumcorp_Tpg - Version 1.10.1

Version Notes

Invoice status issue fixed for payments occuring on external hosted payment pages

Download this release

Release Info

Developer Magento Core Team
Extension Iridiumcorp_Tpg
Version 1.10.1
Comparing to
See all releases


Code changes from version 1.10.0 to 1.10.1

app/code/local/Iridiumcorp/Sales/Model/Order/Invoice.php CHANGED
@@ -17,4 +17,37 @@ class Iridiumcorp_Sales_Model_Order_Invoice extends Mage_Sales_Model_Order_Invoi
17
  }
18
  return $this;
19
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
17
  }
18
  return $this;
19
  }
20
+
21
+ public function pay()
22
+ {
23
+ if ($this->_wasPayCalled)
24
+ {
25
+ return $this;
26
+ }
27
+
28
+ if(!$this->getOrder()->getIsThreeDSecurePending() &&
29
+ !$this->getOrder()->getIsHostedPaymentPending())
30
+ {
31
+ $this->_wasPayCalled = true;
32
+
33
+ $invoiceState = self::STATE_PAID;
34
+ if ($this->getOrder()->getPayment()->hasForcedState())
35
+ {
36
+ $invoiceState = $this->getOrder()->getPayment()->getForcedState();
37
+ }
38
+
39
+ $this->setState($invoiceState);
40
+
41
+ $this->getOrder()->getPayment()->pay($this);
42
+ $this->getOrder()->setTotalPaid(
43
+ $this->getOrder()->getTotalPaid()+$this->getGrandTotal()
44
+ );
45
+ $this->getOrder()->setBaseTotalPaid(
46
+ $this->getOrder()->getBaseTotalPaid()+$this->getBaseGrandTotal()
47
+ );
48
+ Mage::dispatchEvent('sales_order_invoice_pay', array($this->_eventObject=>$this));
49
+ }
50
+
51
+ return $this;
52
+ }
53
  }
app/code/local/Iridiumcorp/Tpg/controllers/PaymentController.php CHANGED
@@ -143,8 +143,8 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
143
  $order->sendNewOrderEmail();
144
  }
145
 
146
- // need to decrease the stock only after a succecssful payment
147
  $this->_subtractOrderedItemsFromStock($order);
 
148
 
149
  if($szPaymentProcessorResponse != '')
150
  {
@@ -255,8 +255,8 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
255
  $order->sendNewOrderEmail();
256
  }
257
 
258
- // need to decrease the stock only after a succecssful payment
259
  $this->_subtractOrderedItemsFromStock($order);
 
260
 
261
  if($szPaymentProcessorResponse != '')
262
  {
@@ -317,8 +317,8 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
317
  if($this->getRequest()->getPost('StatusCode') == '0')
318
  {
319
  Mage::getSingleton('checkout/session')->clear();
320
- // need to decrease the stock only after a succecssful payment
321
  $this->_subtractOrderedItemsFromStock($order);
 
322
  }
323
 
324
  $this->getResponse()->setBody('StatusCode=0');
@@ -332,6 +332,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
332
  {
333
  $boError = false;
334
  $nStartIndex = false;
 
335
  $szHashDigest = false;
336
  $szMerchantID = false;// password, presharedkey, hashmethod
337
  $szCrossReference = false;
@@ -465,8 +466,9 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
465
  $order->sendNewOrderEmail();
466
  }
467
 
468
- // need to decrease the stock only after a succecssful payment
469
  $this->_subtractOrderedItemsFromStock($order);
 
 
470
  Mage::getSingleton('core/session')->addSuccess('Payment Processor Response: '.$szMessage);
471
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
472
  }
@@ -685,8 +687,8 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
685
  $order->sendNewOrderEmail();
686
  }
687
 
688
- // need to decrease the stock only after a succecssful payment
689
  $this->_subtractOrderedItemsFromStock($order);
 
690
 
691
  if($szPaymentProcessorResponse != '')
692
  {
@@ -767,7 +769,10 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
767
  }
768
  }
769
 
770
-
 
 
 
771
  private function _clearSessionVariables()
772
  {
773
  // clear all the custom session variables used in the payment module in case of a failed payment
@@ -791,4 +796,18 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
791
  ->setRedirectedpayment(null)
792
  ->setTpgOrderId(null);
793
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
  }
143
  $order->sendNewOrderEmail();
144
  }
145
 
 
146
  $this->_subtractOrderedItemsFromStock($order);
147
+ $this->_updateInvoices($order);
148
 
149
  if($szPaymentProcessorResponse != '')
150
  {
255
  $order->sendNewOrderEmail();
256
  }
257
 
 
258
  $this->_subtractOrderedItemsFromStock($order);
259
+ $this->_updateInvoices($order);
260
 
261
  if($szPaymentProcessorResponse != '')
262
  {
317
  if($this->getRequest()->getPost('StatusCode') == '0')
318
  {
319
  Mage::getSingleton('checkout/session')->clear();
 
320
  $this->_subtractOrderedItemsFromStock($order);
321
+ $this->_updateInvoices($order);
322
  }
323
 
324
  $this->getResponse()->setBody('StatusCode=0');
332
  {
333
  $boError = false;
334
  $nStartIndex = false;
335
+ //
336
  $szHashDigest = false;
337
  $szMerchantID = false;// password, presharedkey, hashmethod
338
  $szCrossReference = false;
466
  $order->sendNewOrderEmail();
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));
474
  }
687
  $order->sendNewOrderEmail();
688
  }
689
 
 
690
  $this->_subtractOrderedItemsFromStock($order);
691
+ $this->_updateInvoices($order);
692
 
693
  if($szPaymentProcessorResponse != '')
694
  {
769
  }
770
  }
771
 
772
+ /**
773
+ * Clear the custom session variables after a payment attempt
774
+ *
775
+ */
776
  private function _clearSessionVariables()
777
  {
778
  // clear all the custom session variables used in the payment module in case of a failed payment
796
  ->setRedirectedpayment(null)
797
  ->setTpgOrderId(null);
798
  }
799
+
800
+ /**
801
+ * Set the invoice status to "Paid" after a successful payment
802
+ *
803
+ * @param unknown_type $order
804
+ */
805
+ private function _updateInvoices($order)
806
+ {
807
+ $invoices = $order->getInvoiceCollection();
808
+ foreach ($invoices as $invoice)
809
+ {
810
+ $invoice->pay()->save();
811
+ }
812
+ }
813
  }
package.xml CHANGED
@@ -1,20 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iridiumcorp_Tpg</name>
4
- <version>1.10.0</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Iridiumcorp Payment Extension for Magento v1.4.1.0 and above</summary>
10
  <description>Fully supports 3D secure transactions. Also supports all of the integration methods provided by Iridium.</description>
11
- <notes>Fix to run on Magento v1.4.1.0 and above.
12
- Fix to manage stock properly.
13
- Fix to update the Order status properly.</notes>
14
  <authors><author><name>iridiumcorp</name><user>auto-converted</user><email>support@iridiumcorp.co.uk</email></author></authors>
15
- <date>2010-10-18</date>
16
- <time>09:48:35</time>
17
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="Tpg"><file name="form.phtml" hash="9b2afd627d6e9e4f9ad43b0a7153962b"/><file name="info.phtml" hash="3164afadd87c4811b5f7d0879537f10e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="Tpg"><file name="form.phtml" hash="231e39bb2821718eeaec4c1d0ee3233d"/><file name="info.phtml" hash="7d72d07f3afa018d0402219e50573439"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iridiumcorp"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="a10e1c19ad7bb8718dcb3adf9d3e4de0"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="f57d3807294d61ee997cbdfd6acce34c"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="a68c91eef35d347a95232c198ccf31fe"/></dir><dir name="Model"><file name="Order.php" hash="a57c4bd661dbc322d5bd18aa2f51dd67"/><dir name="Order"><file name="Invoice.php" hash="0da517143d8c83606fb51721043e7be1"/><file name="Payment.php" hash="bd5ed39ecef936e9f2225989668851be"/></dir><dir name="Service"><file name="Quote.php" hash="bf113cd154e23dd9c8df0946adf9b94f"/></dir></dir></dir><dir name="Tpg"><dir name="Block"><file name="Error.php" hash="905367210beb53a0bc68dc6033e24127"/><file name="Form.php" hash="4b1d51aa84982486f3139510c41a221a"/><file name="Info.php" hash="f88445c4880bfe14914252bc76b6fc28"/><file name="Redirect.php" hash="a91a8a8f8b5ad887ed2cdd8d52732b8b"/><file name="Threedsecure.php" hash="9cbcf7d598fe4fdb5144aa6496436176"/></dir><dir name="controllers"><file name="PaymentController.php" hash="5ccbff29e1fb37b7ca0b85b0566f4da8"/></dir><dir name="etc"><file name="config.xml" hash="3395b3323803ea1c1fdea27f919c08da"/><file name="system.xml" hash="13531b8280be72392ae8abbd47f00adf"/></dir><dir name="Helper"><file name="Data.php" hash="a72fba87e718c94d993a57199e20ca96"/></dir><dir name="Model"><file name="Direct.php" hash="5581007f591f1a6dc9b16716fc12d223"/><file name="Request.php" hash="a96e462ed3c1882048ea45f2c3a6662c"/><dir name="Common"><file name="GlobalErrors.php" hash="a9c7bab60ebfe87967c794194e1e7208"/><file name="ISOCountries.php" hash="fc63d76fbe25458ba351f114782074cb"/><file name="ISOCurrencies.php" hash="89ac1e124e89c0713ef43a0cf6dd0e2b"/><file name="PaymentFormHelper.php" hash="85721dd87049dbd6c4aef2e48453815f"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="4ad38bdb85f865e967153d9f253390cd"/><file name="SOAP.php" hash="504dcb0cb7c60c134b25652881349cc3"/><file name="TPG_Common.php" hash="df1033ef855c7e0e715076a105acb84a"/></dir></dir><dir name="Source"><file name="HashMethod.php" hash="36d7fb4fc762feae459f0e67d51006f4"/><file name="OrderStatus.php" hash="95eb926db39d4afeb26784a9396f7b18"/><file name="PaymentAction.php" hash="bd8dc40852b9ff8c80c08fc01f35a988"/><file name="PaymentMode.php" hash="6849defade8a7da4cfaeff3227ae5b83"/><file name="ResultDeliveryMethod.php" hash="05f3806f2ff4bd5b1568bfb1681b2242"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iridiumcorp_All.xml" hash="f1a85eaa7631af1906f461b662519732"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iridiumcorp_Tpg</name>
4
+ <version>1.10.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Iridiumcorp Payment Extension</summary>
10
  <description>Fully supports 3D secure transactions. Also supports all of the integration methods provided by Iridium.</description>
11
+ <notes>Invoice status issue fixed for payments occuring on external hosted payment pages</notes>
 
 
12
  <authors><author><name>iridiumcorp</name><user>auto-converted</user><email>support@iridiumcorp.co.uk</email></author></authors>
13
+ <date>2010-10-20</date>
14
+ <time>11:08:59</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="Tpg"><file name="form.phtml" hash="9b2afd627d6e9e4f9ad43b0a7153962b"/><file name="info.phtml" hash="3164afadd87c4811b5f7d0879537f10e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="Tpg"><file name="form.phtml" hash="231e39bb2821718eeaec4c1d0ee3233d"/><file name="info.phtml" hash="7d72d07f3afa018d0402219e50573439"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iridiumcorp"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="a10e1c19ad7bb8718dcb3adf9d3e4de0"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="f57d3807294d61ee997cbdfd6acce34c"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="a68c91eef35d347a95232c198ccf31fe"/></dir><dir name="Model"><file name="Order.php" hash="a57c4bd661dbc322d5bd18aa2f51dd67"/><dir name="Order"><file name="Invoice.php" hash="14bd6c6a2e0b632fa669b937d0b23f78"/><file name="Payment.php" hash="bd5ed39ecef936e9f2225989668851be"/></dir><dir name="Service"><file name="Quote.php" hash="bf113cd154e23dd9c8df0946adf9b94f"/></dir></dir></dir><dir name="Tpg"><dir name="Block"><file name="Error.php" hash="905367210beb53a0bc68dc6033e24127"/><file name="Form.php" hash="4b1d51aa84982486f3139510c41a221a"/><file name="Info.php" hash="f88445c4880bfe14914252bc76b6fc28"/><file name="Redirect.php" hash="a91a8a8f8b5ad887ed2cdd8d52732b8b"/><file name="Threedsecure.php" hash="9cbcf7d598fe4fdb5144aa6496436176"/></dir><dir name="controllers"><file name="PaymentController.php" hash="e108f0dba0398443b9d322620fc3570f"/></dir><dir name="etc"><file name="config.xml" hash="3395b3323803ea1c1fdea27f919c08da"/><file name="system.xml" hash="13531b8280be72392ae8abbd47f00adf"/></dir><dir name="Helper"><file name="Data.php" hash="a72fba87e718c94d993a57199e20ca96"/></dir><dir name="Model"><file name="Direct.php" hash="5581007f591f1a6dc9b16716fc12d223"/><file name="Request.php" hash="a96e462ed3c1882048ea45f2c3a6662c"/><dir name="Common"><file name="GlobalErrors.php" hash="a9c7bab60ebfe87967c794194e1e7208"/><file name="ISOCountries.php" hash="fc63d76fbe25458ba351f114782074cb"/><file name="ISOCurrencies.php" hash="89ac1e124e89c0713ef43a0cf6dd0e2b"/><file name="PaymentFormHelper.php" hash="85721dd87049dbd6c4aef2e48453815f"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="4ad38bdb85f865e967153d9f253390cd"/><file name="SOAP.php" hash="504dcb0cb7c60c134b25652881349cc3"/><file name="TPG_Common.php" hash="df1033ef855c7e0e715076a105acb84a"/></dir></dir><dir name="Source"><file name="HashMethod.php" hash="36d7fb4fc762feae459f0e67d51006f4"/><file name="OrderStatus.php" hash="95eb926db39d4afeb26784a9396f7b18"/><file name="PaymentAction.php" hash="bd8dc40852b9ff8c80c08fc01f35a988"/><file name="PaymentMode.php" hash="6849defade8a7da4cfaeff3227ae5b83"/><file name="ResultDeliveryMethod.php" hash="05f3806f2ff4bd5b1568bfb1681b2242"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iridiumcorp_All.xml" hash="f1a85eaa7631af1906f461b662519732"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>