Trustly - Version 2.0.4

Version Notes

Download this release

Release Info

Developer Trustly
Extension Trustly
Version 2.0.4
Comparing to
See all releases


Code changes from version 2.0.3 to 2.0.4

Files changed (26) hide show
  1. app/code/local/Trustly/Trustly/Block/Form.php +24 -0
  2. app/code/local/Trustly/Trustly/Block/Redirect.php +24 -0
  3. app/code/local/Trustly/Trustly/Block/System/Config/About.php +24 -0
  4. app/code/local/Trustly/Trustly/Helper/Data.php +24 -0
  5. app/code/local/Trustly/Trustly/Model/Mysql4/Ordermappings.php +57 -0
  6. app/code/local/Trustly/Trustly/Model/Ordermappings.php +34 -0
  7. app/code/local/Trustly/Trustly/Model/Standard.php +24 -0
  8. app/code/local/Trustly/Trustly/controllers/PaymentController.php +46 -4
  9. app/code/local/Trustly/Trustly/etc/config.xml +1 -1
  10. app/code/local/Trustly/Trustly/lib/LICENCE +21 -0
  11. app/code/local/Trustly/Trustly/lib/Trustly.php +24 -0
  12. app/code/local/Trustly/Trustly/lib/Trustly/Api/api.php +23 -0
  13. app/code/local/Trustly/Trustly/lib/Trustly/Api/ecommerce.php +23 -0
  14. app/code/local/Trustly/Trustly/lib/Trustly/Api/signed.php +23 -0
  15. app/code/local/Trustly/Trustly/lib/Trustly/Api/unsigned.php +23 -0
  16. app/code/local/Trustly/Trustly/lib/Trustly/Data/data.php +23 -0
  17. app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcnotificationrequest.php +23 -0
  18. app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcnotificationresponse.php +23 -0
  19. app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcrequest.php +23 -0
  20. app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcresponse.php +23 -0
  21. app/code/local/Trustly/Trustly/lib/Trustly/Data/request.php +23 -0
  22. app/code/local/Trustly/Trustly/lib/Trustly/Data/response.php +23 -0
  23. app/code/local/Trustly/Trustly/lib/Trustly/exceptions.php +23 -0
  24. app/code/local/Trustly/Trustly/sql/trustly_setup/{install-2.0.0.php → install-2.0.4.php} +3 -1
  25. app/code/local/Trustly/Trustly/sql/trustly_setup/upgrade-2.0.3-2.0.4.php +41 -0
  26. package.xml +28 -26
