Trustly - Version 2.0.11

Version Notes

Download this release

Release Info

Developer Trustly
Extension Trustly
Version 2.0.11
Comparing to
See all releases


Code changes from version 2.0.10 to 2.0.11

app/code/community/Trustly/Trustly/controllers/PaymentController.php CHANGED
@@ -121,8 +121,7 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
121
 
122
  if($redirectError) {
123
  $session->addError($redirectError);
124
- $this->unmapQuote();
125
- $this->restoreQuote();
126
  } else {
127
  # We use this to keep track of the current quote we have
128
  # transformed into an order, use it when cancelling (to restore
@@ -579,8 +578,14 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
579
 
580
  public function failAction()
581
  {
582
- Mage::log("failAction() -> cancelAction", Zend_Log::DEBUG, self::LOG_FILE);
583
- $this->cancelAction();
 
 
 
 
 
 
584
  }
585
 
586
 
@@ -588,7 +593,19 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
588
  {
589
  Mage::log("cancelAction()", Zend_Log::DEBUG, self::LOG_FILE);
590
 
 
 
 
 
 
 
 
 
 
 
 
591
  $session = Mage::getSingleton('checkout/session');
 
592
  try {
593
  $orderId = $session->getLastOrderId();
594
  Mage::log("Attempting to cancel order $orderId", Zend_Log::DEBUG, self::LOG_FILE);
@@ -609,7 +626,6 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
609
  $session->unsTrustlyIframeUrl();
610
  Mage::getModel('trustly/ordermappings')->unmapOrderIncrement($order->getIncrementId());
611
  $this->restoreQuote();
612
- $session->addSuccess(Mage::helper('trustly')->__('Trustly order has been canceled.'));
613
  } else {
614
  Mage::log(sprintf("No order found to cancel (order=%s, orderid=%s, orderquoteid=%s, sessionquoteid=%s)",
615
  ($order?'YES':'NO'),
@@ -617,18 +633,18 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
617
  ($order->getQuoteId()?$order->getQuoteId():''),
618
  ($sess_quoteid?$sess_quoteid:'')),
619
  Zend_Log::WARN, self::LOG_FILE);
620
- $session->addSuccess(Mage::helper('trustly')->__('Trustly order has been canceled.'));
621
  }
622
  } catch (Mage_Core_Exception $e) {
623
  Mage::log("Got Mage_Core_Exception when cancelling order: " . $e->getMessage(), Zend_Log::WARN, self::LOG_FILE);
624
  $session->addError($e->getMessage());
 
625
  } catch (Exception $e) {
626
  $session->addError(Mage::helper('trustly')->__('Unable to cancel Trustly order.'));
627
  Mage::log("Got Exception when cancelling order: " . $e->getMessage(), Zend_Log::WARN, self::LOG_FILE);
628
  Mage::logException($e);
 
629
  }
630
-
631
- $this->_redirect('checkout/cart', array('_secure'=>Mage::app()->getStore()->isCurrentlySecure()));
632
  }
633
 
634
 
121
 
