Version Notes
Fixed callback issues.
Download this release
Release Info
Developer | Roy Andre Tollefsen |
Extension | Trollweb_Dibs |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.3
- app/code/community/Trollweb/Dibs/Model/Dibspw.php +1 -2
- app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Request.php +1 -0
- app/code/community/Trollweb/Dibs/Model/Dibspw/Callback.php +34 -10
- app/code/community/Trollweb/Dibs/Model/Dibspw/Observer.php +7 -2
- app/code/community/Trollweb/Dibs/controllers/DibspwController.php +14 -0
- app/code/community/Trollweb/Dibs/data/dibs_setup/data-install-1.0.0.php +0 -17
- app/code/community/Trollweb/Dibs/etc/config.xml +1 -1
- package.xml +2 -2
app/code/community/Trollweb/Dibs/Model/Dibspw.php
CHANGED
@@ -145,8 +145,7 @@ class Trollweb_Dibs_Model_Dibspw extends Mage_Payment_Model_Method_Abstract
|
|
145 |
|
146 |
$request = Mage::getModel('dibs/dibspw_api_request')
|
147 |
->initRequest()
|
148 |
-
->buildCancelRequest($payment)
|
149 |
-
->validateData();
|
150 |
if($request === false) {
|
151 |
return $this;
|
152 |
}
|
145 |
|
146 |
$request = Mage::getModel('dibs/dibspw_api_request')
|
147 |
->initRequest()
|
148 |
+
->buildCancelRequest($payment);
|
|
|
149 |
if($request === false) {
|
150 |
return $this;
|
151 |
}
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Api/Request.php
CHANGED
@@ -118,6 +118,7 @@ class Trollweb_Dibs_Model_Dibspw_Api_Request extends Varien_Object
|
|
118 |
}
|
119 |
|
120 |
public function send() {
|
|
|
121 |
$result = Mage::getModel('dibs/dibspw_api_result');
|
122 |
|
123 |
try {
|
118 |
}
|
119 |
|
120 |
public function send() {
|
121 |
+
$hdibs = Mage::helper('dibs');
|
122 |
$result = Mage::getModel('dibs/dibspw_api_result');
|
123 |
|
124 |
try {
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Callback.php
CHANGED
@@ -19,12 +19,17 @@
|
|
19 |
|
20 |
class Trollweb_Dibs_Model_Dibspw_Callback extends Trollweb_Dibs_Model_Dibspw
|
21 |
{
|
22 |
-
protected $_callbackHasBeenCalled = false;
|
23 |
-
|
24 |
public function acceptOrder($post) {
|
25 |
-
|
26 |
-
|
|
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
public function cancelOrder($post) {
|
@@ -50,19 +55,39 @@ class Trollweb_Dibs_Model_Dibspw_Callback extends Trollweb_Dibs_Model_Dibspw
|
|
50 |
}
|
51 |
|
52 |
public function callback($post) {
|
53 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
return $this->saveTransactionData($post);
|
55 |
}
|
56 |
|
57 |
public function saveTransactionData($post) {
|
58 |
$hdibs = Mage::helper('dibs');
|
|
|
59 |
$order = $this->getOrder();
|
60 |
if (!$order->getId()) {
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
return $this;
|
63 |
}
|
64 |
|
65 |
-
|
|
|
|
|
|
|
66 |
return $this;
|
67 |
}
|
68 |
|
@@ -122,10 +147,9 @@ class Trollweb_Dibs_Model_Dibspw_Callback extends Trollweb_Dibs_Model_Dibspw
|
|
122 |
}
|
123 |
}
|
124 |
else {
|
125 |
-
$comment = 'Wrong order state ('.$order->getState().') on #'.$order->getIncrementId()
|
126 |
$hdibs->dibsLog($comment);
|
127 |
-
$
|
128 |
-
->save();
|
129 |
}
|
130 |
|
131 |
if (!isset($post['transaction'])) {
|
19 |
|
20 |
class Trollweb_Dibs_Model_Dibspw_Callback extends Trollweb_Dibs_Model_Dibspw
|
21 |
{
|
|
|
|
|
22 |
public function acceptOrder($post) {
|
23 |
+
$hdibs = Mage::helper('dibs');
|
24 |
+
if (isset($post['orderId'])) {
|
25 |
+
$orderId = $post['orderId'];
|
26 |
}
|
27 |
+
else {
|
28 |
+
$orderId = 'n/a';
|
29 |
+
}
|
30 |
+
$hdibs->dibsLog('Accrept request for Order ID: ' . $orderId);
|
31 |
+
|
32 |
+
return $this->saveTransactionData($post);
|
33 |
}
|
34 |
|
35 |
public function cancelOrder($post) {
|
55 |
}
|
56 |
|
57 |
public function callback($post) {
|
58 |
+
$hdibs = Mage::helper('dibs');
|
59 |
+
if (isset($post['orderId'])) {
|
60 |
+
$orderId = $post['orderId'];
|
61 |
+
}
|
62 |
+
else {
|
63 |
+
$orderId = 'n/a';
|
64 |
+
}
|
65 |
+
$hdibs->dibsLog('Callback request for Order ID: ' . $orderId);
|
66 |
+
|
67 |
return $this->saveTransactionData($post);
|
68 |
}
|
69 |
|
70 |
public function saveTransactionData($post) {
|
71 |
$hdibs = Mage::helper('dibs');
|
72 |
+
|
73 |
$order = $this->getOrder();
|
74 |
if (!$order->getId()) {
|
75 |
+
if (isset($post['orderId'])) {
|
76 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($post['orderId']);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
if (!$order->getId()) {
|
81 |
+
$hdibs->dibsLog('Unable to load order. POST params:');
|
82 |
+
$hdibs->dibsLog($post);
|
83 |
+
|
84 |
return $this;
|
85 |
}
|
86 |
|
87 |
+
$payment = $order->getPayment();
|
88 |
+
if ($payment->getAdditionalInformation(Trollweb_Dibs_Model_Dibspw::INFO_TRANSACTION_ID)) {
|
89 |
+
$hdibs->dibsLog('Order already have a DIBS transaction.');
|
90 |
+
|
91 |
return $this;
|
92 |
}
|
93 |
|
147 |
}
|
148 |
}
|
149 |
else {
|
150 |
+
$comment = 'Wrong order state ('.$order->getState().') on #'.$order->getIncrementId();
|
151 |
$hdibs->dibsLog($comment);
|
152 |
+
$hdibs->dibsLog($post);
|
|
|
153 |
}
|
154 |
|
155 |
if (!isset($post['transaction'])) {
|
app/code/community/Trollweb/Dibs/Model/Dibspw/Observer.php
CHANGED
@@ -57,7 +57,12 @@ class Trollweb_Dibs_Model_Dibspw_Observer extends Mage_Core_Model_Abstract
|
|
57 |
$order = $event->getOrder();
|
58 |
if ($order->getId()) {
|
59 |
if ($order->hasInvoices() AND $order->getPayment()->getData('method') == 'dibspw') {
|
60 |
-
$order->
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
}
|
63 |
return $this;
|
@@ -70,4 +75,4 @@ class Trollweb_Dibs_Model_Dibspw_Observer extends Mage_Core_Model_Abstract
|
|
70 |
}
|
71 |
return $this;
|
72 |
}
|
73 |
-
}
|
57 |
$order = $event->getOrder();
|
58 |
if ($order->getId()) {
|
59 |
if ($order->hasInvoices() AND $order->getPayment()->getData('method') == 'dibspw') {
|
60 |
+
foreach ($order->getInvoiceCollection() as $invoice) {
|
61 |
+
if ($invoice->getStatus() != Mage_Sales_Model_Order_Invoice::STATE_CANCELED) {
|
62 |
+
$order->setActionFlag(Mage_Sales_Model_Order::ACTION_FLAG_INVOICE, true);
|
63 |
+
break;
|
64 |
+
}
|
65 |
+
}
|
66 |
}
|
67 |
}
|
68 |
return $this;
|
75 |
}
|
76 |
return $this;
|
77 |
}
|
78 |
+
}
|
app/code/community/Trollweb/Dibs/controllers/DibspwController.php
CHANGED
@@ -32,6 +32,8 @@ class Trollweb_Dibs_DibspwController extends Mage_Core_Controller_Front_Action
|
|
32 |
$post = $this->getRequest()->getParams();
|
33 |
$dibspw = Mage::getModel('dibs/dibspw_callback')->acceptOrder($post);
|
34 |
|
|
|
|
|
35 |
if ($dibspw->getOrder()->getStatus() == $hdibspw->getConfigData('order_status')) {
|
36 |
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
37 |
}
|
@@ -67,7 +69,19 @@ class Trollweb_Dibs_DibspwController extends Mage_Core_Controller_Front_Action
|
|
67 |
}
|
68 |
|
69 |
public function callbackAction() {
|
|
|
|
|
70 |
$post = $this->getRequest()->getParams();
|
|
|
|
|
|
|
|
|
|
|
71 |
$callback = Mage::getModel('dibs/dibspw_callback')->callback($post);
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
}
|
32 |
$post = $this->getRequest()->getParams();
|
33 |
$dibspw = Mage::getModel('dibs/dibspw_callback')->acceptOrder($post);
|
34 |
|
35 |
+
sleep(3);
|
36 |
+
|
37 |
if ($dibspw->getOrder()->getStatus() == $hdibspw->getConfigData('order_status')) {
|
38 |
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
39 |
}
|
69 |
}
|
70 |
|
71 |
public function callbackAction() {
|
72 |
+
$hdibspw = Mage::helper('dibs/dibspw');
|
73 |
+
|
74 |
$post = $this->getRequest()->getParams();
|
75 |
+
|
76 |
+
if (!isset($post['orderId'])) {
|
77 |
+
$this->getResponse()->setHeader('HTTP/1.1','500 Internal Server Error');
|
78 |
+
}
|
79 |
+
|
80 |
$callback = Mage::getModel('dibs/dibspw_callback')->callback($post);
|
81 |
+
|
82 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($post['orderId']);
|
83 |
+
if (!$order->getId() OR $order->getStatus() != $hdibspw->getConfigData('order_status')) {
|
84 |
+
$this->getResponse()->setHeader('HTTP/1.1','500 Internal Server Error');
|
85 |
+
}
|
86 |
}
|
87 |
}
|
app/code/community/Trollweb/Dibs/data/dibs_setup/data-install-1.0.0.php
CHANGED
@@ -1,21 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* DIBS Payment module
|
4 |
-
*
|
5 |
-
* LICENSE AND USAGE INFORMATION
|
6 |
-
* It is NOT allowed to modify, copy or re-sell this file or any
|
7 |
-
* part of it. Please contact us by email at support@trollweb.no or
|
8 |
-
* visit us at www.trollweb.no if you have any questions about this.
|
9 |
-
* Trollweb is not responsible for any problems caused by this file.
|
10 |
-
*
|
11 |
-
* Visit us at http://www.trollweb.no today!
|
12 |
-
*
|
13 |
-
* @category Trollweb
|
14 |
-
* @package Trollweb_Dibs
|
15 |
-
* @copyright Copyright (c) 2013 Trollweb (http://www.trollweb.no)
|
16 |
-
* @license Single-site License
|
17 |
-
*
|
18 |
-
*/
|
19 |
|
20 |
/** @var $installer Mage_Sales_Model_Entity_Setup */
|
21 |
$installer = $this;
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
/** @var $installer Mage_Sales_Model_Entity_Setup */
|
4 |
$installer = $this;
|
app/code/community/Trollweb/Dibs/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Trollweb_Dibs>
|
5 |
-
<version>1.1.
|
6 |
</Trollweb_Dibs>
|
7 |
</modules>
|
8 |
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Trollweb_Dibs>
|
5 |
+
<version>1.1.3</version>
|
6 |
</Trollweb_Dibs>
|
7 |
</modules>
|
8 |
|
package.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>Trollweb_Dibs</name><version>1.1.
|
3 |
<p>The DIBS module from Magento by Trollweb is the only one backed and supported by both DIBS and Trollweb, a leading Magento Payments module developer based in Norway and Sweden.</p>
|
4 |

|
5 |
<strong>100% free</strong><br />
|
@@ -16,4 +16,4 @@
|
|
16 |

|
17 |
<p>If you need help installing and setting up the module we offer basic free support for the module, however any kind of customization and extensive setups are provided at our normalt hourly rates.</p>
|
18 |

|
19 |
-
<p>For more details, visit <a href="http://trollweb.no/dibs">http://trollweb.no/dibs</a>.</p></description><notes>Fixed
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>Trollweb_Dibs</name><version>1.1.3</version><stability>stable</stability><license>MIT</license><channel>community</channel><extends></extends><summary>The DIBS Payment module for Magento, developed and supported by Trollweb Solutions.</summary><description><strong>The DIBS Payment module</strong><br />
|
3 |
<p>The DIBS module from Magento by Trollweb is the only one backed and supported by both DIBS and Trollweb, a leading Magento Payments module developer based in Norway and Sweden.</p>
|
4 |

|
5 |
<strong>100% free</strong><br />
|
16 |

|
17 |
<p>If you need help installing and setting up the module we offer basic free support for the module, however any kind of customization and extensive setups are provided at our normalt hourly rates.</p>
|
18 |

|
19 |
+
<p>For more details, visit <a href="http://trollweb.no/dibs">http://trollweb.no/dibs</a>.</p></description><notes>Fixed callback issues.</notes><authors><author><name>Roy Andre Tollefsen</name><user>royandre</user><email>royandre@trollweb.no</email></author></authors><date>2014-02-25</date><time>5:18:01</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="locale"><dir name="nb_NO"><file name="Trollweb_Dibs.csv" hash="60ca9c9a98f3090b0a7292f1e6b28e0c"/></dir></dir><dir name="code"><dir name="community"><dir name="Trollweb"><dir name="Dibs"><dir name="Model"><file name="Dibspw.php" hash="820da87c53a9e781fcf9bdb2d8660744"/><dir name="Dibspw"><file name="Callback.php" hash="6461ffb964c25d1ae748b450aa2dc8c6"/><file name="Cart.php" hash="411a6006f56a68408ff4506aba35a362"/><file name="Info.php" hash="9ad8989469563cfe53d3b6cf68d9d506"/><file name="Observer.php" hash="db8a399f68514eb4e17e23a5c85d5a1c"/><dir name="Api"><file name="Request.php" hash="8ccf14c0954d43f734233ca0cf583351"/><file name="Result.php" hash="780ab87ac1a6bbdca01b92a217dc942e"/></dir></dir><dir name="Source"><file name="Cctype.php" hash="3f0858b5e684913986e535061861d686"/><file name="Language.php" hash="184def3e555e907192bb8f07e25d89cf"/><file name="Logo.php" hash="c2c7af61b1f948ba22cad9eb42ebe80e"/><file name="Optionalfields.php" hash="0cec2194ae4f379ccd8cfb480aa9a039"/><file name="Paymentaction.php" hash="72641656177c66080896b8a8313a6cb6"/><file name="Taxtype.php" hash="ee6e703a882b3836672a77a0b1a8dc87"/><file name="Timeout.php" hash="3611d291b6660aa217d5ae95fc808197"/></dir><dir name="Entity"><file name="Setup.php" hash="dd96c07255111a38551e39c24fb5547a"/></dir></dir><dir name="data"><dir name="dibs_setup"><file name="data-install-1.0.0.php" hash="94bfc464c6049f0284606b3fbe906eef"/></dir></dir><dir name="controllers"><file name="DibspwController.php" hash="ba70fea094950b23ed807b7dc38e0fd4"/></dir><dir name="Helper"><file name="Data.php" hash="3b4b7e914788a8016230b2ee3c9fe245"/><file name="Dibspw.php" hash="81e727dae8f6d169f5f174cf3c4a5342"/></dir><dir name="Block"><dir name="Dibspw"><file name="Form.php" hash="641369fcf543c94db1acc4c6ac2d1e60"/><file name="PaymentInfo.php" hash="25d502159a8b4783a9272ef0c029c180"/><file name="Redirect.php" hash="09e8f5f7db800c08c807a1816e929cdd"/></dir></dir><dir name="etc"><file name="config.xml" hash="69f123646cb3bd7aff4019c1f3b1ea88"/><file name="system.xml" hash="c6b6b76f6a2afe7df5ca1bb20cb62232"/></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Trollweb_Dibs.xml" hash="912239830f55c9b627038a19b8023e88"/></dir><dir name="template"><dir name="dibs"><dir name="dibspw"><file name="form.phtml" hash="26a735053ff7e74bde5d3c019a479b2d"/><file name="paymentinfo.phtml" hash="ea322fca27fd523ea3f820f9d49b9be1"/><file name="redirect.phtml" hash="fee8316fdd05846e8b8aef45ab45490f"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="dibs"><dir name="dibspw"><file name="form.phtml" hash="5739f81ca605856a9e7bd79915d4c1ca"/><file name="paymentinfo.phtml" hash="9b38da3623d46b6a8a246aab530d9dc0"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Trollweb_Dibs.xml" hash="85fed3975d75a1d3ca9aaf73ad839b76"/></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="trollweb"><dir name="dibs"><dir name="logos"><file name="black.jpg" hash="55dccedd53a923983891869509f68a27"/><file name="blue.jpg" hash="dbe53239b14c5900ab0cc0a9c3c9f9f1"/><file name="green.jpg" hash="c95d2aad8fbb780137dfc8dacc087fa6"/><file name="grey.jpg" hash="99db51b92759e228f01866d71baf3467"/><file name="red.jpg" hash="1c36abdf7e2a2f0d9701ac45517dc55b"/><file name="yellow.jpg" hash="22b3fdfb251a317d48b8cd216d081387"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="trollweb"><dir name="dibs"><dir name="logos"><file name="black.jpg" hash="55dccedd53a923983891869509f68a27"/><file name="blue.jpg" hash="dbe53239b14c5900ab0cc0a9c3c9f9f1"/><file name="green.jpg" hash="c95d2aad8fbb780137dfc8dacc087fa6"/><file name="grey.jpg" hash="99db51b92759e228f01866d71baf3467"/><file name="red.jpg" hash="1c36abdf7e2a2f0d9701ac45517dc55b"/><file name="yellow.jpg" hash="22b3fdfb251a317d48b8cd216d081387"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents></package>
|