app/code/local/Trustly/Trustly/Block/Form.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /**
4
  * information at checkout within the payment method
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
 
27
  /**
28
  * information at checkout within the payment method
app/code/local/Trustly/Trustly/Block/Redirect.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Trustly_Block_Redirect extends Mage_Core_Block_Template
4
  {
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
 
27
  class Trustly_Trustly_Block_Redirect extends Mage_Core_Block_Template
28
  {
app/code/local/Trustly/Trustly/Block/System/Config/About.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Trustly_Block_System_Config_About extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
4
  {
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
 
27
  class Trustly_Trustly_Block_System_Config_About extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
28
  {
app/code/local/Trustly/Trustly/Helper/Data.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  require_once (Mage::getModuleDir('', 'Trustly_Trustly') . DS . 'lib' . DS .'Trustly.php');
4
 
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
 
27
  require_once (Mage::getModuleDir('', 'Trustly_Trustly') . DS . 'lib' . DS .'Trustly.php');
28
 
app/code/local/Trustly/Trustly/Model/Mysql4/Ordermappings.php CHANGED
@@ -1,4 +1,29 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Trustly_Trustly_Model_Mysql4_Ordermappings extends Mage_Core_Model_Mysql4_Abstract{
3
 
4
  protected function _construct()
@@ -12,5 +37,37 @@ class Trustly_Trustly_Model_Mysql4_Ordermappings extends Mage_Core_Model_Mysql4_
12
  # abstraction...
13
  $this->_init('trustly/ordermappings', 'id');
14
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
  ?>
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
+
27
  class Trustly_Trustly_Model_Mysql4_Ordermappings extends Mage_Core_Model_Mysql4_Abstract{
28
 
29
  protected function _construct()
37
  # abstraction...
38
  $this->_init('trustly/ordermappings', 'id');
39
  }
40
+
41
+ public function lockIncrementForProcessing($incrementId) {
42
+ $lockid = mt_rand(0, 2147483647);
43
+
44
+ $table = $this->getMainTable();
45
+ $wa = $this->_getWriteAdapter();
46
+ $ra = $this->_getReadAdapter();
47
+
48
+ $update_where = $wa->quoteInto('magento_increment_id = ? AND (lock_timestamp IS NULL OR lock_timestamp < NOW() - INTERVAL 1 minute)', $incrementId);
49
+ $update = $wa->update($table, array('lock_timestamp' => new Zend_Db_Expr('NOW()'), 'lock_id' => $lockid), $update_where);
50
+
51
+ $verify_where = $ra->quoteInto('magento_increment_id = ?', $incrementId);
52
+ $select = $ra->select()->from($table)->reset('columns')->columns(array('lock_id'))->where($verify_where);
53
+ $verify_lockid = $ra->fetchOne($select);
54
+
55
+ if($verify_lockid == $lockid) {
56
+ return $lockid;
57
+ }
58
+ return FALSE;
59
+ }
60
+
61
+ public function unlockIncrementAfterProcessing($incrementId, $lockid) {
62
+ $table = $this->getMainTable();
63
+ $wa = $this->_getWriteAdapter();
64
+
65
+ $update_where = $wa->quoteInto('magento_increment_id = ?', $incrementId) . ' AND ' .
66
+ $wa->quoteInto('lock_id = ?', $lockid);
67
+
68
+ $update = $wa->update($table, array('lock_timestamp' => NULL, 'lock_id' => NULL), $update_where);
69
+
70
+ return TRUE;
71
+ }
72
  }
73
  ?>
app/code/local/Trustly/Trustly/Model/Ordermappings.php CHANGED
@@ -1,4 +1,29 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Trustly_Trustly_Model_Ordermappings extends Mage_Core_Model_Abstract
3
  {
4
  protected function _construct()
@@ -10,5 +35,14 @@ class Trustly_Trustly_Model_Ordermappings extends Mage_Core_Model_Abstract
10
  {
11
  return $this->load($trustlyOrderId, 'trustly_order_id');
12
  }
 
 
 
 
 
 
 
 
13
  }
 
14
  ?>
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
+
27
  class Trustly_Trustly_Model_Ordermappings extends Mage_Core_Model_Abstract
28
  {
29
  protected function _construct()
35
  {
36
  return $this->load($trustlyOrderId, 'trustly_order_id');
37
  }
38
+
39
+ public function lockIncrementForProcessing($incrementId) {
40
+ return $this->getResource()->lockIncrementForProcessing($incrementId);
41
+ }
42
+
43
+ public function unlockIncrementAfterProcessing($incrementId, $lockid) {
44
+ return $this->getResource()->unlockIncrementAfterProcessing($incrementId, $lockid);
45
+ }
46
  }
47
+
48
  ?>
app/code/local/Trustly/Trustly/Model/Standard.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
 
4
  class Trustly_Trustly_Model_Standard extends Mage_Payment_Model_Method_Abstract
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
 
27
 
28
  class Trustly_Trustly_Model_Standard extends Mage_Payment_Model_Method_Abstract
app/code/local/Trustly/Trustly/controllers/PaymentController.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Action
4
  {
@@ -112,7 +136,7 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
112
  try {
113
  $notification = $api->handleNotification($httpBody);
114
  } catch(Trustly_JSONRPCVersionException $e) {
115
- Mage::log("Got incoming notification with invalid json rpc version (".$e."), message was ".$e->getBadData(), Zend_Log::WARN, self::LOG_FILE);
116
  return ;
117
  } catch(Trustly_SignatureException $e) {
118
  Mage::log("Got incoming notification with invalid signature (".$e."), message was ".$e->getBadData(), Zend_Log::WARN, self::LOG_FILE);
@@ -151,12 +175,24 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
151
  Mage::getSingleton('checkout/session')->addError(Mage::helper('trustly')->__("Cannot find the relation of Trustly orderid %s for user %s.", $trustlyOrderId, $notification->getData('enduserid')));
152
  session_write_close();
153
 
154
- Mage::log("Could not find the mapping of Trustly orderid $trustlyOrderId in the incoming notification. incrmentid $incrementId Enduser is ".$notification->getData('enduserid'), Zend_Log::WARN, self::LOG_FILE);
155
- $this->_redirect('checkout/cart', array('_secure'=>Mage::app()->getStore()->isCurrentlySecure()));
156
 
157
  return;
158
  }
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  $order->loadByIncrementId($incrementId);
161
  $realOrderId = $order->getRealOrderId();
162
 
@@ -167,7 +203,8 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
167
  session_write_close();
168
 
169
  Mage::log("Could not find the order with increment $incrementId (Trustly orderid $trustlyOrderId) in the incoming notification", Zend_Log::WARN, self::LOG_FILE);
170
- $this->_redirect('checkout/cart', array('_secure'=>Mage::app()->getStore()->isCurrentlySecure()));
 
171
 
172
  return;
173
  }
@@ -196,6 +233,7 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
196
  if (is_null($trustly_payment)) {
197
  Mage::helper('trustly')->sendResponseNotification($notification, true);
198
  Mage::log(sprintf("Recieved payment notification for order %s, but payment method is %s, not Trustly", $incrementId, $trustly_payment->getMethod()), Zend_Log::WARN, self::LOG_FILE);
 
199
  return ;
200
  }
201
 
@@ -218,6 +256,7 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
218
  if(isset($notification_transaction)) {
219
  Mage::helper('trustly')->sendResponseNotification($notification, true);
220
  Mage::log(sprintf("Received notification %s already processed", $trustlyNotificationId), Zend_Log::DEBUG, self::LOG_FILE);
 
221
  return ;
222
  }
223
 
@@ -338,6 +377,7 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
338
  * contents of it */