122
  if($redirectError) {
123
  $session->addError($redirectError);
124
+ $this->cancelCheckoutOrder();
 
125
  } else {
126
  # We use this to keep track of the current quote we have
127
  # transformed into an order, use it when cancelling (to restore
578
 
579
  public function failAction()
580
  {
581
+ Mage::log("failAction()", Zend_Log::DEBUG, self::LOG_FILE);
582
+
583
+ if($this->cancelCheckoutOrder()) {
584
+ $session = Mage::getSingleton('checkout/session');
585
+ $session->addSuccess(Mage::helper('trustly')->__('Trustly order has been canceled.'));
586
+ }
587
+
588
+ $this->_redirect('checkout/cart', array('_secure'=>Mage::app()->getStore()->isCurrentlySecure()));
589
  }
590
 
591
 
593
  {
594
  Mage::log("cancelAction()", Zend_Log::DEBUG, self::LOG_FILE);
595
 
596
+ if($this->cancelCheckoutOrder()) {
597
+ $session = Mage::getSingleton('checkout/session');
598
+ $session->addSuccess(Mage::helper('trustly')->__('Trustly order has been canceled.'));
599
+ }
600
+
601
+ $this->_redirect('checkout/cart', array('_secure'=>Mage::app()->getStore()->isCurrentlySecure()));
602
+ }
603
+
604
+
605
+ public function cancelCheckoutOrder()
606
+ {
607
  $session = Mage::getSingleton('checkout/session');
608
+
609
  try {
610
  $orderId = $session->getLastOrderId();
611
  Mage::log("Attempting to cancel order $orderId", Zend_Log::DEBUG, self::LOG_FILE);
626
  $session->unsTrustlyIframeUrl();
627
  Mage::getModel('trustly/ordermappings')->unmapOrderIncrement($order->getIncrementId());
628
  $this->restoreQuote();
 
629
  } else {
630
  Mage::log(sprintf("No order found to cancel (order=%s, orderid=%s, orderquoteid=%s, sessionquoteid=%s)",
631
  ($order?'YES':'NO'),
633
  ($order->getQuoteId()?$order->getQuoteId():''),
634
  ($sess_quoteid?$sess_quoteid:'')),
635
  Zend_Log::WARN, self::LOG_FILE);
 
636
  }
637
  } catch (Mage_Core_Exception $e) {
638
  Mage::log("Got Mage_Core_Exception when cancelling order: " . $e->getMessage(), Zend_Log::WARN, self::LOG_FILE);
639
  $session->addError($e->getMessage());
640
+ return false;
641
  } catch (Exception $e) {
642
  $session->addError(Mage::helper('trustly')->__('Unable to cancel Trustly order.'));
643
  Mage::log("Got Exception when cancelling order: " . $e->getMessage(), Zend_Log::WARN, self::LOG_FILE);
644
  Mage::logException($e);
645
+ return false;
646
  }
647
+ return true;
 
648
  }
649
 
650
 
app/code/community/Trustly/Trustly/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Trustly_Trustly>
5
- <version>2.0.10</version>
6
  </Trustly_Trustly>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Trustly_Trustly>
5
+ <version>2.0.11</version>
6
  </Trustly_Trustly>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Trustly</name>
4
- <version>2.0.10</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/copyleft/gpl.html">GPL 3</license>
7
  <channel>community</channel>
@@ -16,8 +16,8 @@
16
  <email>info@trustly.com</email>
17
  </author>
18
  </authors>
19
- <date>2015-02-05</date>
20
- <time>11:26:30</time>
21
  <contents>
22
  <target name="magelocale">
23
  <dir name="da_DK">
@@ -65,10 +65,10 @@
65
  <file name="Standard.php" hash="7fc3027a735a544f1bcd0cd65a745d88"/>
66
  </dir>
67
  <dir name="controllers">
68
- <file name="PaymentController.php" hash="89eca8a5d026166d9faa56f48a5772a1"/>
69
  </dir>
70
  <dir name="etc">
71
- <file name="config.xml" hash="b5102728ff4264db2e24f975bfe840aa"/>
72
  <file name="system.xml" hash="d92061e410e4e923eb39fa59f2e00927"/>
73
  </dir>
74
  <dir name="lib">
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Trustly</name>
4
+ <version>2.0.11</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/copyleft/gpl.html">GPL 3</license>
7
  <channel>community</channel>
16
  <email>info@trustly.com</email>
17
  </author>
18
  </authors>
19
+ <date>2015-02-16</date>
20
+ <time>13:49:18</time>
21
  <contents>
22
  <target name="magelocale">
23
  <dir name="da_DK">
65
  <file name="Standard.php" hash="7fc3027a735a544f1bcd0cd65a745d88"/>
66
  </dir>
67
  <dir name="controllers">
68
+ <file name="PaymentController.php" hash="2a4038d664f17eac7dc98e7b60ba9fe8"/>
69
  </dir>
70
  <dir name="etc">
71
+ <file name="config.xml" hash="2a6d8d9b1ffd7c6ab07618e0ede2426a"/>
72
  <file name="system.xml" hash="d92061e410e4e923eb39fa59f2e00927"/>
73
  </dir>
74
  <dir name="lib">