2
2
3
3
/**
4
4
* Copyright (c) 2012-2014, Mollie B.V.
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- *
10
- * - Redistributions of source code must retain the above copyright notice,
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ *
10
+ * - Redistributions of source code must retain the above copyright notice,
11
11
* this list of conditions and the following disclaimer.
12
- * - Redistributions in binary form must reproduce the above copyright
12
+ * - Redistributions in binary form must reproduce the above copyright
13
13
* notice, this list of conditions and the following disclaimer in the
14
14
* documentation and/or other materials provided with the distribution.
15
- *
16
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
20
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26
- * DAMAGE.
15
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
20
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26
+ * DAMAGE.
27
27
*
28
28
* @category Mollie
29
29
* @package Mollie_Mpm
30
30
* @author Mollie B.V. ([email protected] )
31
- * @version v4.0.0
31
+ * @version v4.0.2
32
32
* @copyright Copyright (c) 2012-2014 Mollie B.V. (https://www.mollie.nl)
33
33
* @license http://www.opensource.org/licenses/bsd-license.php Berkeley Software Distribution License (BSD-License 2)
34
- *
34
+ *
35
35
**/
36
36
37
37
class Mollie_Mpm_Helper_Data extends Mage_Core_Helper_Abstract
@@ -47,12 +47,12 @@ public function getStatusById($transaction_id)
47
47
/** @var $connection Varien_Db_Adapter_Interface */
48
48
$ connection = Mage::getSingleton ('core/resource ' )->getConnection ('core_read ' );
49
49
$ status = $ connection ->fetchAll (
50
- sprintf (
51
- "SELECT `bank_status` FROM `%s` WHERE `transaction_id` = %s " ,
52
- Mage::getSingleton ('core/resource ' )->getTableName ('mollie_payments ' ),
53
- $ connection ->quote ($ transaction_id )
54
- )
55
- );
50
+ sprintf (
51
+ "SELECT `bank_status` FROM `%s` WHERE `transaction_id` = %s " ,
52
+ Mage::getSingleton ('core/resource ' )->getTableName ('mollie_payments ' ),
53
+ $ connection ->quote ($ transaction_id )
54
+ )
55
+ );
56
56
57
57
return $ status [0 ];
58
58
}
@@ -67,12 +67,12 @@ public function getOrderIdByTransactionId($transaction_id)
67
67
/** @var $connection Varien_Db_Adapter_Interface */
68
68
$ connection = Mage::getSingleton ('core/resource ' )->getConnection ('core_read ' );
69
69
$ id = $ connection ->fetchAll (
70
- sprintf (
71
- "SELECT `order_id` FROM `%s` WHERE `transaction_id` = %s " ,
72
- Mage::getSingleton ('core/resource ' )->getTableName ('mollie_payments ' ),
73
- $ connection ->quote ($ transaction_id )
74
- )
75
- );
70
+ sprintf (
71
+ "SELECT `order_id` FROM `%s` WHERE `transaction_id` = %s " ,
72
+ Mage::getSingleton ('core/resource ' )->getTableName ('mollie_payments ' ),
73
+ $ connection ->quote ($ transaction_id )
74
+ )
75
+ );
76
76
77
77
if (sizeof ($ id ) > 0 )
78
78
{
@@ -105,6 +105,36 @@ public function getTransactionIdByOrderId($order_id)
105
105
return NULL ;
106
106
}
107
107
108
+ public function getStoredMethods ()
109
+ {
110
+ $ connection = Mage::getSingleton ('core/resource ' )->getConnection ('core_read ' );
111
+ //$connection->setFetchMode(Zend_Db::FETCH_OBJ);
112
+ $ methods = $ connection ->fetchAll (
113
+ sprintf (
114
+ "SELECT * FROM `%s` " ,
115
+ Mage::getSingleton ('core/resource ' )->getTableName ('mollie_methods ' )
116
+ )
117
+ );
118
+ return $ methods ;
119
+ }
120
+
121
+ public function setStoredMethods ($ methods )
122
+ {
123
+ $ connection = Mage::getSingleton ('core/resource ' )->getConnection ('core_write ' );
124
+ $ connection ->query (sprintf ('TRUNCATE TABLE `%s` ' , Mage::getSingleton ('core/resource ' )->getTableName ('mollie_methods ' )));
125
+ foreach ($ methods as $ method )
126
+ {
127
+ $ connection ->insert (
128
+ Mage::getSingleton ('core/resource ' )->getTableName ('mollie_methods ' ),
129
+ array (
130
+ 'method_id ' => $ method ['method_id ' ],
131
+ 'description ' => $ method ['description ' ],
132
+ )
133
+ );
134
+ }
135
+ return $ this ;
136
+ }
137
+
108
138
/**
109
139
* Gets Api key from `config_core_data`
110
140
*
@@ -125,7 +155,7 @@ public function getApiKey()
125
155
*/
126
156
public function getConfig ($ paymentmethod = NULL , $ key = NULL )
127
157
{
128
- $ arr = array ('active ' , 'apikey ' , 'description ' , 'skip_invoice ' , 'show_images ' );
158
+ $ arr = array ('active ' , 'apikey ' , 'description ' , 'skip_invoice ' , 'show_images ' , ' webhook_tested ' );
129
159
$ paymentmethods = array ('mollie ' );
130
160
131
161
if (in_array ($ key , $ arr ) && in_array ($ paymentmethod , $ paymentmethods ))
@@ -154,6 +184,7 @@ public function getModuleStatus($method_count, $method_limit)
154
184
Mage::getRoot () .'/code/community/Mollie/Mpm/Helper/Data.php ' ,
155
185
Mage::getRoot () .'/code/community/Mollie/Mpm/Helper/Api.php ' ,
156
186
Mage::getRoot () .'/code/community/Mollie/Mpm/Model/Api.php ' ,
187
+ Mage::getRoot () .'/code/community/Mollie/Mpm/Model/Idl.php ' ,
157
188
Mage::getRoot () .'/code/community/Mollie/Mpm/Model/Void00.php ' ,
158
189
159
190
Mage::getRoot () .'/design/adminhtml/default/default/template/mollie/system/config/status.phtml ' ,
@@ -200,6 +231,13 @@ public function getModuleStatus($method_count, $method_limit)
200
231
}
201
232
202
233
234
+ // Check if webhook is set
235
+ if (!Mage::Helper ('mpm/data ' )->getConfig ('mollie ' , 'webhook_tested ' ))
236
+ {
237
+ return '<b> ' .$ core ->__ ('Webhook not set! ' ).'</b><br /><span style="color:red;"> ' .$ core ->__ ('Warning: It seems you have not set a webhook in your Mollie profile. ' ).'</span><br /> ' ;
238
+ }
239
+
240
+
203
241
// check deprecated files
204
242
$ deprFiles = array ();
205
243
$ oldFiles = array (
@@ -208,7 +246,6 @@ public function getModuleStatus($method_count, $method_limit)
208
246
Mage::getRoot () .'/code/community/Mollie/Mpm/Block/Payment/Idl/Info.php ' ,
209
247
Mage::getRoot () .'/code/community/Mollie/Mpm/controllers/IdlController.php ' ,
210
248
Mage::getRoot () .'/code/community/Mollie/Mpm/Helper/Idl.php ' ,
211
- Mage::getRoot () .'/code/community/Mollie/Mpm/Model/Idl.php ' ,
212
249
Mage::getRoot () .'/design/frontend/base/default/template/mollie/form/idl.phtml ' ,
213
250
Mage::getRoot () .'/design/frontend/base/default/template/mollie/form/api.phtml ' ,
214
251
);
0 commit comments