339
  Mage::helper('trustly')->sendResponseNotification($notification, true);
340
 
 
341
  return;
342
  }
343
 
@@ -457,6 +497,8 @@ class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Actio
457
 
458
  $transactionSave->save();
459
  Mage::helper('trustly')->sendResponseNotification($notification, true);
 
 
460
  }
461
  }
462
 
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
 
27
  class Trustly_Trustly_PaymentController extends Mage_Core_Controller_Front_Action
28
  {
136
  try {
137
  $notification = $api->handleNotification($httpBody);
138
  } catch(Trustly_JSONRPCVersionException $e) {
139
+ Mage::log("Got incoming notification with invalid json rpc version (".$e.")", Zend_Log::WARN, self::LOG_FILE);
140
  return ;
141
  } catch(Trustly_SignatureException $e) {
142
  Mage::log("Got incoming notification with invalid signature (".$e."), message was ".$e->getBadData(), Zend_Log::WARN, self::LOG_FILE);
175
  Mage::getSingleton('checkout/session')->addError(Mage::helper('trustly')->__("Cannot find the relation of Trustly orderid %s for user %s.", $trustlyOrderId, $notification->getData('enduserid')));
176
  session_write_close();
177
 
178
+ Mage::log("Could not find the mapping of Trustly orderid $trustlyOrderId in the incoming notification. incrementid $incrementId Enduser is ".$notification->getData('enduserid'), Zend_Log::WARN, self::LOG_FILE);
 
179
 
180
  return;
181
  }
182
 
183
+ /* Due to race conditions we need to handle the processing
184
+ * for this order one at a time only. Otherwise we might
185
+ * end up processing the credit and pending
186
+ * notifications at the same time. */
187
+ $increment_lockid = $orderMapping->lockIncrementForProcessing($incrementId);
188
+ if($increment_lockid === false) {
189
+ /* If we cannot lock this increment abort now, respond
190
+ * nothing we will get a new attempt later */
191
+ Mage::log("Attempt to process already locked magento increment $incrementId", Zend_Log::DEBUG, self::LOG_FILE);
192
+ session_write_close();
193
+ return ;
194
+ }
195
+
196
  $order->loadByIncrementId($incrementId);
197
  $realOrderId = $order->getRealOrderId();
198
 
203
  session_write_close();
204
 
205
  Mage::log("Could not find the order with increment $incrementId (Trustly orderid $trustlyOrderId) in the incoming notification", Zend_Log::WARN, self::LOG_FILE);
206
+
207
+ $orderMapping->unlockIncrementAfterProcessing($incrementId, $increment_lockid);
208
 
209
  return;
210
  }
233
  if (is_null($trustly_payment)) {
234
  Mage::helper('trustly')->sendResponseNotification($notification, true);
235
  Mage::log(sprintf("Recieved payment notification for order %s, but payment method is %s, not Trustly", $incrementId, $trustly_payment->getMethod()), Zend_Log::WARN, self::LOG_FILE);
236
+ $orderMapping->unlockIncrementAfterProcessing($incrementId, $increment_lockid);
237
  return ;
238
  }
239
 
256
  if(isset($notification_transaction)) {
257
  Mage::helper('trustly')->sendResponseNotification($notification, true);
258
  Mage::log(sprintf("Received notification %s already processed", $trustlyNotificationId), Zend_Log::DEBUG, self::LOG_FILE);
259
+ $orderMapping->unlockIncrementAfterProcessing($incrementId, $increment_lockid);
260
  return ;
261
  }
262
 
377
  * contents of it */
378
  Mage::helper('trustly')->sendResponseNotification($notification, true);
379
 
380
+ $orderMapping->unlockIncrementAfterProcessing($incrementId, $increment_lockid);
381
  return;
382
  }
383
 
497
 
498
  $transactionSave->save();
499
  Mage::helper('trustly')->sendResponseNotification($notification, true);
500
+
501
+ $orderMapping->unlockIncrementAfterProcessing($incrementId, $increment_lockid);
502
  }
503
  }
504
 
app/code/local/Trustly/Trustly/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Trustly_Trustly>
5
- <version>2.0.3</version>
6
  </Trustly_Trustly>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Trustly_Trustly>
5
+ <version>2.0.4</version>
6
  </Trustly_Trustly>
7
  </modules>
8
  <global>
app/code/local/Trustly/Trustly/lib/LICENCE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Troustly Group AB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
app/code/local/Trustly/Trustly/lib/Trustly.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  require_once('Trustly/exceptions.php');
3
  require_once('Trustly/Data/data.php');
4
  require_once('Trustly/Data/request.php');
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+
26
  require_once('Trustly/exceptions.php');
27
  require_once('Trustly/Data/data.php');
28
  require_once('Trustly/Data/request.php');
app/code/local/Trustly/Trustly/lib/Trustly/Api/api.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  abstract class Trustly_Api {
4
  /* Hostname, port and protocol information about how to reach the API */
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  abstract class Trustly_Api {
27
  /* Hostname, port and protocol information about how to reach the API */
app/code/local/Trustly/Trustly/lib/Trustly/Api/ecommerce.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Api_ECommerce extends Trustly_Api {
4
  var $api_apikey = NULL;
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Api_ECommerce extends Trustly_Api {
27
  var $api_apikey = NULL;
app/code/local/Trustly/Trustly/lib/Trustly/Api/signed.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Api_Signed extends Trustly_Api {
4
  var $merchant_privatekey = NULL;
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Api_Signed extends Trustly_Api {
27
  var $merchant_privatekey = NULL;
app/code/local/Trustly/Trustly/lib/Trustly/Api/unsigned.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Api_Unsigned extends Trustly_Api {
4
  /* Login criterias when using the unsigned API. Only used by the
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Api_Unsigned extends Trustly_Api {
27
  /* Login criterias when using the unsigned API. Only used by the
app/code/local/Trustly/Trustly/lib/Trustly/Data/data.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Data {
4
  var $payload = NULL;
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Data {
27
  var $payload = NULL;
app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcnotificationrequest.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Data_JSONRPCNotificationRequest extends Trustly_Data {
4
  var $notification_body = NULL;
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Data_JSONRPCNotificationRequest extends Trustly_Data {
27
  var $notification_body = NULL;
app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcnotificationresponse.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Data_JSONRPCNotificationResponse extends Trustly_Data {
4
 
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Data_JSONRPCNotificationResponse extends Trustly_Data {
27
 
app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcrequest.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Data_JSONRPCRequest extends Trustly_Data_Request {
4
 
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Data_JSONRPCRequest extends Trustly_Data_Request {
27
 
app/code/local/Trustly/Trustly/lib/Trustly/Data/jsonrpcresponse.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Data_JSONRPCResponse extends Trustly_Data_Response {
4
 
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Data_JSONRPCResponse extends Trustly_Data_Response {
27
 
app/code/local/Trustly/Trustly/lib/Trustly/Data/request.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Data_Request extends Trustly_Data {
4
 
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Data_Request extends Trustly_Data {
27
 
app/code/local/Trustly/Trustly/lib/Trustly/Data/response.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_Data_Response extends Trustly_Data {
4
  /* Raw copy of the incoming response body */
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_Data_Response extends Trustly_Data {
27
  /* Raw copy of the incoming response body */
app/code/local/Trustly/Trustly/lib/Trustly/exceptions.php CHANGED
@@ -1,4 +1,27 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Trustly_ConnectionException extends Exception { }
4
 
1
  <?php
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2014 Trustly Group AB
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
 
26
  class Trustly_ConnectionException extends Exception { }
27
 
app/code/local/Trustly/Trustly/sql/trustly_setup/{install-2.0.0.php → install-2.0.4.php} RENAMED
@@ -4,9 +4,11 @@ $installer->startSetup();
4
  if(!$installer->getConnection()->isTableExists($installer->getTable('trustly/ordermappings'))) {
5
  $table = $installer->getConnection()->newTable($installer->getTable('trustly/ordermappings'))
6
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'primary' => true, 'identity' => true), 'Dummy id')
7
- ->addColumn('trustly_order_id', Varien_Db_Ddl_Table::TYPE_BIGINT, null, array('unsigned' => true, 'nullable' => false), 'Trustly Orderid')
8
  ->addColumn('magento_increment_id', Varien_Db_Ddl_Table::TYPE_BIGINT, null, array('unsigned' => true, 'nullable' => false), 'Magento Increment id')
9
  ->addColumn('datestamp', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'Timestamp')
 
 
10
  ->setComment('Mapping between trustly OrderId information and the Magento orders')
11
  ->addIndex($installer->getIdxName(
12
  $installer->getTable('trustly/ordermappings'),
4
  if(!$installer->getConnection()->isTableExists($installer->getTable('trustly/ordermappings'))) {
5
  $table = $installer->getConnection()->newTable($installer->getTable('trustly/ordermappings'))
6
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'primary' => true, 'identity' => true), 'Dummy id')
7
+ ->addColumn('trustly_order_id', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array('nullable' => false), 'Trustly Orderid')
8
  ->addColumn('magento_increment_id', Varien_Db_Ddl_Table::TYPE_BIGINT, null, array('unsigned' => true, 'nullable' => false), 'Magento Increment id')
9
  ->addColumn('datestamp', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(), 'Timestamp')
10
+ ->addColumn('lock_timestamp', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => true), 'Lock timestamp')
11
+ ->addColumn('lock_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => true), 'Lock process id')
12
  ->setComment('Mapping between trustly OrderId information and the Magento orders')
13
  ->addIndex($installer->getIdxName(
14
  $installer->getTable('trustly/ordermappings'),
app/code/local/Trustly/Trustly/sql/trustly_setup/upgrade-2.0.3-2.0.4.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $connection = $installer->getConnection();
4
+ $ordermappingstable = $installer->getTable('trustly/ordermappings');
5
+
6
+ $installer->startSetup();
7
+
8
+ $connection->modifyColumn(
9
+ $ordermappingstable,
10
+ 'trustly_order_id',
11
+ array(
12
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
13
+ 'length' => 20,
14
+ 'nullable' => false,
15
+ 'comment' => 'Trustly Orderid'
16
+ )
17
+ );
18
+
19
+ $connection->addColumn(
20
+ $ordermappingstable,
21
+ 'lock_timestamp',
22
+ array(
23
+ 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
24
+ 'nullable' => true,
25
+ 'comment' => 'Lock timestamp'
26
+ )
27
+ );
28
+
29
+ $connection->addColumn(
30
+ $ordermappingstable,
31
+ 'lock_id',
32
+ array(
33
+ 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
34
+ 'unsigned' => true,
35
+ 'nullable' => true,
36
+ 'comment' => 'Lock process id'
37
+ )
38
+ );
39
+
40
+ $installer->endSetup();
41
+ ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Trustly</name>
4
- <version>2.0.3</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>2014-05-28</date>
20
- <time>11:50:42</time>
21
  <contents>
22
  <target name="magelocale">
23
  <dir name="da_DK">
@@ -48,27 +48,27 @@
48
  <dir name="Block">
49
  <dir name="System">
50
  <dir name="Config">
51
- <file name="About.php" hash="4a3f439de6a55140019c06ceebe478e7"/>
52
  </dir>
53
  </dir>
54
- <file name="Form.php" hash="b39bb8b1c64a5b85ce9efafd67c9be93"/>
55
- <file name="Redirect.php" hash="26a0edaf05b92587a7496295eeabd459"/>
56
  </dir>
57
  <dir name="Helper">
58
- <file name="Data.php" hash="7d3cd49f938d49e96aabfb9aaff90948"/>
59
  </dir>
60
  <dir name="Model">
61
  <dir name="Mysql4">
62
- <file name="Ordermappings.php" hash="c9dd983701fc530c449fd291752a3fe7"/>
63
  </dir>
64
- <file name="Ordermappings.php" hash="e6c2780307ea63c1572b2851ec5664d8"/>
65
- <file name="Standard.php" hash="3cdbe677cb889c86f14c2522579133b1"/>
66
  </dir>
67
  <dir name="controllers">
68
- <file name="PaymentController.php" hash="e00d81b479dd16a68b90a71cc810bf92"/>
69
  </dir>
70
  <dir name="etc">
71
- <file name="config.xml" hash="e112060663639f8c09be134e0e49e7af"/>
72
  <file name="system.xml" hash="28993e0c9c79829b12cbcea209967be4"/>
73
  </dir>
74
  <dir name="lib">
@@ -78,28 +78,30 @@
78
  <file name="test.trustly.com.public.pem" hash="e61b3f9fc1e3893282fe2d575dc5571a"/>
79
  <file name="trustly.com.public.pem" hash="b2c821ad10c085a40b6c4e36ee6b8c9e"/>
80
  </dir>
81
- <file name="api.php" hash="2ea7e226b2e13f0f4bee7048d2ac9d88"/>
82
- <file name="ecommerce.php" hash="6a52360de0ae7aaf313058e141f0cdae"/>
83
- <file name="signed.php" hash="3f8b3206f6050bf9d1c9d2b22c6f7ed6"/>
84
- <file name="unsigned.php" hash="2f25273f6aa94e776c5b01486eaf1450"/>
85
  </dir>
86
  <dir name="Data">
87
- <file name="data.php" hash="6d30d0f50d65a63ea41ce450011c4c90"/>
88
- <file name="jsonrpcnotificationrequest.php" hash="c73767f1c08074d88e91b74172708685"/>
89
- <file name="jsonrpcnotificationresponse.php" hash="c1742dda1252c218c59b43d97f331aa2"/>
90
- <file name="jsonrpcrequest.php" hash="0d8a0019eea8d4a1f2fe8cd3b4c92318"/>
91
- <file name="jsonrpcresponse.php" hash="49928cfd29327e0107dc5b8dca5a030b"/>
92
- <file name="request.php" hash="c3641942bd271784485a91de68390f59"/>
93
- <file name="response.php" hash="c4d2ef0fc91fc49a111dbcfa28135138"/>
94
  </dir>
95
- <file name="exceptions.php" hash="7a51e14965e1c0b1998d347a1638bf68"/>
96
  </dir>
97
- <file name="Trustly.php" hash="84ab59b5cd271ec5d3c94f103e556c7f"/>
 
98
  </dir>
99
  <dir name="sql">
100
  <dir name="trustly_setup">
101
- <file name="install-2.0.0.php" hash="65bd1283d4a04825428b27a7c48a3b14"/>
102
  <file name="upgrade-1.0.4-2.0.0.php" hash="2badbe7703f9416f88f0a9cf458a8b5e"/>
 
103
  </dir>
104
  </dir>
105
  </dir>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Trustly</name>
4
+ <version>2.0.4</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>2014-06-17</date>
20
+ <time>13:22:04</time>
21
  <contents>
22
  <target name="magelocale">
23
  <dir name="da_DK">
48
  <dir name="Block">
49
  <dir name="System">
50
  <dir name="Config">
51
+ <file name="About.php" hash="ef187a0190cd508950103a80b80469ab"/>
52
  </dir>
53
  </dir>
54
+ <file name="Form.php" hash="8694b30c33e2e9fa096eaf1b6d2eb221"/>
55
+ <file name="Redirect.php" hash="33bf3038c097080b4a723babd09a743f"/>
56
  </dir>
57
  <dir name="Helper">
58
+ <file name="Data.php" hash="5d345dbe353c2d6c236e7daa7dbe3b6a"/>
59
  </dir>
60
  <dir name="Model">
61
  <dir name="Mysql4">
62
+ <file name="Ordermappings.php" hash="5372011caf25ca770d8c43922925c563"/>
63
  </dir>
64
+ <file name="Ordermappings.php" hash="e1053123e3f2ba61b0d1a52b1fd2c831"/>
65
+ <file name="Standard.php" hash="1aa2b74d08bbb35fb020ba28f4e0b1c1"/>
66
  </dir>
67
  <dir name="controllers">
68
+ <file name="PaymentController.php" hash="dd2fa8f726bcb103379ba9e51944bf50"/>
69
  </dir>
70
  <dir name="etc">
71
+ <file name="config.xml" hash="0b470ee4b4bafd345c0f92ca49efd713"/>
72
  <file name="system.xml" hash="28993e0c9c79829b12cbcea209967be4"/>
73
  </dir>
74
  <dir name="lib">
78
  <file name="test.trustly.com.public.pem" hash="e61b3f9fc1e3893282fe2d575dc5571a"/>
79
  <file name="trustly.com.public.pem" hash="b2c821ad10c085a40b6c4e36ee6b8c9e"/>
80
  </dir>
81
+ <file name="api.php" hash="5afb8836cf39828eaf685c6db6166b5c"/>
82
+ <file name="ecommerce.php" hash="54e3b19bba389956afb71b5e31c6c1c8"/>
83
+ <file name="signed.php" hash="47db2a74779ae5c554d4b7439d9751e3"/>
84
+ <file name="unsigned.php" hash="5d667d0863cb5e84fe0365da95e7b6c4"/>
85
  </dir>
86
  <dir name="Data">
87
+ <file name="data.php" hash="fce249eeec0ecaebc5052fb77b6631c5"/>
88
+ <file name="jsonrpcnotificationrequest.php" hash="723ba8d9ec08bb8a988dcb1c3918776f"/>
89
+ <file name="jsonrpcnotificationresponse.php" hash="d4c5d350380ff149e74e6855dc10123d"/>
90
+ <file name="jsonrpcrequest.php" hash="a72ee040fac312a5ef124de4af7ccb8f"/>
91
+ <file name="jsonrpcresponse.php" hash="617fef3a4e029d9320f7426502e6a5c8"/>
92
+ <file name="request.php" hash="44822805f50a4520f53a4b1a2722295a"/>
93
+ <file name="response.php" hash="39433a754c395a863aaa76f1bbba4527"/>
94
  </dir>
95
+ <file name="exceptions.php" hash="e583e378d6f3f6e4fe2eadcf9b3f6ee4"/>
96
  </dir>
97
+ <file name="LICENCE" hash="8713032dd477873c84ed4ff4b7da5f70"/>
98
+ <file name="Trustly.php" hash="e7115c7872a87c2191b4f90b0dc0e97a"/>
99
  </dir>
100
  <dir name="sql">
101
  <dir name="trustly_setup">
102
+ <file name="install-2.0.4.php" hash="ca6855a238407e68356568c9c5a380ee"/>
103
  <file name="upgrade-1.0.4-2.0.0.php" hash="2badbe7703f9416f88f0a9cf458a8b5e"/>
104
+ <file name="upgrade-2.0.3-2.0.4.php" hash="1e826daddf5f2204e14142d6cac6d2a4"/>
105
  </dir>
106
  </dir>
107
  </dir>