klarnapayments - Version 5.5.1

Version Notes

This version is not compatible with any Klarna module version of 4.x or earlier.

Download this release

Release Info

Developer Klarna
Extension klarnapayments
Version 5.5.1
Comparing to
See all releases


Code changes from version 5.3.55 to 5.5.1

Files changed (56) hide show
  1. app/code/community/Vaimo/Klarna/Block/Form/Abstract.php +83 -14
  2. app/code/community/Vaimo/Klarna/Block/Klarnacheckout/Klarnacheckout.php +16 -10
  3. app/code/community/Vaimo/Klarna/Helper/Data.php +288 -25
  4. app/code/community/Vaimo/Klarna/Model/Api/Abstract.php +26 -7
  5. app/code/community/Vaimo/Klarna/Model/Api/Kco.php +82 -13
  6. app/code/community/Vaimo/Klarna/Model/Api/Rest.php +100 -48
  7. app/code/community/Vaimo/Klarna/Model/Creditmemo/Tax.php +4 -4
  8. app/code/community/Vaimo/Klarna/Model/Creditmemo/Total.php +4 -4
  9. app/code/community/Vaimo/Klarna/Model/Cron.php +9 -73
  10. app/code/community/Vaimo/Klarna/Model/Klarna.php +45 -28
  11. app/code/community/Vaimo/Klarna/Model/Klarna/Abstract.php +35 -9
  12. app/code/community/Vaimo/Klarna/Model/Klarnacheckout.php +152 -100
  13. app/code/community/Vaimo/Klarna/Model/Klarnacheckout/History.php +76 -0
  14. app/code/community/Vaimo/Klarna/Model/Klarnacheckout/Semaphore.php +123 -0
  15. app/code/community/Vaimo/Klarna/Model/{Pushqueue.php → Log.php} +4 -10
  16. app/code/community/Vaimo/Klarna/Model/Log/Data.php +47 -0
  17. app/code/community/Vaimo/Klarna/Model/Observer.php +23 -0
  18. app/code/community/Vaimo/Klarna/Model/Payment/Abstract.php +32 -5
  19. app/code/community/Vaimo/Klarna/Model/Resource/Klarnacheckout/History.php +55 -0
  20. app/code/community/Vaimo/Klarna/Model/Resource/Klarnacheckout/History/Collection.php +33 -0
  21. app/code/community/Vaimo/Klarna/Model/Resource/Klarnacheckout/Semaphore.php +54 -0
  22. app/code/community/Vaimo/Klarna/Model/Resource/{Pushqueue → Klarnacheckout/Semaphore}/Collection.php +5 -6
  23. app/code/community/Vaimo/Klarna/Model/Resource/Log.php +46 -0
  24. app/code/community/Vaimo/Klarna/Model/Resource/Log/Collection.php +33 -0
  25. app/code/community/Vaimo/Klarna/Model/Resource/Log/Data.php +47 -0
  26. app/code/community/Vaimo/Klarna/Model/Resource/Log/Data/Collection.php +33 -0
  27. app/code/community/Vaimo/Klarna/Model/{Resource/Pushqueue.php → Source/Loglevel.php} +9 -22
  28. app/code/community/Vaimo/Klarna/Model/Transport/Abstract.php +139 -0
  29. app/code/community/Vaimo/Klarna/controllers/Checkout/KlarnaController.php +157 -79
  30. app/code/community/Vaimo/Klarna/etc/config.xml +47 -11
  31. app/code/community/Vaimo/Klarna/etc/system.xml +367 -215
  32. app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.3.4-5.3.5.php +2 -2
  33. app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.3.63-5.3.64.php +68 -0
  34. app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.3.64-5.3.65.php +78 -0
  35. app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.4.10-5.4.11.php +155 -0
  36. app/design/frontend/base/default/template/vaimo/klarna/form/address/search.phtml +0 -13
  37. app/design/frontend/base/default/template/vaimo/klarna/form/children/addressresult.phtml +22 -6
  38. app/design/frontend/base/default/template/vaimo/klarna/form/children/checkoutservice.phtml +11 -2
  39. app/design/frontend/base/default/template/vaimo/klarna/form/invoice.phtml +8 -0
  40. app/design/frontend/base/default/template/vaimo/klarna/klarnacheckout/discount/giftcardaccount.phtml +1 -1
  41. app/locale/da_DK/Vaimo_Klarna.csv +46 -1
  42. app/locale/de_AT/Vaimo_Klarna.csv +46 -1
  43. app/locale/de_DE/Vaimo_Klarna.csv +48 -2
  44. app/locale/fi_FI/Vaimo_Klarna.csv +43 -2
  45. app/locale/nb_NO/Vaimo_Klarna.csv +46 -1
  46. app/locale/nl_NL/Vaimo_Klarna.csv +47 -2
  47. app/locale/nn_NO/Vaimo_Klarna.csv +46 -1
  48. app/locale/sv_SE/Vaimo_Klarna.csv +43 -19
  49. js/vaimo/klarna/klarnacheckout.js +38 -11
  50. lib/Klarna/pclasses/mysqlstorage.class.php +24 -21
  51. lib/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc +20 -0
  52. lib/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpcs.inc +5 -0
  53. package.xml +4 -4
  54. skin/frontend/base/default/css/vaimo/klarna/checkout.css +97 -27
  55. skin/frontend/base/default/css/vaimo/klarna/checkout_osc.css +65 -7
  56. skin/frontend/base/default/css/vaimo/klarna/klarnacheckout.css +1 -1
app/code/community/Vaimo/Klarna/Block/Form/Abstract.php CHANGED
@@ -26,7 +26,7 @@
26
  class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
27
  {
28
  protected $_pclasses = array();
29
-
30
  public function __construct()
31
  {
32
  parent::__construct();
@@ -57,7 +57,7 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
57
  $id = $data->getAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_PAYMENT_PLAN);
58
  if ($id) {
59
  foreach ($res as &$pclass) {
60
- if ($pclass['id']==$id) {
61
  $pclass['default'] = true;
62
  } else {
63
  $pclass['default'] = false;
@@ -72,7 +72,7 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
72
  }
73
  return $res;
74
  }
75
-
76
  public function getCheckoutService()
77
  {
78
  try {
@@ -84,7 +84,7 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
84
  Mage::helper('klarna')->logKlarnaException($e);
85
  $res = NULL;
86
  }
87
- if ($res==NULL) {
88
  $res = array(false); // On purpouse!
89
  }
90
  return $res;
@@ -145,7 +145,7 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
145
  }
146
  return $res;
147
  }
148
-
149
  public function needExtraPaymentPlanInformaton()
150
  {
151
  try {
@@ -159,7 +159,7 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
159
  }
160
  return $res;
161
  }
162
-
163
  protected function _getCurrentField($field, $default = '')
164
  {
165
  try {
@@ -181,7 +181,15 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
181
 
182
  public function getCurrentGender()
183
  {
184
- return $this->_getCurrentField('gender');
 
 
 
 
 
 
 
 
185
  }
186
 
187
  public function getCurrentPhonenumber()
@@ -196,23 +204,47 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
196
  if (!$res) {
197
  $res = $this->_getCurrentField('phonenumber');
198
  }
199
- if ($res=='-') $res = ''; // Magento seems to default to '-'
200
  return $res;
201
  }
202
 
203
  public function getCurrentDobYear()
204
  {
205
- return $this->_getCurrentField('dob_year');
 
 
 
 
 
 
 
 
206
  }
207
 
208
  public function getCurrentDobMonth()
209
  {
210
- return $this->_getCurrentField('dob_month');
 
 
 
 
 
 
 
 
211
  }
212
 
213
  public function getCurrentDobDay()
214
  {
215
- return $this->_getCurrentField('dob_day');
 
 
 
 
 
 
 
 
216
  }
217
 
218
  public function getPClassHtml()
@@ -302,7 +334,7 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
302
  $klarna->setQuote($this->getQuote(), $method);
303
  return $klarna->getKlarnaLogotype($width, Vaimo_Klarna_Helper_Data::KLARNA_LOGOTYPE_POSITION_CHECKOUT);
304
  }
305
-
306
  public function useServiceLogotypes($serviceMethod, $width)
307
  {
308
  $res = '';
@@ -381,8 +413,8 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
381
  $method = $this->getMethod()->getCode();
382
  $klarna = Mage::getModel('klarna/klarna');
383
  $klarna->setQuote($this->getQuote(), $method);
384
- if (Mage::helper('klarna')->showTitleAsTextOnly()==false) {
385
- $str = '<img src="'.$klarna->getKlarnaLogotype(75, Vaimo_Klarna_Helper_Data::KLARNA_LOGOTYPE_POSITION_CHECKOUT).'" alt="" title="" />';
386
  $str .= $klarna->getMethodTitleWithFee(Mage::helper('klarna')->getVaimoKlarnaFeeInclVat($this->getQuote(), false));
387
  }
388
  return $str;
@@ -397,5 +429,42 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
397
  return $res;
398
  }
399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  }
401
 
26
  class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
27
  {
28
  protected $_pclasses = array();
29
+
30
  public function __construct()
31
  {
32
  parent::__construct();
57
  $id = $data->getAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_PAYMENT_PLAN);
58
  if ($id) {
59
  foreach ($res as &$pclass) {
60
+ if ($pclass['id'] == $id) {
61
  $pclass['default'] = true;
62
  } else {
63
  $pclass['default'] = false;
72
  }
73
  return $res;
74
  }
75
+
76
  public function getCheckoutService()
77
  {
78
  try {
84
  Mage::helper('klarna')->logKlarnaException($e);
85
  $res = NULL;
86
  }
87
+ if ($res == NULL) {
88
  $res = array(false); // On purpouse!
89
  }
90
  return $res;
145
  }
146
  return $res;
147
  }
148
+
149
  public function needExtraPaymentPlanInformaton()
150
  {
151
  try {
159
  }
160
  return $res;
161
  }
162
+
163
  protected function _getCurrentField($field, $default = '')
164
  {
165
  try {
181
 
182
  public function getCurrentGender()
183
  {
184
+ $res = null;
185
+ $quote = $this->getQuote();
186
+ if ($quote->getCustomerGender()) {
187
+ $res = $quote->getCustomerGender();
188
+ }
189
+ if (!$res) {
190
+ $res = $this->_getCurrentField('gender');
191
+ }
192
+ return $res;
193
  }
194
 
195
  public function getCurrentPhonenumber()
204
  if (!$res) {
205
  $res = $this->_getCurrentField('phonenumber');
206
  }
207
+ if ($res == '-') $res = ''; // Magento seems to default to '-'
208
  return $res;
209
  }
210
 
211
  public function getCurrentDobYear()
212
  {
213
+ $res = null;
214
+ $quote = $this->getQuote();
215
+ if ($quote->getCustomerDob()) {
216
+ $res = substr($quote->getCustomerDob(), 0, 4);
217
+ }
218
+ if (!$res) {
219
+ $res = $this->_getCurrentField('dob_year');
220
+ }
221
+ return $res;
222
  }
223
 
224
  public function getCurrentDobMonth()
225
  {
226
+ $res = null;
227
+ $quote = $this->getQuote();
228
+ if ($quote->getCustomerDob()) {
229
+ $res = substr($quote->getCustomerDob(), 5, 2);
230
+ }
231
+ if (!$res) {
232
+ $res = $this->_getCurrentField('dob_month');
233
+ }
234
+ return $res;
235
  }
236
 
237
  public function getCurrentDobDay()
238
  {
239
+ $res = null;
240
+ $quote = $this->getQuote();
241
+ if ($quote->getCustomerDob()) {
242
+ $res = substr($quote->getCustomerDob(), 8, 2);
243
+ }
244
+ if (!$res) {
245
+ $res = $this->_getCurrentField('dob_day');
246
+ }
247
+ return $res;
248
  }
249
 
250
  public function getPClassHtml()
334
  $klarna->setQuote($this->getQuote(), $method);
335
  return $klarna->getKlarnaLogotype($width, Vaimo_Klarna_Helper_Data::KLARNA_LOGOTYPE_POSITION_CHECKOUT);
336
  }
337
+
338
  public function useServiceLogotypes($serviceMethod, $width)
339
  {
340
  $res = '';
413
  $method = $this->getMethod()->getCode();
414
  $klarna = Mage::getModel('klarna/klarna');
415
  $klarna->setQuote($this->getQuote(), $method);
416
+ if (Mage::helper('klarna')->showTitleAsTextOnly() == false) {
417
+ $str = '<img src="' . $klarna->getKlarnaLogotype(75, Vaimo_Klarna_Helper_Data::KLARNA_LOGOTYPE_POSITION_CHECKOUT) . '" alt="" title="" />';
418
  $str .= $klarna->getMethodTitleWithFee(Mage::helper('klarna')->getVaimoKlarnaFeeInclVat($this->getQuote(), false));
419
  }
420
  return $str;
429
  return $res;
430
  }
431
 
432
+ public function validShippingAndBillingAddress()
433
+ {
434
+ $res = true;
435
+ if (!Mage::helper('klarna')->isOneStepCheckout() &&
436
+ !Mage::helper('klarna')->isFireCheckout() &&
437
+ !Mage::helper('klarna')->isVaimoCheckout()
438
+ ) {
439
+ $method = $this->getMethod()->getCode();
440
+ $klarna = Mage::getModel('klarna/klarna');
441
+ $klarna->setQuote($this->getQuote(), $method);
442
+ $res = $klarna->validShippingAndBillingAddress();
443
+ }
444
+ return $res;
445
+ }
446
+
447
+ public function formatUseCase($useCaseText)
448
+ {
449
+ $method = $this->getMethod()->getCode();
450
+ $klarna = Mage::getModel('klarna/klarna');
451
+ $klarna->setQuote($this->getQuote(), $method);
452
+ $res = $klarna->formatUseCase($useCaseText);
453
+ return $res;
454
+ }
455
+
456
+ public function addressesAreTheSame()
457
+ {
458
+ $method = $this->getMethod()->getCode();
459
+ $klarna = Mage::getModel('klarna/klarna');
460
+ $klarna->setQuote($this->getQuote(), $method);
461
+ $res = $klarna->addressesAreTheSame();
462
+ return $res;
463
+ }
464
+
465
+ public function getInvoiceSubTitle()
466
+ {
467
+ return Mage::helper('klarna')->__('Pay in 15 days');
468
+ }
469
  }
470
 
app/code/community/Vaimo/Klarna/Block/Klarnacheckout/Klarnacheckout.php CHANGED
@@ -37,12 +37,18 @@ class Vaimo_Klarna_Block_Klarnacheckout_Klarnacheckout extends Mage_Core_Block_T
37
 
38
  protected function _getKlarnaOrderHtml()
39
  {
 
 
40
  try {
 
 
41
  $klarna = Mage::getModel('klarna/klarnacheckout');
42
  $klarna->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
43
- $html = $klarna->getKlarnaOrderHtml($klarna->getQuote()->getKlarnaCheckoutId(), true, true);
 
 
44
  } catch (Exception $e) {
45
- $quote = Mage::helper('klarna')->findQuote($klarna->getQuote()->getKlarnaCheckoutId());
46
  $orderCreated = false;
47
  if ($quote && $quote->getId()) {
48
  $order = Mage::getModel('sales/order')->load($quote->getId(), 'quote_id');
@@ -50,27 +56,27 @@ class Vaimo_Klarna_Block_Klarnacheckout_Klarnacheckout extends Mage_Core_Block_T
50
  $orderCreated = true;
51
  }
52
  }
53
- if ($quote && ($quote->getId()!=$klarna->getQuote()->getId() || !$quote->getIsActive() || $orderCreated)) {
54
  if (!$quote->getIsActive()) {
55
- Mage::helper('klarna')->logKlarnaApi('getKlarnaOrderHtml failed with checkout id: ' . $klarna->getQuote()->getKlarnaCheckoutId() . '. ' . $e->getMessage() . '. ' . 'Exiting since quote is inactive ' . $quote->getId());
56
  } elseif ($order->getId()) {
57
- Mage::helper('klarna')->logKlarnaApi('getKlarnaOrderHtml failed with checkout id: ' . $klarna->getQuote()->getKlarnaCheckoutId() . '. ' . $e->getMessage() . '. ' . 'Exiting since quote has already created an order ' . $order->getIncrementId());
58
  } else {
59
- Mage::helper('klarna')->logKlarnaApi('getKlarnaOrderHtml failed with checkout id: ' . $klarna->getQuote()->getKlarnaCheckoutId() . '. ' . $e->getMessage() . '. ' . 'Exiting since quote is wrong' . $quote->getId());
60
  }
61
  if ($quote->getIsActive()) {
62
  $quote->setIsActive(false);
63
  $quote->save();
64
  }
65
- Mage::helper('klarna')->logKlarnaException($e);
66
- Mage::throwException(Mage::helper('klarna')->__('Current cart is not active. Please try again'));
67
  } else {
68
- Mage::helper('klarna')->logKlarnaApi('getKlarnaOrderHtml failed with checkout id: ' . $klarna->getQuote()->getKlarnaCheckoutId() . '. Trying with null.');
69
  $klarna->getQuote()->setKlarnaCheckoutId(null);
70
  $html = $klarna->getKlarnaOrderHtml(null, true, true);
71
- Mage::helper('klarna')->logKlarnaApi('getKlarnaOrderHtml succeeded with null');
72
  }
73
  }
 
74
  return $html;
75
  }
76
 
37
 
38
  protected function _getKlarnaOrderHtml()
39
  {
40
+ /** @var Vaimo_Klarna_Helper_Data $helper */
41
+ $helper = Mage::helper('klarna');
42
  try {
43
+ $helper->logDebugInfo('getKlarnaOrderHtml');
44
+ /** @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
45
  $klarna = Mage::getModel('klarna/klarnacheckout');
46
  $klarna->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
47
+ $checkoutId = $klarna->getQuote()->getKlarnaCheckoutId();
48
+ $helper->setCheckoutId($checkoutId);
49
+ $html = $klarna->getKlarnaOrderHtml($checkoutId, true, true);
50
  } catch (Exception $e) {
51
+ $quote = $helper->findQuote($checkoutId);
52
  $orderCreated = false;
53
  if ($quote && $quote->getId()) {
54
  $order = Mage::getModel('sales/order')->load($quote->getId(), 'quote_id');
56
  $orderCreated = true;
57
  }
58
  }
59
+ if ($quote && ($quote->getId() != $klarna->getQuote()->getId() || !$quote->getIsActive() || $orderCreated)) {
60
  if (!$quote->getIsActive()) {
61
+ $helper->logDebugInfo('getKlarnaOrderHtml failed. ' . $e->getMessage() . '. Exiting since quote is inactive ' . $quote->getId(), null, $checkoutId);
62
  } elseif ($order->getId()) {
63
+ $helper->logDebugInfo('getKlarnaOrderHtml failed. ' . $e->getMessage() . '. Exiting since quote has already created an order ' . $order->getIncrementId(), null, $checkoutId);
64
  } else {
65
+ $helper->logDebugInfo('getKlarnaOrderHtml failed. ' . $e->getMessage() . '. Exiting since quote is wrong' . $quote->getId(), null, $checkoutId);
66
  }
67
  if ($quote->getIsActive()) {
68
  $quote->setIsActive(false);
69
  $quote->save();
70
  }
71
+ $helper->logKlarnaException($e);
72
+ Mage::throwException($helper->__('Current cart is not active. Please try again'));
73
  } else {
74
+ $helper->logDebugInfo('getKlarnaOrderHtml failed with checkout id: ' . $checkoutId . '. Trying with null.', null, $checkoutId);
75
  $klarna->getQuote()->setKlarnaCheckoutId(null);
76
  $html = $klarna->getKlarnaOrderHtml(null, true, true);
 
77
  }
78
  }
79
+ $helper->logDebugInfo('getKlarnaOrderHtml succeeded', null, $checkoutId);
80
  return $html;
81
  }
82
 
app/code/community/Vaimo/Klarna/Helper/Data.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2009-2014 Vaimo AB
4
  *
5
  * Vaimo reserves all rights in the Program as delivered. The Program
6
  * or any portion thereof may not be reproduced in any form whatsoever without
@@ -20,7 +20,7 @@
20
  *
21
  * @category Vaimo
22
  * @package Vaimo_Klarna
23
- * @copyright Copyright (c) 2009-2014 Vaimo AB
24
  */
25
 
26
  class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
@@ -129,6 +129,12 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
129
  const KLARNA_KCO_API_VERSION_UK = 3;
130
  const KLARNA_KCO_API_VERSION_USA = 4;
131
 
 
 
 
 
 
 
132
  public static $isEnterprise;
133
 
134
 
@@ -200,6 +206,31 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
200
  */
201
  const LOG_FUNCTION_SESSION_NAME = 'klarna_log_function_name';
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  /**
204
  * Encode the string to klarna encoding
205
  *
@@ -217,7 +248,23 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
217
  if ($to === null) {
218
  $to = self::ENCODING_KLARNA;
219
  }
220
- return iconv($from, $to, $str);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
 
223
  /**
@@ -237,7 +284,15 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
237
  if ($to === null) {
238
  $to = self::ENCODING_MAGENTO;
239
  }
240
- return iconv($from, $to, $str);
 
 
 
 
 
 
 
 
241
  }
242
 
243
  public function getSupportedMethods()
@@ -817,7 +872,14 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
817
  */
818
  public function setFunctionNameForLog($functionName)
819
  {
820
- $_SESSION[self::LOG_FUNCTION_SESSION_NAME] = $functionName;
 
 
 
 
 
 
 
821
  }
822
 
823
  /**
@@ -827,20 +889,61 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
827
  */
828
  public function getFunctionNameForLog()
829
  {
830
- return array_key_exists(self::LOG_FUNCTION_SESSION_NAME, $_SESSION) ? $_SESSION[self::LOG_FUNCTION_SESSION_NAME] : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
  }
832
 
833
  /**
834
  * Log function that does the writing to log file
835
  *
836
- * @param string $filename What file to write to, will be placed in site/var/klarna/ folder
837
  * @param string $msg Text to log
838
  *
839
  * @return void
840
  */
841
  protected function _log($filename, $msg)
842
  {
843
- Mage::log('PID(' . getmypid() . '): ' . $this->getFunctionNameForLog() . ': ' . $msg, null, $filename, true);
844
  }
845
 
846
  /**
@@ -874,6 +977,40 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
874
  }
875
  }
876
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
877
  /**
878
  * Log function that logs all Klarna API calls and replies, this to see what functions are called and what reply they get
879
  *
@@ -883,8 +1020,12 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
883
  */
884
  public function logKlarnaApi($comment)
885
  {
886
- $this->_log('klarnaapi.log', $comment);
887
- $this->logDebugInfo($comment);
 
 
 
 
888
  }
889
 
890
  /**
@@ -895,18 +1036,42 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
895
  *
896
  * @return void
897
  */
898
- public function logDebugInfo($info, $arr = NULL)
899
  {
900
- $this->_log('klarnadebug.log', $info);
901
- if ($arr) {
902
- if (is_array($arr)) {
903
- $this->_log('klarnadebug.log', print_r($arr, true));
904
- } elseif (is_object($arr)) {
905
- $this->_log('klarnadebug.log', print_r(array($arr), true));
906
- } elseif (is_string($arr)) {
907
- $this->_log('klarnadebug.log', $arr);
908
- }
909
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
  }
911
 
912
  protected function _logMagentoException($e)
@@ -918,21 +1083,99 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
918
  * If there is an exception, this log function should be used
919
  * This is mainly meant for exceptions concerning klarna API calls, but can be used for any exception
920
  *
 
 
 
 
 
 
 
921
  * @param Exception $e
922
  *
923
  * @return void
924
  */
925
  public function logKlarnaException($e)
926
  {
927
- $this->_logMagentoException($e);
 
 
 
 
928
  $errstr = 'Exception:';
929
  if ($e->getCode()) $errstr = $errstr . ' Code: ' . $e->getCode();
930
- if ($e->getMessage()) $errstr = $errstr . ' Message: ' . $e->getMessage(); // $this->_decode()
931
  if ($e->getLine()) $errstr = $errstr . ' Row: ' . $e->getLine();
932
  if ($e->getFile()) $errstr = $errstr . ' File: ' . $e->getFile();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
933
  $this->_logAlways('klarnaerror.log', $errstr);
934
  }
935
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
  public function getDefaultCountry($store = NULL)
937
  {
938
  /* For shipping this should be called...
@@ -997,13 +1240,14 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
997
  ->where('klarna_checkout_id=?', $klarna_id);
998
  $r = $read->fetchAll($select);
999
  if (count($r) < 1) {
1000
- Mage::helper('klarna')->logKlarnaApi('findQuote no checkout quote found!' . $klarna_id);
1001
  return null;
1002
  }
1003
  else if (count($r) > 1) {
1004
- Mage::helper('klarna')->logKlarnaApi('findQuote more than one quote found!' . $klarna_id);
1005
  }
1006
  $r = $r[0];
 
1007
  $quote = Mage::getModel('sales/quote')
1008
  ->setStoreId($r['store_id'])
1009
  ->load($r['entity_id']);
@@ -1084,7 +1328,7 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
1084
  {
1085
  if ($quote->getPayment()->getMethod() != Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT) {
1086
  if ($logf) {
1087
- $this->logDebugInfo('_createTheOrder quote ' . $quote->getId() .
1088
  ' not proper method (' . $quote->getPayment()->getMethod() .
1089
  '), changing to ' .
1090
  Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
@@ -1116,4 +1360,23 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
1116
  return ($xmlRpcErrorCode !== false)
1117
  && (strpos($e->getMessage(), $GLOBALS['xmlrpcstr'][$xmlRpcErrorCode]) === 0);
1118
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1119
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
  *
5
  * Vaimo reserves all rights in the Program as delivered. The Program
6
  * or any portion thereof may not be reproduced in any form whatsoever without
20
  *
21
  * @category Vaimo
22
  * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
  */
25
 
26
  class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
129
  const KLARNA_KCO_API_VERSION_UK = 3;
130
  const KLARNA_KCO_API_VERSION_USA = 4;
131
 
132
+ const KLARNA_LOG_LEVEL_FULL = 0;
133
+ const KLARNA_LOG_LEVEL_MODERATE = 1;
134
+ const KLARNA_LOG_LEVEL_MINMIAL = 2;
135
+ const KLARNA_LOG_LEVEL_NONE = 3;
136
+
137
+
138
  public static $isEnterprise;
139
 
140
 
206
  */
207
  const LOG_FUNCTION_SESSION_NAME = 'klarna_log_function_name';
208
 
209
+ protected static $_logFunctionNameArray = array();
210
+
211
+ protected static $_klarnaCheckoutId;
212
+
213
+ public function setCheckoutId($checkoutId)
214
+ {
215
+ self::$_klarnaCheckoutId = $checkoutId;
216
+ }
217
+
218
+ /**
219
+ * Convert into ASCII with some translation of special characters to pure text
220
+ *
221
+ * @param $str
222
+ * @param null $from
223
+ * @param null $to
224
+ * @return string
225
+ */
226
+ protected function _cleanAndConvert($str, $from = null, $to = null)
227
+ {
228
+ $res = iconv($from, 'ASCII//TRANSLIT', $str);
229
+ $this->logKlarnaDebug('_cleanAndConvert: ' . $res);
230
+ return $res;
231
+ }
232
+
233
+
234
  /**
235
  * Encode the string to klarna encoding
236
  *
248
  if ($to === null) {
249
  $to = self::ENCODING_KLARNA;
250
  }
251
+ try {
252
+ $res = iconv($from, $to, $str);
253
+ if ($str && !$res) {
254
+ $res = $this->_cleanAndConvert($str, $from, $to);
255
+ }
256
+ } catch (Exception $e) {
257
+ try {
258
+ $this->logKlarnaDebug('encode exception: ' . $e->getMessage());
259
+ $res = $this->_cleanAndConvert($str, $from, $to);
260
+ } catch (Exception $e) {
261
+ $this->logKlarnaDebug('iconv failed in encode, returning error (' . $str . ')');
262
+ }
263
+ }
264
+ if ($str && !$res) {
265
+ $res = 'encode-error';
266
+ }
267
+ return $res;
268
  }
269
 
270
  /**
284
  if ($to === null) {
285
  $to = self::ENCODING_MAGENTO;
286
  }
287
+ try {
288
+ $res = iconv($from, $to, $str);
289
+ } catch (Exception $e) {
290
+ $this->logKlarnaDebug('iconv failed in decode, returning error (' . $str . ')');
291
+ }
292
+ if ($str && !$res) {
293
+ $res = 'decode-error';
294
+ }
295
+ return $res;
296
  }
297
 
298
  public function getSupportedMethods()
872
  */
873
  public function setFunctionNameForLog($functionName)
874
  {
875
+ if (in_array($functionName, self::$_logFunctionNameArray)) {
876
+ return;
877
+ }
878
+ // When klarna/klarna is loaded, it should not add a tag for klarna if klarnacheckout is called initially
879
+ if ($functionName=='klarna' && in_array('klarnacheckout', self::$_logFunctionNameArray)) {
880
+ return;
881
+ }
882
+ self::$_logFunctionNameArray[] = $functionName;
883
  }
884
 
885
  /**
889
  */
890
  public function getFunctionNameForLog()
891
  {
892
+ return implode('-', self::$_logFunctionNameArray);
893
+ }
894
+
895
+ public function getKlarnaVersion()
896
+ {
897
+ return (string) Mage::getConfig()->getNode()->modules->Vaimo_Klarna->version;
898
+ }
899
+
900
+ public function logKlarnaActionStart($method, $name)
901
+ {
902
+ $this->setFunctionNameForLog($method);
903
+ $this->setFunctionNameForLog($name);
904
+ $this->logKlarnaApi(self::KLARNA_LOG_START_TAG);
905
+ }
906
+
907
+ public function logKlarnaActionEnd()
908
+ {
909
+ $this->logKlarnaApi(self::KLARNA_LOG_END_TAG);
910
+ array_pop(self::$_logFunctionNameArray); // name
911
+ array_pop(self::$_logFunctionNameArray); // method
912
+ }
913
+
914
+ public function logKlarnaClearFunctionName()
915
+ {
916
+ self::$_logFunctionNameArray = array();
917
+ }
918
+
919
+ public function logKlarnaCheckoutFunctionStart($checkoutId, $name)
920
+ {
921
+ $this->setFunctionNameForLog($name);
922
+ $this->logKlarnaDebug('logKlarnaCheckoutFunctionStart', null, $checkoutId);
923
+ if ($checkoutId) {
924
+ $this->logKlarnaApi('Checkout ID ' . $checkoutId);
925
+ } else {
926
+ $this->logKlarnaApi('Checkout ID NULL');
927
+ }
928
+ }
929
+
930
+ public function logKlarnaCheckoutFunctionEnd()
931
+ {
932
+ $this->logKlarnaApi('Complete');
933
+ array_pop(self::$_logFunctionNameArray);
934
  }
935
 
936
  /**
937
  * Log function that does the writing to log file
938
  *
939
+ * @param string $filename What file to write to, will be placed in site/var/log/ folder
940
  * @param string $msg Text to log
941
  *
942
  * @return void
943
  */
944
  protected function _log($filename, $msg)
945
  {
946
+ Mage::log('PID(' . getmypid() . '): ' . $this->getKlarnaVersion() . ' ' . $this->getFunctionNameForLog() . ': ' . $msg, null, $filename, true);
947
  }
948
 
949
  /**
977
  }
978
  }
979
 
980
+ /**
981
+ * Log function used for various debug log information, array is optional
982
+ *
983
+ * @param string $info Header of what is being logged
984
+ * @param array $arr The array to be logged
985
+ *
986
+ * @return void
987
+ */
988
+ protected function _logToDatabase($info, $arr = NULL, $tag = null)
989
+ {
990
+ if (is_null($tag)) {
991
+ $tag = self::$_klarnaCheckoutId;
992
+ }
993
+ if ($arr) {
994
+ $data = is_string($arr) ? $arr : json_encode($arr);
995
+ } else {
996
+ $data = null;
997
+ }
998
+ $log = Mage::getModel('klarna/log')
999
+ ->setProcess(getmypid())
1000
+ ->setFunction($this->getFunctionNameForLog())
1001
+ ->setTag($tag)
1002
+ ->setMessage($info)
1003
+ ->setExtra($data)
1004
+ ->save();
1005
+ /*
1006
+ if ($arr) {
1007
+ Mage::getModel('klarna/log_data')
1008
+ ->setParent($log->getEntityId())
1009
+ ->setExtra($data)
1010
+ ->save();
1011
+ }
1012
+ */
1013
+ }
1014
  /**
1015
  * Log function that logs all Klarna API calls and replies, this to see what functions are called and what reply they get
1016
  *
1020
  */
1021
  public function logKlarnaApi($comment)
1022
  {
1023
+ //$this->_log('klarnaapi.log', $comment);
1024
+ $level = $this->getLogLevel();
1025
+ if ($level == self::KLARNA_LOG_LEVEL_NONE) {
1026
+ return;
1027
+ }
1028
+ $this->_logToDatabase($comment);
1029
  }
1030
 
1031
  /**
1036
  *
1037
  * @return void
1038
  */
1039
+ public function logKlarnaDebug($info, $arr = NULL, $tag = null)
1040
  {
1041
+ $level = $this->getLogLevel();
1042
+ if ($level == self::KLARNA_LOG_LEVEL_NONE || $level == self::KLARNA_LOG_LEVEL_MINMIAL) {
1043
+ return;
 
 
 
 
 
 
1044
  }
1045
+ if ($level == self::KLARNA_LOG_LEVEL_MODERATE) {
1046
+ $arr = null;
1047
+ }
1048
+ $this->_logToDatabase($info, $arr, $tag);
1049
+ }
1050
+
1051
+ /**
1052
+ * Will log to debug, but also include a backtrace
1053
+ *
1054
+ * @param string $info Header of what is being logged
1055
+ * @param array $arr The array to be logged
1056
+ *
1057
+ * @return void
1058
+ */
1059
+ public function logKlarnaDebugBT($info, $arr = NULL, $tag = null)
1060
+ {
1061
+ $this->logKlarnaDebug($info, $arr, $tag);
1062
+ $bt = mageDebugBacktrace(true, true, true);
1063
+ $this->logKlarnaDebug('Backtrace', $bt);
1064
+ }
1065
+
1066
+ /**
1067
+ * Not sure why I named it like this, it should be called logKlarnaDebug, kept this for compability...
1068
+ *
1069
+ * @param $info
1070
+ * @param null $arr
1071
+ */
1072
+ public function logDebugInfo($info, $arr = NULL, $tag = null)
1073
+ {
1074
+ $this->logKlarnaDebug($info, $arr, $tag);
1075
  }
1076
 
1077
  protected function _logMagentoException($e)
1083
  * If there is an exception, this log function should be used
1084
  * This is mainly meant for exceptions concerning klarna API calls, but can be used for any exception
1085
  *
1086
+ * Logic for log level is this:
1087
+ * Magento log is always updated, but never with special status code responses from Klarna
1088
+ * Klarna special statu ressponses are logged to errorlog file only if full log level is selected
1089
+ * In case of moderate and minimal, those special status errors, are logged to DB (when it can)
1090
+ * If level is none, no exceptions are logged
1091
+ *
1092
+ *
1093
  * @param Exception $e
1094
  *
1095
  * @return void
1096
  */
1097
  public function logKlarnaException($e)
1098
  {
1099
+ $level = $this->getLogLevel();
1100
+ $logException = $this->_logThisException($e);
1101
+ if ($logException) {
1102
+ $this->_logMagentoException($e);
1103
+ }
1104
  $errstr = 'Exception:';
1105
  if ($e->getCode()) $errstr = $errstr . ' Code: ' . $e->getCode();
1106
+ if ($e->getMessage()) $errstr = $errstr . ' Message: ' . $e->getMessage();
1107
  if ($e->getLine()) $errstr = $errstr . ' Row: ' . $e->getLine();
1108
  if ($e->getFile()) $errstr = $errstr . ' File: ' . $e->getFile();
1109
+ switch ($level) {
1110
+ case self::KLARNA_LOG_LEVEL_FULL:
1111
+ $logException = true;
1112
+ break;
1113
+ case self::KLARNA_LOG_LEVEL_MODERATE:
1114
+ if (!$logException) {
1115
+ // If there is a resulting exception, this write will be rolled back
1116
+ $this->_logToDatabase($errstr);
1117
+ }
1118
+ break;
1119
+ case self::KLARNA_LOG_LEVEL_NONE:
1120
+ $logException = false;
1121
+ break;
1122
+ }
1123
+ if (!$logException) {
1124
+ return;
1125
+ }
1126
  $this->_logAlways('klarnaerror.log', $errstr);
1127
  }
1128
 
1129
+ public function getLogLevel()
1130
+ {
1131
+ return Mage::getStoreConfig('dev/vaimo_klarna_debug/vaimo_klarna_log_level');
1132
+ }
1133
+
1134
+ /**
1135
+ * @param Exception $e
1136
+ *
1137
+ * @return boolean
1138
+ */
1139
+ protected function _logThisException($e)
1140
+ {
1141
+ $res = true;
1142
+ if ($e->getCode()) {
1143
+ $errSkipRange = array(
1144
+ // KPM
1145
+ array(2101, 2110),
1146
+ array(2201, 2206),
1147
+ array(2301, 2307),
1148
+ array(2401, 2406),
1149
+ array(2501, 2503),
1150
+ array(2999, 2999),
1151
+ array(3101, 3111),
1152
+ array(3201, 3221),
1153
+ array(3301, 3305),
1154
+ array(3999, 3999),
1155
+ array(6101, 6106),
1156
+ array(6999, 6999),
1157
+ array(7999, 7999),
1158
+ array(8101, 8115),
1159
+ array(8999, 8999),
1160
+ array(9101, 9131),
1161
+ array(9191, 9191),
1162
+ array(9291, 9241),
1163
+ // KCO
1164
+ array(400, 401),
1165
+ array(402, 406),
1166
+ array(415, 415),
1167
+
1168
+ );
1169
+ foreach ($errSkipRange as $range) {
1170
+ if ($e->getCode()>=$range[0] && $e->getCode()<=$range[1]) {
1171
+ $res = false;
1172
+ break;
1173
+ }
1174
+ }
1175
+ }
1176
+ return $res;
1177
+ }
1178
+
1179
  public function getDefaultCountry($store = NULL)
1180
  {
1181
  /* For shipping this should be called...
1240
  ->where('klarna_checkout_id=?', $klarna_id);
1241
  $r = $read->fetchAll($select);
1242
  if (count($r) < 1) {
1243
+ Mage::helper('klarna')->logKlarnaApi('findQuote no checkout quote found! ' . $klarna_id);
1244
  return null;
1245
  }
1246
  else if (count($r) > 1) {
1247
+ Mage::helper('klarna')->logKlarnaApi('findQuote more than one quote found! ' . $klarna_id);
1248
  }
1249
  $r = $r[0];
1250
+ Mage::app()->setCurrentStore($r['store_id']);
1251
  $quote = Mage::getModel('sales/quote')
1252
  ->setStoreId($r['store_id'])
1253
  ->load($r['entity_id']);
1328
  {
1329
  if ($quote->getPayment()->getMethod() != Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT) {
1330
  if ($logf) {
1331
+ $this->logKlarnaDebug('_createTheOrder quote ' . $quote->getId() .
1332
  ' not proper method (' . $quote->getPayment()->getMethod() .
1333
  '), changing to ' .
1334
  Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
1360
  return ($xmlRpcErrorCode !== false)
1361
  && (strpos($e->getMessage(), $GLOBALS['xmlrpcstr'][$xmlRpcErrorCode]) === 0);
1362
  }
1363
+
1364
+ public function updateKlarnacheckoutHistory($checkoutId, $message = null, $quoteId = null, $orderId = null, $reservationId = null)
1365
+ {
1366
+ $history = Mage::getModel('klarna/klarnacheckout_history')->loadByIdAndQuote($checkoutId, $quoteId);
1367
+ $history->updateKlarnacheckoutHistory($checkoutId, $message, $quoteId, $orderId, $reservationId);
1368
+ }
1369
+
1370
+ public function getProductReference($sku, $additionalData)
1371
+ {
1372
+ $reference = $sku;
1373
+ $additionalData = unserialize($additionalData);
1374
+ if ($additionalData) {
1375
+ if (isset($additionalData['klarna_reference'])) {
1376
+ $reference = $additionalData['klarna_reference'];
1377
+ }
1378
+ }
1379
+ return $reference;
1380
+ }
1381
+
1382
  }
app/code/community/Vaimo/Klarna/Model/Api/Abstract.php CHANGED
@@ -58,13 +58,13 @@ abstract class Vaimo_Klarna_Model_Api_Abstract extends Varien_Object
58
  {
59
  if ($response) {
60
  $this->_lastErrorObj = new Varien_Object(json_decode($response, true));
61
- if ($arrExtra) {
62
- foreach ($arrExtra as $id => $val) {
63
- $this->_lastErrorObj->setData($id, $val);
64
- }
65
- }
66
  } else {
67
- $this->_lastErrorObj = NULL;
 
 
 
 
 
68
  }
69
  }
70
 
@@ -96,8 +96,27 @@ abstract class Vaimo_Klarna_Model_Api_Abstract extends Varien_Object
96
  if (is_array($extras)) {
97
  $create = array_merge_recursive($create, $extras);
98
  } else {
99
- Mage::helper('klarna')->logDebugInfo($extras . ": " . $json);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
  }
 
102
  }
103
  }
58
  {
59
  if ($response) {
60
  $this->_lastErrorObj = new Varien_Object(json_decode($response, true));
 
 
 
 
 
61
  } else {
62
+ $this->_lastErrorObj = new Varien_Object(array());
63
+ }
64
+ if ($arrExtra) {
65
+ foreach ($arrExtra as $id => $val) {
66
+ $this->_lastErrorObj->setData($id, $val);
67
+ }
68
  }
69
  }
70
 
96
  if (is_array($extras)) {
97
  $create = array_merge_recursive($create, $extras);
98
  } else {
99
+ Mage::helper('klarna')->logDebugInfo('_addUserDefinedVariables', $extras);
100
+ }
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Checks all other lines, if it's unique
106
+ *
107
+ * @param $items
108
+ * @param $currentItem
109
+ * @return bool
110
+ */
111
+ protected function _skuNotUnique($items, $currentItem)
112
+ {
113
+ foreach ($items as $item) {
114
+ if ($item->getId() != $currentItem->getId()) {
115
+ if ($item->getSku() == $currentItem->getSku()) {
116
+ return true;
117
+ }
118
  }
119
  }
120
+ return false;
121
  }
122
  }
app/code/community/Vaimo/Klarna/Model/Api/Kco.php CHANGED
@@ -85,12 +85,21 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
85
  protected function _setKlarnaCheckoutId($checkoutId)
86
  {
87
  $quote = $this->_getQuote();
 
88
 
89
  if ($quote->getId() && $quote->getKlarnaCheckoutId() != $checkoutId) {
90
- Mage::helper('klarna')->logDebugInfo('SET checkout id: ' . $checkoutId);
91
- Mage::helper('klarna')->logDebugInfo('Quote Id: ' . $quote->getId());
 
 
 
 
 
 
 
92
  $quote->setKlarnaCheckoutId($checkoutId);
93
  $quote->save();
 
94
  }
95
 
96
  Mage::getSingleton('checkout/session')->setKlarnaCheckoutId($checkoutId);
@@ -107,6 +116,7 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
107
  $items = array();
108
  $qtyMultiplierArray = array();
109
 
 
110
  foreach ($quote->getAllItems() as $quoteItem) {
111
  if (Mage::helper('klarna')->shouldItemBeIncluded($quoteItem)==false) {
112
  continue;
@@ -119,8 +129,10 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
119
 
120
  if ($quoteItem->getTaxPercent() > 0) {
121
  $taxRate = $quoteItem->getTaxPercent();
122
- } else {
123
  $taxRate = $quoteItem->getTaxAmount() / $quoteItem->getRowTotal() * 100;
 
 
124
  }
125
 
126
  $price = $quoteItem->getPriceInclTax();
@@ -135,9 +147,21 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
135
  if (isset($qtyMultiplierArray[$quoteItem->getParentItemId()])) {
136
  $qty = $qty * $qtyMultiplierArray[$quoteItem->getParentItemId()];
137
  }
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  $items[] = array(
140
- 'reference' => $quoteItem->getSku(),
141
  'name' => $quoteItem->getName(),
142
  'quantity' => round($qty),
143
  'unit_price' => round($price * 100),
@@ -155,9 +179,12 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
155
  $taxAmount = $total->getAddress()->getShippingTaxAmount();
156
  $hiddenTaxAmount = $total->getAddress()->getShippingHiddenTaxAmount();
157
  //if (Mage::helper('klarna')->isShippingInclTax($quote->getStoreId())) {
158
- if (($amount_incl_tax>0) && (round($amount_incl_tax,2) == round($amount,2))) {
159
  $amount = $amount - $taxAmount - $hiddenTaxAmount;
160
  }
 
 
 
161
  $taxRate = ($taxAmount + $hiddenTaxAmount) / $amount * 100;
162
  $amount_incl_tax = $amount + $taxAmount + $hiddenTaxAmount;
163
  $items[] = array(
@@ -179,6 +206,9 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
179
  // otherwise the total tax wouldn't match
180
  $taxAmount = $total->getAddress()->getHiddenTaxAmount();
181
  $amount = -$total->getAddress()->getDiscountAmount() - $taxAmount;
 
 
 
182
  $taxRate = $taxAmount / $amount * 100;
183
  $items[] = array(
184
  'type' => 'discount',
@@ -501,17 +531,18 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
501
  }
502
 
503
  /**
504
- * Get Klarna checkout order
505
- *
506
  * @param null $checkoutId
507
  * @param bool $createIfNotExists
508
  * @param bool $updateItems
509
- * @return Klarna_Checkout_Order|null
 
 
510
  */
511
  public function initKlarnaOrder($checkoutId = null, $createIfNotExists = false, $updateItems = false, $quoteId = '')
512
  {
 
513
  if ($checkoutId) {
514
- Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder checkout id: ' . $checkoutId . ' (quote id: ' . $quoteId . ')');
515
  $loadf = true;
516
  if (!$updateItems) {
517
  if ($this->_useKlarnaOrderSessionCache) {
@@ -529,7 +560,13 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
529
  $this->_updateLastError($e->getMessage());
530
  if ($this->_getLastError('http_status_code')=='403' &&
531
  $this->_getLastError('http_status_message')=='Forbidden') {
532
- Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder trying to update, but it is forbidden, so we skip it and just use fetch');
 
 
 
 
 
 
533
  } else {
534
  throw $e;
535
  }
@@ -539,10 +576,19 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
539
  }
540
  $res = $this->_klarnaOrder!=NULL;
541
  if ($res) {
 
 
 
 
542
  if ($this->_getLocationOrderId()) {
543
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
544
  }
545
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
 
 
 
 
 
546
  }
547
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
548
  return $res;
@@ -558,7 +604,12 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
558
  $this->_updateLastError($e->getMessage());
559
  if ($this->_getLastError('http_status_code')=='403' &&
560
  $this->_getLastError('http_status_message')=='Forbidden') {
 
561
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder trying to update, but it is forbidden, so we skip it and just use fetch');
 
 
 
 
562
  } else {
563
  throw $e;
564
  }
@@ -567,10 +618,19 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
567
  $this->_klarnaOrder->fetch();
568
  $res = $this->_klarnaOrder!=NULL;
569
  if ($res) {
 
 
 
 
570
  if ($this->_getLocationOrderId()) {
571
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
572
  }
573
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
 
 
 
 
 
574
  }
575
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
576
  return $res;
@@ -591,6 +651,11 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
591
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
592
  }
593
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
 
 
 
 
 
594
  return $res;
595
  }
596
 
@@ -697,7 +762,7 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
697
 
698
  public function sanityTestQuote($createdKlarnaOrder, $quote)
699
  {
700
- $res = NULL;
701
 
702
  foreach ($quote->getAllVisibleItems() as $quoteItem) {
703
  $foundf = false;
@@ -705,9 +770,13 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
705
  // $data is actually an object
706
  if (isset($data['cart'])) {
707
  if (isset($data['cart']['items'])) {
 
 
 
 
708
  foreach ($data['cart']['items'] as $klarnaItem) {
709
- if ($klarnaItem['reference']==substr($quoteItem->getSku(), 0, 64) &&
710
- $klarnaItem['quantity']==$quoteItem->getQty()
711
  ) {
712
  $foundf = true;
713
  continue;
85
  protected function _setKlarnaCheckoutId($checkoutId)
86
  {
87
  $quote = $this->_getQuote();
88
+ $message = null;
89
 
90
  if ($quote->getId() && $quote->getKlarnaCheckoutId() != $checkoutId) {
91
+ if ($quote->getKlarnaCheckoutId()) {
92
+ if (!$quote->getIsActive()) {
93
+ Mage::throwException(Mage::helper('klarna')->__('Attempting to change checkout id on closed quote') . ' ' . $quote->getId());
94
+ } else {
95
+ $message = 'POTENTIAL ERROR. _setKlarnaCheckoutId: Old checkout id: ' . $quote->getKlarnaCheckoutId();
96
+ Mage::helper('klarna')->logDebugInfo($message, null, $checkoutId);
97
+ }
98
+ }
99
+ Mage::helper('klarna')->logDebugInfo('Quote Id: ' . $quote->getId(), null, $checkoutId);
100
  $quote->setKlarnaCheckoutId($checkoutId);
101
  $quote->save();
102
+ Mage::helper('klarna')->updateKlarnacheckoutHistory($checkoutId, $message, $quote->getId());
103
  }
104
 
105
  Mage::getSingleton('checkout/session')->setKlarnaCheckoutId($checkoutId);
116
  $items = array();
117
  $qtyMultiplierArray = array();
118
 
119
+ /** @var Mage_Sales_Model_Quote_Item $quoteItem */
120
  foreach ($quote->getAllItems() as $quoteItem) {
121
  if (Mage::helper('klarna')->shouldItemBeIncluded($quoteItem)==false) {
122
  continue;
129
 
130
  if ($quoteItem->getTaxPercent() > 0) {
131
  $taxRate = $quoteItem->getTaxPercent();
132
+ } elseif ($quoteItem->getRowTotal() != 0) {
133
  $taxRate = $quoteItem->getTaxAmount() / $quoteItem->getRowTotal() * 100;
134
+ } else {
135
+ $taxRate = 0;
136
  }
137
 
138
  $price = $quoteItem->getPriceInclTax();
147
  if (isset($qtyMultiplierArray[$quoteItem->getParentItemId()])) {
148
  $qty = $qty * $qtyMultiplierArray[$quoteItem->getParentItemId()];
149
  }
150
+
151
+ $reference = $quoteItem->getSku();
152
+ if ($this->_skuNotUnique($quote->getAllItems(), $quoteItem)) {
153
+ $reference = substr($quoteItem->getSku(), 0, 53) . ':' . str_pad($quoteItem->getId(), 10, '0', STR_PAD_LEFT);
154
+ $additionalData = unserialize($quoteItem->getAdditionalData());
155
+ if (!$additionalData) {
156
+ $additionalData = array();
157
+ }
158
+ $additionalData['klarna_reference'] = $reference;
159
+ $quoteItem->setAdditionalData(serialize($additionalData));
160
+ $quoteItem->save();
161
+ }
162
 
163
  $items[] = array(
164
+ 'reference' => $reference,
165
  'name' => $quoteItem->getName(),
166
  'quantity' => round($qty),
167
  'unit_price' => round($price * 100),
179
  $taxAmount = $total->getAddress()->getShippingTaxAmount();
180
  $hiddenTaxAmount = $total->getAddress()->getShippingHiddenTaxAmount();
181
  //if (Mage::helper('klarna')->isShippingInclTax($quote->getStoreId())) {
182
+ if (($amount_incl_tax > 0) && (round($amount_incl_tax, 2) == round($amount, 2))) {
183
  $amount = $amount - $taxAmount - $hiddenTaxAmount;
184
  }
185
+ if ($amount == 0) {
186
+ continue;
187
+ }
188
  $taxRate = ($taxAmount + $hiddenTaxAmount) / $amount * 100;
189
  $amount_incl_tax = $amount + $taxAmount + $hiddenTaxAmount;
190
  $items[] = array(
206
  // otherwise the total tax wouldn't match
207
  $taxAmount = $total->getAddress()->getHiddenTaxAmount();
208
  $amount = -$total->getAddress()->getDiscountAmount() - $taxAmount;
209
+ if ($amount == 0) {
210
+ continue;
211
+ }
212
  $taxRate = $taxAmount / $amount * 100;
213
  $items[] = array(
214
  'type' => 'discount',
531
  }
532
 
533
  /**
 
 
534
  * @param null $checkoutId
535
  * @param bool $createIfNotExists
536
  * @param bool $updateItems
537
+ * @param string $quoteId
538
+ * @return bool
539
+ * @throws Exception
540
  */
541
  public function initKlarnaOrder($checkoutId = null, $createIfNotExists = false, $updateItems = false, $quoteId = '')
542
  {
543
+ $message = '';
544
  if ($checkoutId) {
545
+ Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder quote id: ' . $quoteId, null, $checkoutId);
546
  $loadf = true;
547
  if (!$updateItems) {
548
  if ($this->_useKlarnaOrderSessionCache) {
560
  $this->_updateLastError($e->getMessage());
561
  if ($this->_getLastError('http_status_code')=='403' &&
562
  $this->_getLastError('http_status_message')=='Forbidden') {
563
+ // We should probably redirect to success or display error... as this means the order is Done in Klarna...
564
+ $message = 'initKlarnaOrder trying to update, but it is forbidden, so we skip it and just use fetch';
565
+ Mage::helper('klarna')->logKlarnaApi($message);
566
+ } elseif ($this->_getLastError('http_status_code')=='0' &&
567
+ $this->_getLastError('http_status_message')==null) {
568
+ Mage::helper('klarna')->logDebugInfo('initKlarnaOrder possible timeout in communication with Klarna');
569
+ return false;
570
  } else {
571
  throw $e;
572
  }
576
  }
577
  $res = $this->_klarnaOrder!=NULL;
578
  if ($res) {
579
+ if ($checkoutId!=$this->_getLocationOrderId()) {
580
+ $message = 'POTENTIAL ERROR. initKlarnaOrder checkoutId received: ' . $this->_getLocationOrderId();
581
+ Mage::helper('klarna')->logDebugInfo($message, null, $checkoutId);
582
+ }
583
  if ($this->_getLocationOrderId()) {
584
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
585
  }
586
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
587
+ Mage::helper('klarna')->updateKlarnacheckoutHistory(
588
+ Mage::getSingleton('checkout/session')->getKlarnaCheckoutId(),
589
+ $message,
590
+ $quoteId
591
+ );
592
  }
593
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
594
  return $res;
604
  $this->_updateLastError($e->getMessage());
605
  if ($this->_getLastError('http_status_code')=='403' &&
606
  $this->_getLastError('http_status_message')=='Forbidden') {
607
+ // We should probably redirect to success or display error... as this means the order is Done in Klarna...
608
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder trying to update, but it is forbidden, so we skip it and just use fetch');
609
+ } elseif ($this->_getLastError('http_status_code')=='0' &&
610
+ $this->_getLastError('http_status_message')==null) {
611
+ Mage::helper('klarna')->logDebugInfo('initKlarnaOrder possible timeout in communication with Klarna');
612
+ return false;
613
  } else {
614
  throw $e;
615
  }
618
  $this->_klarnaOrder->fetch();
619
  $res = $this->_klarnaOrder!=NULL;
620
  if ($res) {
621
+ if ($checkoutId!=$this->_getLocationOrderId()) {
622
+ $message = 'POTENTIAL ERROR. initKlarnaOrder checkoutId received: ' . $this->_getLocationOrderId();
623
+ Mage::helper('klarna')->logDebugInfo($message, null, $checkoutId);
624
+ }
625
  if ($this->_getLocationOrderId()) {
626
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
627
  }
628
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
629
+ Mage::helper('klarna')->updateKlarnacheckoutHistory(
630
+ Mage::getSingleton('checkout/session')->getKlarnaCheckoutId(),
631
+ $message,
632
+ $quoteId
633
+ );
634
  }
635
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
636
  return $res;
651
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
652
  }
653
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
654
+ Mage::helper('klarna')->updateKlarnacheckoutHistory(
655
+ Mage::getSingleton('checkout/session')->getKlarnaCheckoutId(),
656
+ $message,
657
+ $quoteId
658
+ );
659
  return $res;
660
  }
661
 
762
 
763
  public function sanityTestQuote($createdKlarnaOrder, $quote)
764
  {
765
+ $res = null;
766
 
767
  foreach ($quote->getAllVisibleItems() as $quoteItem) {
768
  $foundf = false;
770
  // $data is actually an object
771
  if (isset($data['cart'])) {
772
  if (isset($data['cart']['items'])) {
773
+ $reference = Mage::helper('klarna')->getProductReference(
774
+ $quoteItem->getSku(),
775
+ $quoteItem->getAdditionalData()
776
+ );
777
  foreach ($data['cart']['items'] as $klarnaItem) {
778
+ if ($klarnaItem['reference'] == substr($reference, 0, 64) &&
779
+ $klarnaItem['quantity'] == $quoteItem->getQty()
780
  ) {
781
  $foundf = true;
782
  continue;
app/code/community/Vaimo/Klarna/Model/Api/Rest.php CHANGED
@@ -200,12 +200,22 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
200
  protected function _setKlarnaCheckoutId($checkoutId)
201
  {
202
  $quote = $this->_getQuote();
 
203
 
204
  if ($quote->getId() && $quote->getKlarnaCheckoutId() != $checkoutId) {
 
 
 
 
 
 
 
 
205
  Mage::helper('klarna')->logDebugInfo('SET checkout id rest: ' . $checkoutId);
206
  Mage::helper('klarna')->logDebugInfo('Quote Id rest: ' . $quote->getId());
207
  $quote->setKlarnaCheckoutId($checkoutId);
208
  $quote->save();
 
209
  }
210
 
211
  Mage::getSingleton('checkout/session')->setKlarnaCheckoutId($checkoutId);
@@ -224,24 +234,43 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
224
  foreach ($quote->getAllVisibleItems() as $quoteItem) {
225
  if ($quoteItem->getTaxPercent() > 0) {
226
  $taxRate = $quoteItem->getTaxPercent();
227
- } else {
228
  $taxRate = $quoteItem->getTaxAmount() / $quoteItem->getRowTotal() * 100;
 
 
229
  }
230
  $taxAmount = $calculator->calcTaxAmount($quoteItem->getRowTotalInclTax(), $taxRate, true);
231
 
232
  if ($this->_isUSA()) {
233
  // $unitPrice = $quoteItem->getPrice();
234
  $totalAmount = $quoteItem->getRowTotalInclTax() - $taxAmount;
235
- $unitPrice = $totalAmount / $quoteItem->getQty();
 
 
 
 
236
  $taxRate = 0;
237
  $taxAmount = 0;
238
  } else {
239
  $unitPrice = $quoteItem->getPriceInclTax();
240
  $totalAmount = $quoteItem->getRowTotalInclTax();
241
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  $items[] = array(
243
  'type' => 'physical',
244
- 'reference' => $quoteItem->getSku(),
245
  'name' => $quoteItem->getName(),
246
  'quantity' => round($quoteItem->getQty()),
247
  'quantity_unit' => 'pcs',
@@ -263,9 +292,12 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
263
  $taxAmount = $total->getAddress()->getShippingTaxAmount();
264
  $hiddenTaxAmount = $total->getAddress()->getShippingHiddenTaxAmount();
265
  //if (Mage::helper('klarna')->isShippingInclTax($quote->getStoreId())) {
266
- if (($amount_incl_tax>0) && (round($amount_incl_tax,2) == round($amount,2))) {
267
  $amount = $amount - $taxAmount - $hiddenTaxAmount;
268
  }
 
 
 
269
  $taxRate = ($taxAmount + $hiddenTaxAmount) / $amount * 100;
270
  if ($this->_isUSA()) {
271
  $unitPrice = $amount;
@@ -297,6 +329,9 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
297
  // otherwise the total tax wouldn't match
298
  $taxAmount = $total->getAddress()->getHiddenTaxAmount();
299
  $amount = -$total->getAddress()->getDiscountAmount() - $taxAmount;
 
 
 
300
  $taxRate = $taxAmount / $amount * 100;
301
  if ($this->_isUSA()) {
302
  $unitPrice = $amount;
@@ -723,6 +758,21 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
723
  Mage::helper('klarna')->logDebugInfo('_updateMerchantReferences rest response = ' . $response . ' status = ' . $status);
724
  }
725
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
726
  public function capture($orderId, $amount, $sendEmailf)
727
  {
728
  $ch = curl_init();
@@ -742,16 +792,7 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
742
  Mage::helper('klarna')->logDebugInfo('capture rest response = ' . $response . ' status = ' . $status);
743
 
744
  if ($status != 201) {
745
- $response = json_decode($response, true);
746
- $message = 'Error capturing order: ' . $status;
747
- if (isset($response['error_code'])) {
748
- $message .= '; Code: ' . $response['error_code'];
749
- }
750
- if (isset($response['error_messages']) && is_array($response['error_messages'])) {
751
- foreach ($response['error_messages'] as $value) {
752
- $message .= '; ' . $value;
753
- }
754
- }
755
  $this->_updateLastError($response, array('status' => $status));
756
  Mage::throwException($message);
757
  }
@@ -803,20 +844,8 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
803
 
804
  Mage::helper('klarna')->logDebugInfo('refund rest response = ' . $response . ' status = ' . $status);
805
 
806
- // 204 is correct, according to their documentation
807
- // I don't know why this was changed to 201...
808
- // https://developers.klarna.com/en/gb+php/kco-v3/order-management/update-order
809
  if ($status != 204) {
810
- $response = json_decode($response, true);
811
- $message = 'Error refunding order: ' . $status;
812
- if (isset($response['error_code'])) {
813
- $message .= '; Code: ' . $response['error_code'];
814
- }
815
- if (isset($response['error_messages']) && is_array($response['error_messages'])) {
816
- foreach ($response['error_messages'] as $value) {
817
- $message .= '; ' . $value;
818
- }
819
- }
820
  $this->_updateLastError($response, array('status' => $status));
821
  Mage::throwException($message);
822
  }
@@ -852,16 +881,7 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
852
  Mage::helper('klarna')->logDebugInfo('cancel rest response = ' . $response . ' status = ' . $status);
853
 
854
  if ($status != 204) {
855
- $response = json_decode($response, true);
856
- $message = 'Error canceling order: ' . $status;
857
- if (isset($response['error_code'])) {
858
- $message .= '; Code: ' . $response['error_code'];
859
- }
860
- if (isset($response['error_messages']) && is_array($response['error_messages'])) {
861
- foreach ($response['error_messages'] as $value) {
862
- $message .= '; ' . $value;
863
- }
864
- }
865
  $this->_updateLastError($response, array('status' => $status));
866
  Mage::throwException($message);
867
  }
@@ -896,16 +916,7 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
896
  Mage::helper('klarna')->logDebugInfo('release rest response = ' . $response . ' status = ' . $status);
897
 
898
  if ($status != 204) {
899
- $response = json_decode($response, true);
900
- $message = 'Error canceling order: ' . $status;
901
- if (isset($response['error_code'])) {
902
- $message .= '; Code: ' . $response['error_code'];
903
- }
904
- if (isset($response['error_messages']) && is_array($response['error_messages'])) {
905
- foreach ($response['error_messages'] as $value) {
906
- $message .= '; ' . $value;
907
- }
908
- }
909
  $this->_updateLastError($response, array('status' => $status));
910
  Mage::throwException($message);
911
  }
@@ -923,6 +934,7 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
923
 
924
  public function initKlarnaOrder($checkoutId = null, $createIfNotExists = false, $updateItems = false, $quoteId = '')
925
  {
 
926
  if ($checkoutId) {
927
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder rest checkout id: ' . $checkoutId . ' (quote id: ' . $quoteId . ')');
928
  $loadf = true;
@@ -940,7 +952,14 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
940
  } catch (Exception $e) {
941
  if ($this->_getLastError('status')=='403' &&
942
  $this->_getLastError('error_code')=='READ_ONLY_ORDER') {
 
 
 
943
  $this->_fetchOrder($checkoutId);
 
 
 
 
944
  } else {
945
  throw $e;
946
  }
@@ -951,10 +970,19 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
951
  }
952
  $res = $this->_klarnaOrder!=NULL;
953
  if ($res) {
 
 
 
 
954
  if ($this->_getLocationOrderId()) {
955
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
956
  }
957
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
 
 
 
 
 
958
  }
959
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder rest true');
960
  return $res;
@@ -969,7 +997,13 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
969
  } catch (Exception $e) {
970
  if ($this->_getLastError('status')=='403' &&
971
  $this->_getLastError('error_code')=='READ_ONLY_ORDER') {
 
 
972
  $this->_fetchOrder($klarnaCheckoutId);
 
 
 
 
973
  } else {
974
  throw $e;
975
  }
@@ -979,10 +1013,19 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
979
  }
980
  $res = $this->_klarnaOrder!=NULL;
981
  if ($res) {
 
 
 
 
982
  if ($this->_getLocationOrderId()) {
983
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
984
  }
985
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
 
 
 
 
 
986
  }
987
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder rest true');
988
  return $res;
@@ -1006,6 +1049,11 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
1006
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
1007
  }
1008
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
 
 
 
 
 
1009
  return $res;
1010
  }
1011
  }
@@ -1211,8 +1259,12 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
1211
  $data = $createdKlarnaOrder->getData();
1212
  // $data is actually an object
1213
  if (isset($data['order_lines'])) {
 
 
 
 
1214
  foreach ($data['order_lines'] as $klarnaItem) {
1215
- if ($klarnaItem['reference']==substr($quoteItem->getSku(), 0, 64) &&
1216
  $klarnaItem['quantity']==$quoteItem->getQty()
1217
  ) {
1218
  $foundf = true;
200
  protected function _setKlarnaCheckoutId($checkoutId)
201
  {
202
  $quote = $this->_getQuote();
203
+ $message = null;
204
 
205
  if ($quote->getId() && $quote->getKlarnaCheckoutId() != $checkoutId) {
206
+ if ($quote->getKlarnaCheckoutId()) {
207
+ if (!$quote->getIsActive()) {
208
+ Mage::throwException(Mage::helper('klarna')->__('Attempting to change checkout id on closed quote') . ' ' . $quote->getId());
209
+ } else {
210
+ $message = 'POTENTIAL ERROR. _setKlarnaCheckoutId: Old checkout id: ' . $quote->getKlarnaCheckoutId();
211
+ Mage::helper('klarna')->logDebugInfo($message, null, $checkoutId);
212
+ }
213
+ }
214
  Mage::helper('klarna')->logDebugInfo('SET checkout id rest: ' . $checkoutId);
215
  Mage::helper('klarna')->logDebugInfo('Quote Id rest: ' . $quote->getId());
216
  $quote->setKlarnaCheckoutId($checkoutId);
217
  $quote->save();
218
+ Mage::helper('klarna')->updateKlarnacheckoutHistory($checkoutId, $message, $quote->getId());
219
  }
220
 
221
  Mage::getSingleton('checkout/session')->setKlarnaCheckoutId($checkoutId);
234
  foreach ($quote->getAllVisibleItems() as $quoteItem) {
235
  if ($quoteItem->getTaxPercent() > 0) {
236
  $taxRate = $quoteItem->getTaxPercent();
237
+ } elseif ($quoteItem->getRowTotal() != 0) {
238
  $taxRate = $quoteItem->getTaxAmount() / $quoteItem->getRowTotal() * 100;
239
+ } else {
240
+ $taxRate = 0;
241
  }
242
  $taxAmount = $calculator->calcTaxAmount($quoteItem->getRowTotalInclTax(), $taxRate, true);
243
 
244
  if ($this->_isUSA()) {
245
  // $unitPrice = $quoteItem->getPrice();
246
  $totalAmount = $quoteItem->getRowTotalInclTax() - $taxAmount;
247
+ if ($quoteItem->getQty() != 0) {
248
+ $unitPrice = $totalAmount / $quoteItem->getQty();
249
+ } else {
250
+ $unitPrice = 0;
251
+ }
252
  $taxRate = 0;
253
  $taxAmount = 0;
254
  } else {
255
  $unitPrice = $quoteItem->getPriceInclTax();
256
  $totalAmount = $quoteItem->getRowTotalInclTax();
257
  }
258
+
259
+ $reference = $quoteItem->getSku();
260
+ if ($this->_skuNotUnique($quote->getAllVisibleItems(), $quoteItem)) {
261
+ $reference = substr($quoteItem->getSku(), 0, 53) . ':' . str_pad($quoteItem->getId(), 10, '0', STR_PAD_LEFT);
262
+ $additionalData = unserialize($quoteItem->getAdditionalData());
263
+ if (!$additionalData) {
264
+ $additionalData = array();
265
+ }
266
+ $additionalData['klarna_reference'] = $reference;
267
+ $quoteItem->setAdditionalData(serialize($additionalData));
268
+ $quoteItem->save();
269
+ }
270
+
271
  $items[] = array(
272
  'type' => 'physical',
273
+ 'reference' => $reference,
274
  'name' => $quoteItem->getName(),
275
  'quantity' => round($quoteItem->getQty()),
276
  'quantity_unit' => 'pcs',
292
  $taxAmount = $total->getAddress()->getShippingTaxAmount();
293
  $hiddenTaxAmount = $total->getAddress()->getShippingHiddenTaxAmount();
294
  //if (Mage::helper('klarna')->isShippingInclTax($quote->getStoreId())) {
295
+ if (($amount_incl_tax > 0) && (round($amount_incl_tax, 2) == round($amount, 2))) {
296
  $amount = $amount - $taxAmount - $hiddenTaxAmount;
297
  }
298
+ if ($amount == 0) {
299
+ continue;
300
+ }
301
  $taxRate = ($taxAmount + $hiddenTaxAmount) / $amount * 100;
302
  if ($this->_isUSA()) {
303
  $unitPrice = $amount;
329
  // otherwise the total tax wouldn't match
330
  $taxAmount = $total->getAddress()->getHiddenTaxAmount();
331
  $amount = -$total->getAddress()->getDiscountAmount() - $taxAmount;
332
+ if ($amount == 0) {
333
+ continue;
334
+ }
335
  $taxRate = $taxAmount / $amount * 100;
336
  if ($this->_isUSA()) {
337
  $unitPrice = $amount;
758
  Mage::helper('klarna')->logDebugInfo('_updateMerchantReferences rest response = ' . $response . ' status = ' . $status);
759
  }
760
 
761
+ protected function _buildMessageFromResponse($initialMessage, $response)
762
+ {
763
+ $message = $initialMessage;
764
+ $responseArr = json_decode($response, true);
765
+ if (isset($responseArr['error_code'])) {
766
+ $message .= '; Code: ' . $responseArr['error_code'];
767
+ }
768
+ if (isset($responseArr['error_messages']) && is_array($responseArr['error_messages'])) {
769
+ foreach ($responseArr['error_messages'] as $value) {
770
+ $message .= '; ' . $value;
771
+ }
772
+ }
773
+ return $message;
774
+ }
775
+
776
  public function capture($orderId, $amount, $sendEmailf)
777
  {
778
  $ch = curl_init();
792
  Mage::helper('klarna')->logDebugInfo('capture rest response = ' . $response . ' status = ' . $status);
793
 
794
  if ($status != 201) {
795
+ $message = $this->_buildMessageFromResponse('Error capturing order: ' . $status, $response);
 
 
 
 
 
 
 
 
 
796
  $this->_updateLastError($response, array('status' => $status));
797
  Mage::throwException($message);
798
  }
844
 
845
  Mage::helper('klarna')->logDebugInfo('refund rest response = ' . $response . ' status = ' . $status);
846
 
 
 
 
847
  if ($status != 204) {
848
+ $message = $this->_buildMessageFromResponse('Error refunding order: ' . $status, $response);
 
 
 
 
 
 
 
 
 
849
  $this->_updateLastError($response, array('status' => $status));
850
  Mage::throwException($message);
851
  }
881
  Mage::helper('klarna')->logDebugInfo('cancel rest response = ' . $response . ' status = ' . $status);
882
 
883
  if ($status != 204) {
884
+ $message = $this->_buildMessageFromResponse('Error canceling order: ' . $status, $response);
 
 
 
 
 
 
 
 
 
885
  $this->_updateLastError($response, array('status' => $status));
886
  Mage::throwException($message);
887
  }
916
  Mage::helper('klarna')->logDebugInfo('release rest response = ' . $response . ' status = ' . $status);
917
 
918
  if ($status != 204) {
919
+ $message = $this->_buildMessageFromResponse('Error canceling order: ' . $status, $response);
 
 
 
 
 
 
 
 
 
920
  $this->_updateLastError($response, array('status' => $status));
921
  Mage::throwException($message);
922
  }
934
 
935
  public function initKlarnaOrder($checkoutId = null, $createIfNotExists = false, $updateItems = false, $quoteId = '')
936
  {
937
+ $message = '';
938
  if ($checkoutId) {
939
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder rest checkout id: ' . $checkoutId . ' (quote id: ' . $quoteId . ')');
940
  $loadf = true;
952
  } catch (Exception $e) {
953
  if ($this->_getLastError('status')=='403' &&
954
  $this->_getLastError('error_code')=='READ_ONLY_ORDER') {
955
+ // We should probably redirect to success or display error... as this means the order is Done in Klarna...
956
+ $message = 'initKlarnaOrder trying to update, but it is forbidden, so we skip it and just use fetch';
957
+ Mage::helper('klarna')->logKlarnaApi($message);
958
  $this->_fetchOrder($checkoutId);
959
+ } elseif ($this->_getLastError('status')=='0' &&
960
+ $this->_getLastError('error_code')==null) {
961
+ Mage::helper('klarna')->logDebugInfo('initKlarnaOrder possible timeout in communication with Klarna');
962
+ return false;
963
  } else {
964
  throw $e;
965
  }
970
  }
971
  $res = $this->_klarnaOrder!=NULL;
972
  if ($res) {
973
+ if ($checkoutId!=$this->_getLocationOrderId()) {
974
+ $message = 'POTENTIAL ERROR. initKlarnaOrder checkoutId: ' . $checkoutId . ' received: ' . $this->_getLocationOrderId();
975
+ Mage::helper('klarna')->logDebugInfo($message);
976
+ }
977
  if ($this->_getLocationOrderId()) {
978
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
979
  }
980
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
981
+ Mage::helper('klarna')->updateKlarnacheckoutHistory(
982
+ Mage::getSingleton('checkout/session')->getKlarnaCheckoutId(),
983
+ $message,
984
+ $quoteId
985
+ );
986
  }
987
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder rest true');
988
  return $res;
997
  } catch (Exception $e) {
998
  if ($this->_getLastError('status')=='403' &&
999
  $this->_getLastError('error_code')=='READ_ONLY_ORDER') {
1000
+ // We should probably redirect to success or display error... as this means the order is Done in Klarna...
1001
+ Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder trying to update, but it is forbidden, so we skip it and just use fetch');
1002
  $this->_fetchOrder($klarnaCheckoutId);
1003
+ } elseif ($this->_getLastError('status')=='0' &&
1004
+ $this->_getLastError('error_code')==null) {
1005
+ Mage::helper('klarna')->logDebugInfo('initKlarnaOrder possible timeout in communication with Klarna');
1006
+ return false;
1007
  } else {
1008
  throw $e;
1009
  }
1013
  }
1014
  $res = $this->_klarnaOrder!=NULL;
1015
  if ($res) {
1016
+ if ($checkoutId!=$this->_getLocationOrderId()) {
1017
+ $message = 'POTENTIAL ERROR. initKlarnaOrder checkoutId received: ' . $this->_getLocationOrderId();
1018
+ Mage::helper('klarna')->logDebugInfo($message, null, $checkoutId);
1019
+ }
1020
  if ($this->_getLocationOrderId()) {
1021
  $this->_setKlarnaCheckoutId($this->_getLocationOrderId());
1022
  }
1023
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
1024
+ Mage::helper('klarna')->updateKlarnacheckoutHistory(
1025
+ Mage::getSingleton('checkout/session')->getKlarnaCheckoutId(),
1026
+ $message,
1027
+ $quoteId
1028
+ );
1029
  }
1030
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder rest true');
1031
  return $res;
1049
  Mage::dispatchEvent('klarnacheckout_init_klarna_order', array('klarna_order' => $this->_klarnaOrder, 'api_version' => $this->getApiVersion()));
1050
  }
1051
  Mage::helper('klarna')->logKlarnaApi('initKlarnaOrder res: ' . $res);
1052
+ Mage::helper('klarna')->updateKlarnacheckoutHistory(
1053
+ Mage::getSingleton('checkout/session')->getKlarnaCheckoutId(),
1054
+ $message,
1055
+ $quoteId
1056
+ );
1057
  return $res;
1058
  }
1059
  }
1259
  $data = $createdKlarnaOrder->getData();
1260
  // $data is actually an object
1261
  if (isset($data['order_lines'])) {
1262
+ $reference = Mage::helper('klarna')->getProductReference(
1263
+ $quoteItem->getSku(),
1264
+ $quoteItem->getAdditionalData()
1265
+ );
1266
  foreach ($data['order_lines'] as $klarnaItem) {
1267
+ if ($klarnaItem['reference']==substr($reference, 0, 64) &&
1268
  $klarnaItem['quantity']==$quoteItem->getQty()
1269
  ) {
1270
  $foundf = true;
app/code/community/Vaimo/Klarna/Model/Creditmemo/Tax.php CHANGED
@@ -95,11 +95,11 @@ class Vaimo_Klarna_Model_Creditmemo_Tax extends Mage_Sales_Model_Order_Creditmem
95
  return $this;
96
  }
97
 
98
- $refundedExVat = round($klarnaFeeRefunded * $rate,0);
99
  $refundedVat = $klarnaFeeRefunded - $refundedExVat;
100
  $klarnaFeeTax = $klarnaFeeTax - $refundedVat;
101
 
102
- $baseRefundedExVat = round($baseKlarnaFeeRefunded * $rate,0);
103
  $baseRefundedVat = $baseKlarnaFeeRefunded - $baseRefundedExVat;
104
  $baseKlarnaFeeTax = $baseKlarnaFeeTax - $baseRefundedVat;
105
 
@@ -110,10 +110,10 @@ class Vaimo_Klarna_Model_Creditmemo_Tax extends Mage_Sales_Model_Order_Creditmem
110
  $baseKlarnaFeeRefund = $creditmemo->getVaimoKlarnaBaseFeeRefund();
111
 
112
  if ($klarnaFeeRefund || $klarnaFeeRefund===0 || $klarnaFeeRefund==="0") {
113
- $refundExVat = round($klarnaFeeRefund * $rate,0);
114
  $klarnaFeeTax = $klarnaFeeRefund - $refundExVat;
115
 
116
- $baseRefundExVat = round($baseKlarnaFeeRefund * $rate,0);
117
  $baseKlarnaFeeTax = $baseKlarnaFeeRefund - $baseRefundExVat;
118
  }
119
 
95
  return $this;
96
  }
97
 
98
+ $refundedExVat = round($klarnaFeeRefunded * $rate,2);
99
  $refundedVat = $klarnaFeeRefunded - $refundedExVat;
100
  $klarnaFeeTax = $klarnaFeeTax - $refundedVat;
101
 
102
+ $baseRefundedExVat = round($baseKlarnaFeeRefunded * $rate,2);
103
  $baseRefundedVat = $baseKlarnaFeeRefunded - $baseRefundedExVat;
104
  $baseKlarnaFeeTax = $baseKlarnaFeeTax - $baseRefundedVat;
105
 
110
  $baseKlarnaFeeRefund = $creditmemo->getVaimoKlarnaBaseFeeRefund();
111
 
112
  if ($klarnaFeeRefund || $klarnaFeeRefund===0 || $klarnaFeeRefund==="0") {
113
+ $refundExVat = round($klarnaFeeRefund * $rate,2);
114
  $klarnaFeeTax = $klarnaFeeRefund - $refundExVat;
115
 
116
+ $baseRefundExVat = round($baseKlarnaFeeRefund * $rate,2);
117
  $baseKlarnaFeeTax = $baseKlarnaFeeRefund - $baseRefundExVat;
118
  }
119
 
app/code/community/Vaimo/Klarna/Model/Creditmemo/Total.php CHANGED
@@ -110,12 +110,12 @@ class Vaimo_Klarna_Model_Creditmemo_Total extends Mage_Sales_Model_Order_Creditm
110
  return $this;
111
  }
112
 
113
- $refundedExVat = round($klarnaFeeRefunded * $rate,0);
114
  $refundedVat = $klarnaFeeRefunded - $refundedExVat;
115
  $klarnaFee = $klarnaFee - $refundedExVat;
116
  $klarnaFeeTax = $klarnaFeeTax - $refundedVat;
117
 
118
- $baseRefundedExVat = round($baseKlarnaFeeRefunded * $rate,0);
119
  $baseRefundedVat = $baseKlarnaFeeRefunded - $baseRefundedExVat;
120
  $baseKlarnaFee = $baseKlarnaFee - $baseRefundedExVat;
121
  $baseKlarnaFeeTax = $baseKlarnaFeeTax - $baseRefundedVat;
@@ -130,8 +130,8 @@ class Vaimo_Klarna_Model_Creditmemo_Total extends Mage_Sales_Model_Order_Creditm
130
  $baseCreditmemoTotal = $baseCreditmemoTotal + $baseKlarnaFeeRefund;
131
  $creditmemoTotal = $creditmemoTotal + $klarnaFeeRefund;
132
 
133
- $klarnaFee = round($klarnaFeeRefund * $rate,0);
134
- $baseKlarnaFee = round($baseKlarnaFeeRefund * $rate,0);
135
  } else {
136
  $baseCreditmemoTotal = $baseCreditmemoTotal + $baseKlarnaFee + $baseKlarnaFeeTax;
137
  $creditmemoTotal = $creditmemoTotal + $klarnaFee + $klarnaFeeTax;
110
  return $this;
111
  }
112
 
113
+ $refundedExVat = round($klarnaFeeRefunded * $rate,2);
114
  $refundedVat = $klarnaFeeRefunded - $refundedExVat;
115
  $klarnaFee = $klarnaFee - $refundedExVat;
116
  $klarnaFeeTax = $klarnaFeeTax - $refundedVat;
117
 
118
+ $baseRefundedExVat = round($baseKlarnaFeeRefunded * $rate,2);
119
  $baseRefundedVat = $baseKlarnaFeeRefunded - $baseRefundedExVat;
120
  $baseKlarnaFee = $baseKlarnaFee - $baseRefundedExVat;
121
  $baseKlarnaFeeTax = $baseKlarnaFeeTax - $baseRefundedVat;
130
  $baseCreditmemoTotal = $baseCreditmemoTotal + $baseKlarnaFeeRefund;
131
  $creditmemoTotal = $creditmemoTotal + $klarnaFeeRefund;
132
 
133
+ $klarnaFee = round($klarnaFeeRefund * $rate,2);
134
+ $baseKlarnaFee = round($baseKlarnaFeeRefund * $rate,2);
135
  } else {
136
  $baseCreditmemoTotal = $baseCreditmemoTotal + $baseKlarnaFee + $baseKlarnaFeeTax;
137
  $creditmemoTotal = $creditmemoTotal + $klarnaFee + $klarnaFeeTax;
app/code/community/Vaimo/Klarna/Model/Cron.php CHANGED
@@ -26,11 +26,13 @@
26
 
27
  class Vaimo_Klarna_Model_Cron extends Mage_Core_Model_Abstract
28
  {
 
29
  public function statusUpdateOfPendingOrders()
30
  {
31
  $orders = Mage::getModel("sales/order")->getCollection()
32
  ->addFieldToFilter("state", array('eq' => Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW))
33
  ->addFieldToFilter("updated_at", array('gteq' => date("Y-m-d H:i:s", time() - 172800))); // 2 Days
 
34
  foreach ($orders as $order) {
35
  try {
36
  $payment = $order->getPayment();
@@ -44,79 +46,13 @@ class Vaimo_Klarna_Model_Cron extends Mage_Core_Model_Abstract
44
  }
45
  }
46
 
47
- /**
48
- * Basically a copy of the KlarnaController pushAction
49
- * This will be unified later
50
- */
51
- public function treatPushQueue()
52
  {
53
- $collection = Mage::getModel('klarna/pushqueue')
54
- ->getCollection()
55
- ->applyRetryFilter(Vaimo_Klarna_Helper_Data::KLARNA_KCO_QUEUE_RETRY_ATTEMPTS);
56
- if ($collection->count()>0) {
57
- $helper = Mage::helper('klarna');
58
- $helper->setFunctionNameForLog('cron treatPushQueue');
59
- $helper->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
60
- foreach ($collection as $pushQueue) {
61
- $helper->logKlarnaApi('Queue id: ' . $pushQueue->getId());
62
- $checkoutId = $pushQueue->getKlarnaOrderNumber();
63
- $quote = $helper->findQuote($checkoutId);
64
- if (!$quote || !$quote->getId()) {
65
- $pushQueue->setMessage('Quote missing, skipping');
66
- $attempt = $pushQueue->getRetryAttempts();
67
- $pushQueue->setRetryAttempts($attempt + 1);
68
- $pushQueue->save();
69
- $helper->logKlarnaApi('Quote missing, skipping');
70
- continue;
71
- }
72
-
73
- /** @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
74
- $klarna = Mage::getModel('klarna/klarnacheckout');
75
- $klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
76
- if (substr($checkoutId, -1, 1) == '/') {
77
- $checkoutId = substr($checkoutId, 0, strlen($checkoutId) - 1);
78
- }
79
-
80
- if ($checkoutId) {
81
- try {
82
- // createOrder returns the order if successful, otherwise an error string
83
- $helper->logKlarnaApi('Calling create order with id: ' . $checkoutId);
84
- $result = $klarna->createOrder($checkoutId);
85
-
86
- if (is_array($result)) {
87
- if ($result['status']=='success') {
88
- $pushQueue->delete();
89
- $helper->logKlarnaApi('Klarna cron order created successfully, order id: ' . $result['order']->getId());
90
- } elseif ($result['status']=='fail') {
91
- $pushQueue->delete();
92
- $helper->logKlarnaApi($result['message']);
93
- } else {
94
- $pushQueue->setMessage($result['message']);
95
- $attempt = $pushQueue->getRetryAttempts();
96
- $pushQueue->setRetryAttempts($attempt + 1);
97
- $pushQueue->save();
98
- $helper->logKlarnaApi($result['message']);
99
- }
100
- } else {
101
- $pushQueue->setMessage('Unkown error from createOrder');
102
- $attempt = $pushQueue->getRetryAttempts();
103
- $pushQueue->setRetryAttempts($attempt + 1);
104
- $pushQueue->save();
105
- $helper->logKlarnaApi('Unkown error from createOrder');
106
- }
107
-
108
- } catch (Exception $e) {
109
- $pushQueue->setMessage($e->getMessage());
110
- $attempt = $pushQueue->getRetryAttempts();
111
- $pushQueue->setRetryAttempts($attempt + 1);
112
- $pushQueue->save();
113
- $helper->logKlarnaException($e);
114
- $helper->logKlarnaApi('Exception ' . $e->getMessage());
115
- }
116
- }
117
- }
118
- $helper->setFunctionNameForLog('cron treatPushQueue');
119
- $helper->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
120
- }
121
  }
122
  }
26
 
27
  class Vaimo_Klarna_Model_Cron extends Mage_Core_Model_Abstract
28
  {
29
+
30
  public function statusUpdateOfPendingOrders()
31
  {
32
  $orders = Mage::getModel("sales/order")->getCollection()
33
  ->addFieldToFilter("state", array('eq' => Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW))
34
  ->addFieldToFilter("updated_at", array('gteq' => date("Y-m-d H:i:s", time() - 172800))); // 2 Days
35
+ /* @var Mage_Sales_Model_Order $order */
36
  foreach ($orders as $order) {
37
  try {
38
  $payment = $order->getPayment();
46
  }
47
  }
48
 
49
+ public function purgeLogs()
 
 
 
 
50
  {
51
+ /** @var Vaimo_Klarna_Model_Resource_Log $logs */
52
+ $logs = Mage::getResourceModel('klarna/log');
53
+ $logs->purgeLog(-180);
54
+ /** @var Vaimo_Klarna_Model_Resource_Log_Data $log_data */
55
+ $log_data = Mage::getResourceModel('klarna/log_data');
56
+ $log_data->purgeLog(-30);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
  }
app/code/community/Vaimo/Klarna/Model/Klarna.php CHANGED
@@ -37,6 +37,8 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
37
  protected static $_session_key = 'klarna_address';
38
  protected static $_pclasses_key = 'klarna_pclasses';
39
 
 
 
40
  public function __construct($setStoreInfo = true, $moduleHelper = NULL, $entGWHelper = NULL, $salesHelper = NULL, $taxCalculation = NULL)
41
  {
42
  parent::__construct($setStoreInfo, $moduleHelper, $entGWHelper, $salesHelper, $taxCalculation);
@@ -86,7 +88,6 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
86
  */
87
  protected function _init($functionName)
88
  {
89
- $this->_getHelper()->setFunctionNameForLog($this->_getHelper()->getFunctionNameForLog() . '-' . $functionName);
90
  $this->_initApi($this->_getStoreId(), $this->getMethod(), $functionName);
91
  $this->getApi()->init($this->getKlarnaSetup());
92
  $this->getApi()->setTransport($this->_getTransport());
@@ -96,11 +97,11 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
96
  {
97
  try {
98
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_RESERVE);
99
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
100
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
101
  $items = $this->getPayment()->getKlarnaItemList();
102
  $this->_createGoodsList($items);
103
- $this->_getHelper()->logKlarnaApi('Call with personal ID ' . $this->getPNO());
104
 
105
  $this->getApi()->setGoodsListReserve();
106
  $this->getApi()->setAddresses($this->getBillingAddress(), $this->getShippingAddress(), $this->_getAdditionalInformation());
@@ -117,9 +118,10 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
117
  $this->_getHelper()->dispatchMethodEvent($this->getOrder(), Vaimo_Klarna_Helper_Data::KLARNA_DISPATCH_RESERVED, $this->getOrder()->getTotalDue(), $this->getMethod());
118
 
119
  $this->_cleanAdditionalInfo();
120
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
121
 
122
  } catch (KlarnaException $e) {
 
123
  Mage::throwException($e->getMessage());
124
  }
125
  return $res;
@@ -129,13 +131,13 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
129
  {
130
  try {
131
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CAPTURE);
132
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
133
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
134
  $items = $this->getPayment()->getKlarnaItemList();
135
- $this->_createGoodsList($items);
136
 
137
  $reservation_no = $this->_getReservationNo();
138
- $this->_getHelper()->logKlarnaApi('Call with reservation ID ' . $reservation_no);
139
 
140
  $this->getApi()->setGoodsListCapture($amount);
141
  $this->getApi()->setAddresses($this->getBillingAddress(), $this->getShippingAddress(), $this->_getAdditionalInformation());
@@ -149,9 +151,10 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
149
 
150
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS] . ' - ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_TRANSACTION_ID]);
151
 
152
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
153
 
154
  } catch (KlarnaException $e) {
 
155
  Mage::throwException($e->getMessage());
156
  }
157
  return $res;
@@ -161,11 +164,12 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
161
  {
162
  try {
163
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_REFUND);
164
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
165
  $invoice_no = $this->getInfoInstance()->getParentTransactionId();
166
  $this->_setAdditionalInformation($this->getInfoInstance()->getAdditionalInformation());
167
  $items = $this->getPayment()->getKlarnaItemList();
168
  $this->_createRefundGoodsList($items);
 
169
 
170
  $res = $this->getApi()->refund($amount, $invoice_no);
171
 
@@ -175,9 +179,10 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
175
 
176
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS] . ' - ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_TRANSACTION_ID]);
177
 
178
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
179
 
180
  } catch (KlarnaException $e) {
 
181
  Mage::throwException($e->getMessage());
182
  }
183
  return $res;
@@ -187,7 +192,7 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
187
  {
188
  try {
189
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CANCEL);
190
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
191
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
192
 
193
  if ($direct_rno) {
@@ -195,7 +200,7 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
195
  } else {
196
  $reservation_no = $this->_getReservationNo();
197
  }
198
- $this->_getHelper()->logKlarnaApi('Call with reservation ID ' . $reservation_no);
199
 
200
  if ($this->getOrder()->getTotalPaid()>0) {
201
  $res = $this->getApi()->release($reservation_no);
@@ -207,9 +212,10 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
207
 
208
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS]);
209
 
210
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
211
 
212
  } catch (KlarnaException $e) {
 
213
  Mage::throwException($e->getMessage());
214
  }
215
  return $res;
@@ -219,19 +225,20 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
219
  {
220
  try {
221
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CHECKSTATUS);
222
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
223
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
224
 
225
  $reservation_no = $this->_getReservationNo();
226
- $this->_getHelper()->logKlarnaApi('Call with reservation ID ' . $reservation_no);
227
 
228
  $res = $this->getApi()->checkStatus($reservation_no);
229
 
230
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS]);
231
 
232
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
233
 
234
  } catch (KlarnaException $e) {
 
235
  Mage::throwException($e->getMessage());
236
  }
237
  return $res;
@@ -251,12 +258,16 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
251
  $cache = unserialize( base64_decode($_SESSION[self::$_session_key]) );
252
  }
253
  if (array_key_exists($personal_id, $cache)) {
 
 
 
 
254
  return $cache[$personal_id];
255
  }
256
 
257
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_ADDRESSES);
258
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
259
- $this->_getHelper()->logKlarnaApi('Call with Personal ID ' . $personal_id);
260
 
261
  $res = $this->getApi()->getAddresses($personal_id);
262
 
@@ -265,9 +276,10 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
265
  $cache[$personal_id] = $res;
266
  $_SESSION[self::$_session_key] = base64_encode( serialize($cache) );
267
 
268
- $this->_getHelper()->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
269
 
270
- } catch (KlarnaException $e) {
 
271
  Mage::throwException($e->getMessage());
272
  }
273
  return $res;
@@ -389,9 +401,9 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
389
 
390
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES);
391
 
392
- $this->_getHelper()->logKlarnaApi('Call clear');
393
  $this->getApi()->clearPClasses();
394
- $this->_getHelper()->logKlarnaApi('Call clear OK');
395
 
396
  } catch (KlarnaException $e) {
397
  Mage::throwException($e->getMessage());
@@ -402,9 +414,9 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
402
  $this->setStoreInformation($storeId);
403
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES); // Need to call it again because we now have new storeId
404
 
405
- $this->_getHelper()->logKlarnaApi('Call fetch all');
406
  $this->getApi()->fetchPClasses($storeId);
407
- $this->_getHelper()->logKlarnaApi('Call fetch all OK');
408
 
409
  } catch (KlarnaException $e) {
410
  Mage::throwException($e->getMessage());
@@ -451,11 +463,12 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
451
  try {
452
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES);
453
  $amount = $this->getQuote()->getGrandTotal();
454
- $this->_getHelper()->logKlarnaApi('Call get specific');
455
 
456
  $res = $this->getApi()->getSpecificPClass($id, $amount);
457
 
458
- $this->_getHelper()->logKlarnaApi('Response OK');
 
459
  } catch (Mage_Core_Exception $e) {
460
  $this->_getHelper()->logKlarnaException($e);
461
  }
@@ -470,11 +483,12 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
470
  {
471
  try {
472
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES);
473
- $this->_getHelper()->logKlarnaApi('Call get display all');
474
 
475
  $res = $this->getApi()->getDisplayAllPClasses();
476
 
477
  $this->_getHelper()->logKlarnaApi('Response OK');
 
478
  } catch (Mage_Core_Exception $e) {
479
  Mage::throwException($e->getMessage());
480
  }
@@ -561,7 +575,7 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
561
  $id = $this->getPostValues(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_PAYMENT_PLAN);
562
  // @todo read from checkoutService to find new details for Sweden and Norway and store them
563
  $method = $this->getMethod();
564
- if ($id && $method==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT) {
565
  $pclassArray = $this->_getSpecificPClass($id);
566
  if (!$pclassArray) {
567
  Mage::throwException($this->_getHelper()->__('Unexpected error, pclass does not exist, please reload page and try again'));
@@ -639,6 +653,9 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
639
  if ($this->_checkPaymentPlan()==false) {
640
  Mage::throwException($this->_getHelper()->__('You must choose a payment plan'));
641
  }
 
 
 
642
  }
643
 
644
  public function createItemListRefund()
37
  protected static $_session_key = 'klarna_address';
38
  protected static $_pclasses_key = 'klarna_pclasses';
39
 
40
+ protected static $_personalIdLogged = false;
41
+
42
  public function __construct($setStoreInfo = true, $moduleHelper = NULL, $entGWHelper = NULL, $salesHelper = NULL, $taxCalculation = NULL)
43
  {
44
  parent::__construct($setStoreInfo, $moduleHelper, $entGWHelper, $salesHelper, $taxCalculation);
88
  */
89
  protected function _init($functionName)
90
  {
 
91
  $this->_initApi($this->_getStoreId(), $this->getMethod(), $functionName);
92
  $this->getApi()->init($this->getKlarnaSetup());
93
  $this->getApi()->setTransport($this->_getTransport());
97
  {
98
  try {
99
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_RESERVE);
100
+ $this->_getHelper()->logKlarnaActionStart($this->getMethod(), Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_RESERVE);
101
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
102
  $items = $this->getPayment()->getKlarnaItemList();
103
  $this->_createGoodsList($items);
104
+ $this->_getHelper()->logKlarnaApi('Personal ID ' . $this->getPNO());
105
 
106
  $this->getApi()->setGoodsListReserve();
107
  $this->getApi()->setAddresses($this->getBillingAddress(), $this->getShippingAddress(), $this->_getAdditionalInformation());
118
  $this->_getHelper()->dispatchMethodEvent($this->getOrder(), Vaimo_Klarna_Helper_Data::KLARNA_DISPATCH_RESERVED, $this->getOrder()->getTotalDue(), $this->getMethod());
119
 
120
  $this->_cleanAdditionalInfo();
121
+ $this->_getHelper()->logKlarnaActionEnd();
122
 
123
  } catch (KlarnaException $e) {
124
+ $this->_getHelper()->logKlarnaActionEnd();
125
  Mage::throwException($e->getMessage());
126
  }
127
  return $res;
131
  {
132
  try {
133
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CAPTURE);
134
+ $this->_getHelper()->logKlarnaActionStart($this->getMethod(), Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CAPTURE);
135
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
136
  $items = $this->getPayment()->getKlarnaItemList();
137
+ $this->_createInvoiceGoodsList($items);
138
 
139
  $reservation_no = $this->_getReservationNo();
140
+ $this->_getHelper()->logKlarnaApi('Reservation ID ' . $reservation_no);
141
 
142
  $this->getApi()->setGoodsListCapture($amount);
143
  $this->getApi()->setAddresses($this->getBillingAddress(), $this->getShippingAddress(), $this->_getAdditionalInformation());
151
 
152
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS] . ' - ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_TRANSACTION_ID]);
153
 
154
+ $this->_getHelper()->logKlarnaActionEnd();
155
 
156
  } catch (KlarnaException $e) {
157
+ $this->_getHelper()->logKlarnaActionEnd();
158
  Mage::throwException($e->getMessage());
159
  }
160
  return $res;
164
  {
165
  try {
166
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_REFUND);
167
+ $this->_getHelper()->logKlarnaActionStart($this->getMethod(), Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_REFUND);
168
  $invoice_no = $this->getInfoInstance()->getParentTransactionId();
169
  $this->_setAdditionalInformation($this->getInfoInstance()->getAdditionalInformation());
170
  $items = $this->getPayment()->getKlarnaItemList();
171
  $this->_createRefundGoodsList($items);
172
+ $this->_getHelper()->logKlarnaApi('Invoice NO ' . $invoice_no);
173
 
174
  $res = $this->getApi()->refund($amount, $invoice_no);
175
 
179
 
180
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS] . ' - ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_TRANSACTION_ID]);
181
 
182
+ $this->_getHelper()->logKlarnaActionEnd();
183
 
184
  } catch (KlarnaException $e) {
185
+ $this->_getHelper()->logKlarnaActionEnd();
186
  Mage::throwException($e->getMessage());
187
  }
188
  return $res;
192
  {
193
  try {
194
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CANCEL);
195
+ $this->_getHelper()->logKlarnaActionStart($this->getMethod(), Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CANCEL);
196
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
197
 
198
  if ($direct_rno) {
200
  } else {
201
  $reservation_no = $this->_getReservationNo();
202
  }
203
+ $this->_getHelper()->logKlarnaApi('Reservation ID ' . $reservation_no);
204
 
205
  if ($this->getOrder()->getTotalPaid()>0) {
206
  $res = $this->getApi()->release($reservation_no);
212
 
213
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS]);
214
 
215
+ $this->_getHelper()->logKlarnaActionEnd();
216
 
217
  } catch (KlarnaException $e) {
218
+ $this->_getHelper()->logKlarnaActionEnd();
219
  Mage::throwException($e->getMessage());
220
  }
221
  return $res;
225
  {
226
  try {
227
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CHECKSTATUS);
228
+ $this->_getHelper()->logKlarnaActionStart($this->getMethod(), Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CHECKSTATUS);
229
  $this->_setAdditionalInformation($this->getPayment()->getAdditionalInformation());
230
 
231
  $reservation_no = $this->_getReservationNo();
232
+ $this->_getHelper()->logKlarnaApi('Reservation ID ' . $reservation_no);
233
 
234
  $res = $this->getApi()->checkStatus($reservation_no);
235
 
236
  $this->_getHelper()->logKlarnaApi('Response ' . $res[Vaimo_Klarna_Helper_Data::KLARNA_API_RESPONSE_STATUS]);
237
 
238
+ $this->_getHelper()->logKlarnaActionEnd();
239
 
240
  } catch (KlarnaException $e) {
241
+ $this->_getHelper()->logKlarnaActionEnd();
242
  Mage::throwException($e->getMessage());
243
  }
244
  return $res;
258
  $cache = unserialize( base64_decode($_SESSION[self::$_session_key]) );
259
  }
260
  if (array_key_exists($personal_id, $cache)) {
261
+ if (!self::$_personalIdLogged) {
262
+ $this->_getHelper()->logKlarnaApi('Personal ID ' . $personal_id . ' (read from cache)');
263
+ self::$_personalIdLogged = true;
264
+ }
265
  return $cache[$personal_id];
266
  }
267
 
268
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_ADDRESSES);
269
+ $this->_getHelper()->logKlarnaActionStart($this->getMethod(), Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_ADDRESSES);
270
+ $this->_getHelper()->logKlarnaApi('Personal ID ' . $personal_id);
271
 
272
  $res = $this->getApi()->getAddresses($personal_id);
273
 
276
  $cache[$personal_id] = $res;
277
  $_SESSION[self::$_session_key] = base64_encode( serialize($cache) );
278
 
279
+ $this->_getHelper()->logKlarnaActionEnd();
280
 
281
+ } catch (Exception $e) {
282
+ $this->_getHelper()->logKlarnaActionEnd();
283
  Mage::throwException($e->getMessage());
284
  }
285
  return $res;
401
 
402
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES);
403
 
404
+ $this->_getHelper()->logKlarnaApi('Call clear pclasses');
405
  $this->getApi()->clearPClasses();
406
+ $this->_getHelper()->logKlarnaApi('Response OK');
407
 
408
  } catch (KlarnaException $e) {
409
  Mage::throwException($e->getMessage());
414
  $this->setStoreInformation($storeId);
415
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES); // Need to call it again because we now have new storeId
416
 
417
+ $this->_getHelper()->logKlarnaApi('Call fetch all pclasses');
418
  $this->getApi()->fetchPClasses($storeId);
419
+ $this->_getHelper()->logKlarnaApi('Response OK');
420
 
421
  } catch (KlarnaException $e) {
422
  Mage::throwException($e->getMessage());
463
  try {
464
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES);
465
  $amount = $this->getQuote()->getGrandTotal();
466
+ //$this->_getHelper()->logKlarnaApi('Get specific pclass (' . $id . ')');
467
 
468
  $res = $this->getApi()->getSpecificPClass($id, $amount);
469
 
470
+ //$this->_getHelper()->logKlarnaApi('Response OK');
471
+
472
  } catch (Mage_Core_Exception $e) {
473
  $this->_getHelper()->logKlarnaException($e);
474
  }
483
  {
484
  try {
485
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_PCLASSES);
486
+ $this->_getHelper()->logKlarnaApi('Get all pclasses');
487
 
488
  $res = $this->getApi()->getDisplayAllPClasses();
489
 
490
  $this->_getHelper()->logKlarnaApi('Response OK');
491
+
492
  } catch (Mage_Core_Exception $e) {
493
  Mage::throwException($e->getMessage());
494
  }
575
  $id = $this->getPostValues(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_PAYMENT_PLAN);
576
  // @todo read from checkoutService to find new details for Sweden and Norway and store them
577
  $method = $this->getMethod();
578
+ if ($id && ($method==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT || $method==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_SPECIAL)) {
579
  $pclassArray = $this->_getSpecificPClass($id);
580
  if (!$pclassArray) {
581
  Mage::throwException($this->_getHelper()->__('Unexpected error, pclass does not exist, please reload page and try again'));
653
  if ($this->_checkPaymentPlan()==false) {
654
  Mage::throwException($this->_getHelper()->__('You must choose a payment plan'));
655
  }
656
+ if ($this->validShippingAndBillingAddress()==false) {
657
+ Mage::throwException($this->_getHelper()->__('Name and country must be the same for shipping and billing address!'));
658
+ }
659
  }
660
 
661
  public function createItemListRefund()
app/code/community/Vaimo/Klarna/Model/Klarna/Abstract.php CHANGED
@@ -142,8 +142,8 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
142
  && (array_key_exists("dob_month", $this->_getAdditionalInformation()))
143
  && (array_key_exists("dob_year", $this->_getAdditionalInformation()))
144
  ) {
145
- return $this->_getAdditionalInformation("dob_day")
146
- . $this->_getAdditionalInformation("dob_month")
147
  . $this->_getAdditionalInformation("dob_year");
148
  }
149
  } elseif (array_key_exists("pno", $this->_getAdditionalInformation())
@@ -220,7 +220,7 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
220
  *
221
  * @return void
222
  */
223
- protected function _createGoodsList($items = null)
224
  {
225
  if ($items === null) {
226
  $items = $this->getOrder()->getAllVisibleItems();
@@ -228,6 +228,7 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
228
 
229
  $taxRate = NULL;
230
 
 
231
  foreach ($items as $item) {
232
 
233
  if ($this->_getHelper()->shouldItemBeIncluded($item)==false) continue;
@@ -252,11 +253,20 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
252
  $totalInclTax = 0;
253
  $taxAmount = 0;
254
  }
255
-
 
 
 
 
 
 
 
 
 
256
  $this->_goods_list[] =
257
  array(
258
  "qty" => $qty,
259
- "sku" => $item->getSku(),
260
  "name" => $item->getName(),
261
  "price" => $price,
262
  "total_amount" => $totalInclTax,
@@ -273,6 +283,18 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
273
  }
274
  }
275
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  /**
277
  * Create the goods list for Refunds
278
  *
@@ -289,17 +311,21 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
289
  $taxRate = NULL;
290
 
291
  if ($items) {
 
292
  foreach ($items as $item) {
293
  $qty = $item->getQty();
294
  $id = $item->getProductId();
295
  $product = $this->_loadProductById($id);
296
 
297
  $taxRate = $this->_getTaxRate($product->getTaxClassId());
298
-
 
 
 
299
  $this->_goods_list[] =
300
  array(
301
  "qty" => $qty,
302
- "sku" => $item->getSku(),
303
  "name" => $item->getName(),
304
  "price" => $item->getPriceInclTax(),
305
  "total_amount" => $item->getRowTotalInclTax(),
@@ -958,8 +984,8 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
958
  }
959
  if ($this->_getHelper()->isKlarnaField($key)) {
960
  $this->_postValues[$key] = $value;
961
- } else {
962
- $this->_getHelper()->logDebugInfo('Field ignored: ' . $key);
963
  }
964
  }
965
  }
142
  && (array_key_exists("dob_month", $this->_getAdditionalInformation()))
143
  && (array_key_exists("dob_year", $this->_getAdditionalInformation()))
144
  ) {
145
+ return str_pad($this->_getAdditionalInformation("dob_day"), 2, '0', STR_PAD_LEFT)
146
+ . str_pad($this->_getAdditionalInformation("dob_month"), 2, '0', STR_PAD_LEFT)
147
  . $this->_getAdditionalInformation("dob_year");
148
  }
149
  } elseif (array_key_exists("pno", $this->_getAdditionalInformation())
220
  *
221
  * @return void
222
  */
223
+ protected function _createGoodsList($items = null, $forReservation = true)
224
  {
225
  if ($items === null) {
226
  $items = $this->getOrder()->getAllVisibleItems();
228
 
229
  $taxRate = NULL;
230
 
231
+ /** @var Mage_Sales_Model_Order_Invoice_Item $item */
232
  foreach ($items as $item) {
233
 
234
  if ($this->_getHelper()->shouldItemBeIncluded($item)==false) continue;
253
  $totalInclTax = 0;
254
  $taxAmount = 0;
255
  }
256
+ // $item can be either order or invoice item...
257
+ if ($forReservation) {
258
+ $additionalData = $item->getAdditionalData();
259
+ } else {
260
+ $additionalData = $item->getOrderItem()->getAdditionalData();
261
+ }
262
+ $reference = $this->_getHelper()->getProductReference(
263
+ $item->getSku(),
264
+ $additionalData
265
+ );
266
  $this->_goods_list[] =
267
  array(
268
  "qty" => $qty,
269
+ "sku" => $reference,
270
  "name" => $item->getName(),
271
  "price" => $price,
272
  "total_amount" => $totalInclTax,
283
  }
284
  }
285
 
286
+ /**
287
+ * Create the goods list for Invoices, separate function to make it easier to read
288
+ *
289
+ * @param array $items The items to add to the goods list
290
+ *
291
+ * @return void
292
+ */
293
+ protected function _createInvoiceGoodsList($items = null)
294
+ {
295
+ $this->_createGoodsList($items, false);
296
+ }
297
+
298
  /**
299
  * Create the goods list for Refunds
300
  *
311
  $taxRate = NULL;
312
 
313
  if ($items) {
314
+ /** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
315
  foreach ($items as $item) {
316
  $qty = $item->getQty();
317
  $id = $item->getProductId();
318
  $product = $this->_loadProductById($id);
319
 
320
  $taxRate = $this->_getTaxRate($product->getTaxClassId());
321
+ $reference = $this->_getHelper()->getProductReference(
322
+ $item->getSku(),
323
+ $item->getOrderItem()->getAdditionalData()
324
+ );
325
  $this->_goods_list[] =
326
  array(
327
  "qty" => $qty,
328
+ "sku" => $reference,
329
  "name" => $item->getName(),
330
  "price" => $item->getPriceInclTax(),
331
  "total_amount" => $item->getRowTotalInclTax(),
984
  }
985
  if ($this->_getHelper()->isKlarnaField($key)) {
986
  $this->_postValues[$key] = $value;
987
+ // } else {
988
+ // $this->_getHelper()->logDebugInfo('Field ignored: ' . $key);
989
  }
990
  }
991
  }
app/code/community/Vaimo/Klarna/Model/Klarnacheckout.php CHANGED
@@ -25,8 +25,11 @@
25
 
26
  class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckout_Abstract
27
  {
 
28
  protected $_api = NULL;
29
 
 
 
30
  public function __construct($setStoreInfo = true, $moduleHelper = NULL, $coreHttpHelper = NULL, $coreUrlHelper = NULL, $customerHelper = NULL)
31
  {
32
  parent::__construct($setStoreInfo, $moduleHelper, $coreHttpHelper, $coreUrlHelper, $customerHelper);
@@ -36,7 +39,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
36
  /**
37
  * Function added for Unit testing
38
  *
39
- * @param $apiObject
40
  */
41
  public function setApi($apiObject)
42
  {
@@ -72,7 +75,6 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
72
  */
73
  protected function _init($functionName)
74
  {
75
- $this->_getHelper()->setFunctionNameForLog($this->_getHelper()->getFunctionNameForLog() . '-' . $functionName);
76
  $this->_initApi($this->_getStoreId(), $this->getMethod(), $functionName);
77
  $this->_api->init($this->getKlarnaSetup());
78
  $this->_api->setTransport($this->_getTransport());
@@ -82,18 +84,20 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
82
  public function getKlarnaOrderHtml($checkoutId = null, $createIfNotExists = false, $updateItems = false)
83
  {
84
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
85
- if ($checkoutId) {
86
- $this->_getHelper()->logKlarnaApi('Call with checkout ID ' . $checkoutId);
87
- } else {
88
- $this->_getHelper()->logKlarnaApi('Call with checkout ID NULL');
89
- }
90
  if ($this->getQuote()) {
91
- $this->_api->initKlarnaOrder($checkoutId, $createIfNotExists, $updateItems, $this->getQuote()->getId());
 
 
 
 
 
 
92
  } else {
93
  $this->_api->initKlarnaOrder($checkoutId, $createIfNotExists, $updateItems);
94
  }
95
  $res = $this->_api->getKlarnaCheckoutGui();
96
- $this->_getHelper()->logKlarnaApi('Call complete');
97
  return $res;
98
  }
99
 
@@ -109,19 +113,21 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
109
  public function getCheckoutStatus($checkoutId = null, $useCurrentSession = true)
110
  {
111
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
112
- if ($checkoutId) {
113
- $this->_getHelper()->logKlarnaApi('Call with checkout ID ' . $checkoutId);
114
- } else {
115
- $this->_getHelper()->logKlarnaApi('Call with checkout ID NULL');
116
- }
117
  $this->_api->setKlarnaOrderSessionCache($useCurrentSession);
118
  if ($this->getQuote()) {
119
- $this->_api->initKlarnaOrder($checkoutId, false, false, $this->getQuote()->getId());
 
 
 
 
 
 
120
  } else {
121
  $this->_api->initKlarnaOrder($checkoutId);
122
  }
123
  $res = $this->_api->getKlarnaCheckoutStatus();
124
- $this->_getHelper()->logKlarnaApi('Call complete');
125
  return $res;
126
  }
127
 
@@ -147,32 +153,27 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
147
  public function getKlarnaOrderRaw($checkoutId)
148
  {
149
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
150
- if ($checkoutId) {
151
- $this->_getHelper()->logKlarnaApi('Call with checkout ID ' . $checkoutId);
152
- } else {
153
- $this->_getHelper()->logKlarnaApi('Call with checkout ID NULL');
154
- }
155
  $res = $this->_api->getKlarnaOrderRaw($checkoutId);
156
- $this->_getHelper()->logKlarnaApi('Call complete');
157
  return $res;
158
  }
159
 
160
- protected function _reduceParentItem($quote, $id, $qty)
161
- {
162
- foreach ($quote->getItemsCollection() as $item) {
163
- if ($item->getId()==$id) {
164
- $item->setQty($qty);
165
- $item->save();
166
- }
167
- }
168
- }
169
-
170
  protected function _checkItems($quote, $adjustFlag = false)
171
  {
172
- $res = NULL;
173
  $simpleQty = array();
 
174
  foreach ($quote->getItemsCollection() as $item) {
175
- if ($item->getProductType()=='simple') {
 
176
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($item->getProductId());
177
  if ($stockItem->getId()) {
178
  if (isset($simpleQty[$item->getSku()])) {
@@ -183,12 +184,17 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
183
  if (!$stockItem->checkQty($simpleQty[$item->getSku()])) {
184
  if (!$res) $res = array();
185
  $res[] = $this->_getHelper()->__('The requested quantity for "%s" is not available.', $item->getName());
 
186
  if ($adjustFlag) {
187
- $qty = 0;
188
- $item->setData('qty', $qty);
189
- $item->save();
 
 
190
  if ($item->getParentItemId()) {
191
- $this->_reduceParentItem($quote, $item->getParentItemId(), $qty);
 
 
192
  }
193
  $quote->setTotalsCollectedFlag(false);
194
  }
@@ -202,23 +208,27 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
202
  public function validateQuote($checkoutId, $createOrderOnValidate = NULL, $createdKlarnaOrder = NULL, $logInfo = 'validate')
203
  {
204
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCOVALIDATE_ORDER);
 
205
 
206
  /** @var Mage_Sales_Model_Quote $quote */
207
  $quote = $this->getQuote();
208
 
209
  if (!$quote->getId()) {
210
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote could not get quote');
 
211
  return $this->_getHelper()->__('could not get quote');
212
  }
213
 
214
  if (!$quote->hasItems()) {
215
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote has no items');
 
216
  return $this->_getHelper()->__('has no items');
217
  }
218
 
219
  $result = $this->_checkItems($quote);
220
 
221
  if ($result) {
 
222
  return implode("\n", $result);
223
  }
224
 
@@ -232,25 +242,29 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
232
  if (sizeof($result)==0) {
233
  $result = array('Unknown error');
234
  }
235
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote errors: ' . implode(" ", $result));
 
236
  return implode("\n", $result);
237
  }
238
 
239
  if (!$quote->validateMinimumAmount()) {
240
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote below minimum amount');
 
241
  return $this->_getHelper()->__('minimum amount');
242
  }
243
 
244
  $orderId = $this->_findAlreadyCreatedOrder($quote->getId());
245
  if ($orderId>0) {
246
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote order already created ' . $orderId);
 
247
  return $this->_getHelper()->__('order already created');
248
  }
249
 
250
  if ($createdKlarnaOrder) {
251
  $noticeTextArr = $this->_checkQuote($quote, $createdKlarnaOrder);
252
  if ($noticeTextArr!=NULL) {
253
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote failed in checkQuote', $noticeTextArr);
 
254
  return $this->_getHelper()->__('not matching cart');
255
  }
256
  }
@@ -258,11 +272,12 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
258
  if ($createOrderOnValidate && $createdKlarnaOrder) {
259
  // As validation is ok, creating the order should work, if it doesn't, it's
260
  // probably a temporary reason and we should reserve ID and await the push
261
- $order = $this->_createValidateOrder($checkoutId, $quote, $createdKlarnaOrder, $logInfo);
262
  if ($order && $order->getId()) {
263
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote created order id: ' . $order->getId());
264
  } else {
265
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote failed to created order');
 
266
  return $this->_getHelper()->__('failed to created order');
267
  //$quote->reserveOrderId()->save(); // Must be wrong...
268
  //$this->_getHelper()->logDebugInfo($logInfo . 'Quote reserved order id: ' . $quote->getReservedOrderId());
@@ -270,17 +285,48 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
270
  } else {
271
  $quote->collectTotals();
272
  $quote->reserveOrderId()->save();
273
- $this->_getHelper()->logDebugInfo($logInfo . 'Quote reserved order id: ' . $quote->getReservedOrderId());
274
  }
275
 
 
276
  return true;
277
  }
278
 
 
 
 
 
 
 
 
 
279
  public function successQuote($checkoutId, $createOrderOnSuccess, $createdKlarnaOrder)
 
 
 
 
 
 
 
 
 
 
 
 
280
  {
281
  $res = true;
282
  /** @var Mage_Sales_Model_Quote $quote */
283
  $quote = $this->getQuote();
 
 
 
 
 
 
 
 
 
 
284
  if ($createOrderOnSuccess) {
285
  try {
286
 
@@ -292,15 +338,6 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
292
 
293
  } else {
294
  // Why don't we set reserve order id on Quote??
295
- $this->_getHelper()->logDebugInfo('successAction closing quote id: ' .
296
- $quote->getId() . ' Klarna checkout ID: ' . $checkoutId );
297
- // Why not these lines?
298
- //$quote->setIsActive(false);
299
- //$quote->save();
300
- /** @var Mage_Core_Model_Resource $resource */
301
- $resource = Mage::getSingleton('core/resource');
302
- $read = $resource->getConnection('core_read');
303
- $read->update($resource->getTableName('sales/quote'), array('is_active' => 0), 'entity_id = ' . $quote->getId());
304
  }
305
  return $res;
306
  }
@@ -394,10 +431,11 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
394
  $quote->collectTotals();
395
 
396
  } catch(Exception $e) {
397
- $res = $e->getMessage();
 
398
  }
399
  if ($res) {
400
- $this->_getHelper()->logDebugInfo('_checkQuote return', $res);
401
  }
402
  return $res;
403
  }
@@ -439,7 +477,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
439
 
440
  protected function _createTheOrder($quote, $createdKlarnaOrder, $updatef, $pushf, $noticeTextArr = NULL)
441
  {
442
- $this->_getHelper()->logDebugInfo('_createTheOrder called with quote id: ' . $quote->getId());
443
 
444
  $this->_getHelper()->checkPaymentMethod($quote, true);
445
 
@@ -576,7 +614,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
576
  Mage::throwException($this->_getHelper()->__('Order cannot be created, cart not valid') . ' ' . $quote->getId());
577
  }
578
 
579
- $this->_getHelper()->logDebugInfo('_createTheOrder created order with ID: ' . $order->getId());
580
 
581
  if ($pushf) {
582
  if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
@@ -625,7 +663,14 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
625
  }
626
  $payment->save();
627
 
628
- $this->_getHelper()->logDebugInfo('_createTheOrder payment saved with ID: ' . $payment->getId());
 
 
 
 
 
 
 
629
 
630
  if ($pushf) {
631
  // send new order email
@@ -655,7 +700,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
655
  // So I'm taking this out
656
  //Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($order->getId())) );
657
 
658
- $this->_getHelper()->logDebugInfo('_createTheOrder successfully created order with no: ' . $order->getIncrementId());
659
 
660
  } catch(Exception $e) {
661
  $this->_getHelper()->logKlarnaException($e);
@@ -665,14 +710,8 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
665
 
666
  }
667
 
668
- protected function _createValidateOrder($checkoutId, $quote, $createdKlarnaOrder, $logInfo)
669
  {
670
- if ($checkoutId) {
671
- $this->_getHelper()->logKlarnaApi('Call with checkout ID ' . $checkoutId);
672
- } else {
673
- $this->_getHelper()->logKlarnaApi('Call with checkout ID NULL');
674
- }
675
-
676
  $this->_updateKlarnaOrderAddress($createdKlarnaOrder);
677
 
678
  $order = $this->_createTheOrder($quote, $createdKlarnaOrder, false, false);
@@ -687,17 +726,33 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
687
  return $order;
688
  }
689
 
690
- public function createOrder($checkoutId = NULL, $force = true)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
691
  {
692
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCOCREATE_ORDER);
693
- if ($checkoutId) {
694
- $this->_getHelper()->logKlarnaApi('Call with checkout ID ' . $checkoutId);
695
- } else {
696
- $this->_getHelper()->logKlarnaApi('Call with checkout ID NULL');
697
- }
698
  $createdKlarnaOrder = $this->_api->fetchCreatedOrder($checkoutId);
 
699
  if (!$createdKlarnaOrder) {
700
- $this->_getHelper()->logDebugInfo('createOrder could not fetch createdKlarnaOrder');
 
701
  return array(
702
  'status' => 'retry',
703
  'message' => 'could not fetch createdKlarnaOrder'
@@ -708,7 +763,8 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
708
  if ($quote == null) {
709
  $quote = $this->_api->loadQuote();
710
  if (!$quote) {
711
- $this->_getHelper()->logDebugInfo('createOrder could not get quote');
 
712
  return array(
713
  'status' => 'fail',
714
  'message' => 'could not get quote'
@@ -716,23 +772,33 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
716
  }
717
  $this->setQuote($quote);
718
  }
 
 
 
 
 
 
 
 
719
 
720
  $noticeTextArr = $this->_checkQuote($quote, $createdKlarnaOrder);
721
 
722
  $this->_updateKlarnaOrderAddress($createdKlarnaOrder);
723
 
724
  $klarnaStatus = $createdKlarnaOrder->getStatus();
725
- $this->_getHelper()->logDebugInfo('createOrder status of Klarna Order: ' . $klarnaStatus);
726
-
727
  if ($klarnaStatus != 'checkout_complete' && $klarnaStatus != 'created' && $klarnaStatus != 'AUTHORIZED') {
728
- $this->_getHelper()->logDebugInfo('createOrder status not complete');
729
  // These statuses are only valid for Rest API, need to test for v2 API codes as well
730
  if ($klarnaStatus == 'CANCELLED' || $klarnaStatus == 'EXPIRED' || $klarnaStatus == 'CLOSED') {
 
731
  return array(
732
  'status' => 'fail',
733
  'message' => 'authorization not valid ' . $createdKlarnaOrder->getStatus()
734
  );
735
  } else {
 
736
  return array(
737
  'status' => 'retry',
738
  'message' => 'status not complete ' . $createdKlarnaOrder->getStatus()
@@ -742,25 +808,11 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
742
 
743
  $updatef = false;
744
  $orderId = $this->_findAlreadyCreatedOrder($quote->getId());
745
- if ($orderId == 0 && !$force) {
746
- $createOrderOnSuccess = $this->getConfigData('create_order_on_success');
747
- if ($createOrderOnSuccess) {
748
- sleep(20);
749
- $orderId = $this->_findAlreadyCreatedOrder($quote->getId());
750
- if ($orderId == 0) {
751
- $this->_getHelper()->logDebugInfo('createOrder push before success');
752
- return array(
753
- 'status' => 'retry',
754
- 'message' => 'order not yet created'
755
- );
756
- }
757
- }
758
- }
759
  if ($orderId>0) {
760
- $this->_getHelper()->logDebugInfo('createOrder order already created, with ID ' . $orderId);
761
  $updatef = true;
762
  } else {
763
- $this->_getHelper()->logDebugInfo('createOrder will create new order in Magento');
764
  }
765
  $order = $this->_createTheOrder($quote, $createdKlarnaOrder, $updatef, true, $noticeTextArr);
766
 
@@ -777,6 +829,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
777
  $this->_getHelper()->logKlarnaException($e);
778
  }
779
 
 
780
  return array(
781
  'status' => 'success',
782
  'order' => $order
@@ -868,10 +921,10 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
868
  $quote->collectTotals();
869
  $quote->save();
870
  $this->setQuote($quote);
871
- $this->_getHelper()->logDebugInfo('taxshippingupdate A' . $quote->getId());
872
 
873
  $res = $this->_api->prepareTaxAndShippingReply();
874
- $this->_getHelper()->logDebugInfo('taxshippingupdate B' . $res);
875
  return $res;
876
  }
877
 
@@ -900,5 +953,4 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
900
  {
901
  return $this;
902
  }
903
-
904
  }
25
 
26
  class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckout_Abstract
27
  {
28
+ /* @var Vaimo_Klarna_Model_Api_Abstract $_api */
29
  protected $_api = NULL;
30
 
31
+ protected $_orderMessages = array();
32
+
33
  public function __construct($setStoreInfo = true, $moduleHelper = NULL, $coreHttpHelper = NULL, $coreUrlHelper = NULL, $customerHelper = NULL)
34
  {
35
  parent::__construct($setStoreInfo, $moduleHelper, $coreHttpHelper, $coreUrlHelper, $customerHelper);
39
  /**
40
  * Function added for Unit testing
41
  *
42
+ * @param Vaimo_Klarna_Model_Api_Abstract $apiObject
43
  */
44
  public function setApi($apiObject)
45
  {
75
  */
76
  protected function _init($functionName)
77
  {
 
78
  $this->_initApi($this->_getStoreId(), $this->getMethod(), $functionName);
79
  $this->_api->init($this->getKlarnaSetup());
80
  $this->_api->setTransport($this->_getTransport());
84
  public function getKlarnaOrderHtml($checkoutId = null, $createIfNotExists = false, $updateItems = false)
85
  {
86
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
87
+ $this->_getHelper()->logKlarnaCheckoutFunctionStart($checkoutId, Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
 
 
 
 
88
  if ($this->getQuote()) {
89
+ $quote = $this->getQuote();
90
+ if ($quote->getKlarnaCheckoutId()) {
91
+ if ($checkoutId!=$quote->getKlarnaCheckoutId()) {
92
+ $this->_getHelper()->logDebugInfo('POTENTIAL ERROR. getKlarnaOrderHtml on quote: ' . $quote->getKlarnaCheckoutId(), null, $checkoutId);
93
+ }
94
+ }
95
+ $this->_api->initKlarnaOrder($checkoutId, $createIfNotExists, $updateItems, $quote->getId());
96
  } else {
97
  $this->_api->initKlarnaOrder($checkoutId, $createIfNotExists, $updateItems);
98
  }
99
  $res = $this->_api->getKlarnaCheckoutGui();
100
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
101
  return $res;
102
  }
103
 
113
  public function getCheckoutStatus($checkoutId = null, $useCurrentSession = true)
114
  {
115
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
116
+ $this->_getHelper()->logKlarnaCheckoutFunctionStart($checkoutId, Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
 
 
 
 
117
  $this->_api->setKlarnaOrderSessionCache($useCurrentSession);
118
  if ($this->getQuote()) {
119
+ $quote = $this->getQuote();
120
+ if ($quote->getKlarnaCheckoutId()) {
121
+ if ($checkoutId!=$quote->getKlarnaCheckoutId()) {
122
+ $this->_getHelper()->logDebugInfo('POTENTIAL ERROR. getKlarnaOrderHtml on quote: ' . $quote->getKlarnaCheckoutId(), null, $checkoutId);
123
+ }
124
+ }
125
+ $this->_api->initKlarnaOrder($checkoutId, false, false, $quote->getId());
126
  } else {
127
  $this->_api->initKlarnaOrder($checkoutId);
128
  }
129
  $res = $this->_api->getKlarnaCheckoutStatus();
130
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
131
  return $res;
132
  }
133
 
153
  public function getKlarnaOrderRaw($checkoutId)
154
  {
155
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
156
+ $this->_getHelper()->logKlarnaCheckoutFunctionStart($checkoutId, Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCODISPLAY_ORDER);
 
 
 
 
157
  $res = $this->_api->getKlarnaOrderRaw($checkoutId);
158
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
159
  return $res;
160
  }
161
 
162
+ /**
163
+ * Checks if items has enough stock, if not, it will remove the item (if adjustFlag is set)
164
+ *
165
+ * @param $quote
166
+ * @param bool $adjustFlag
167
+ * @return array|null
168
+ */
 
 
 
169
  protected function _checkItems($quote, $adjustFlag = false)
170
  {
171
+ $res = null;
172
  $simpleQty = array();
173
+ /** @var Mage_Sales_Model_Quote_Item $item */
174
  foreach ($quote->getItemsCollection() as $item) {
175
+ if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
176
+ /** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */
177
  $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($item->getProductId());
178
  if ($stockItem->getId()) {
179
  if (isset($simpleQty[$item->getSku()])) {
184
  if (!$stockItem->checkQty($simpleQty[$item->getSku()])) {
185
  if (!$res) $res = array();
186
  $res[] = $this->_getHelper()->__('The requested quantity for "%s" is not available.', $item->getName());
187
+ $this->_getHelper()->logDebugInfo('The requested quantity ' . $simpleQty[$item->getSku()] . ', available ' . $stockItem->getQty() . ' for SKU ' . $item->getSku(), $item->getData());
188
  if ($adjustFlag) {
189
+ $this->_orderMessages[] = $this->_getHelper()->__(
190
+ 'The requested quantity (%s) for SKU "%s" is not available. Product deleted from this order, but it still exists on the Klarna reservation.',
191
+ $simpleQty[$item->getSku()],
192
+ $item->getSku()
193
+ );
194
  if ($item->getParentItemId()) {
195
+ $quote->removeItem($item->getParentItemId());
196
+ } else {
197
+ $quote->removeItem($item->getId());
198
  }
199
  $quote->setTotalsCollectedFlag(false);
200
  }
208
  public function validateQuote($checkoutId, $createOrderOnValidate = NULL, $createdKlarnaOrder = NULL, $logInfo = 'validate')
209
  {
210
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCOVALIDATE_ORDER);
211
+ $this->_getHelper()->logKlarnaCheckoutFunctionStart($checkoutId, Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCOVALIDATE_ORDER);
212
 
213
  /** @var Mage_Sales_Model_Quote $quote */
214
  $quote = $this->getQuote();
215
 
216
  if (!$quote->getId()) {
217
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote could not get quote', null, $checkoutId);
218
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
219
  return $this->_getHelper()->__('could not get quote');
220
  }
221
 
222
  if (!$quote->hasItems()) {
223
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote has no items', null, $checkoutId);
224
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
225
  return $this->_getHelper()->__('has no items');
226
  }
227
 
228
  $result = $this->_checkItems($quote);
229
 
230
  if ($result) {
231
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
232
  return implode("\n", $result);
233
  }
234
 
242
  if (sizeof($result)==0) {
243
  $result = array('Unknown error');
244
  }
245
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote errors: ' . implode(" ", $result), null, $checkoutId);
246
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
247
  return implode("\n", $result);
248
  }
249
 
250
  if (!$quote->validateMinimumAmount()) {
251
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote below minimum amount', null, $checkoutId);
252
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
253
  return $this->_getHelper()->__('minimum amount');
254
  }
255
 
256
  $orderId = $this->_findAlreadyCreatedOrder($quote->getId());
257
  if ($orderId>0) {
258
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote order already created ' . $orderId, null, $checkoutId);
259
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
260
  return $this->_getHelper()->__('order already created');
261
  }
262
 
263
  if ($createdKlarnaOrder) {
264
  $noticeTextArr = $this->_checkQuote($quote, $createdKlarnaOrder);
265
  if ($noticeTextArr!=NULL) {
266
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote failed in checkQuote', $noticeTextArr, $checkoutId);
267
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
268
  return $this->_getHelper()->__('not matching cart');
269
  }
270
  }
272
  if ($createOrderOnValidate && $createdKlarnaOrder) {
273
  // As validation is ok, creating the order should work, if it doesn't, it's
274
  // probably a temporary reason and we should reserve ID and await the push
275
+ $order = $this->_createOrderFromValidate($quote, $createdKlarnaOrder, $logInfo);
276
  if ($order && $order->getId()) {
277
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote created order id: ' . $order->getId(), null, $checkoutId);
278
  } else {
279
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote failed to created order', null, $checkoutId);
280
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
281
  return $this->_getHelper()->__('failed to created order');
282
  //$quote->reserveOrderId()->save(); // Must be wrong...
283
  //$this->_getHelper()->logDebugInfo($logInfo . 'Quote reserved order id: ' . $quote->getReservedOrderId());
285
  } else {
286
  $quote->collectTotals();
287
  $quote->reserveOrderId()->save();
288
+ $this->_getHelper()->logDebugInfo($logInfo . 'Quote reserved order id: ' . $quote->getReservedOrderId(), null, $checkoutId);
289
  }
290
 
291
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
292
  return true;
293
  }
294
 
295
+ /**
296
+ * @param string $checkoutId
297
+ * @param bool $createOrderOnSuccess
298
+ * @param Varien_Object $createdKlarnaOrder
299
+ *
300
+ * @return bool|string
301
+ * @deprecated Use successActionForQuote instead
302
+ */
303
  public function successQuote($checkoutId, $createOrderOnSuccess, $createdKlarnaOrder)
304
+ {
305
+ return $this->successActionForQuote($checkoutId, $createOrderOnSuccess, $createdKlarnaOrder);
306
+ }
307
+
308
+ /**
309
+ * @param string $checkoutId
310
+ * @param bool $createOrderOnSuccess
311
+ * @param Varien_Object $createdKlarnaOrder
312
+ *
313
+ * @return bool|string
314
+ */
315
+ public function successActionForQuote($checkoutId, $createOrderOnSuccess, $createdKlarnaOrder)
316
  {
317
  $res = true;
318
  /** @var Mage_Sales_Model_Quote $quote */
319
  $quote = $this->getQuote();
320
+ // Moving the close of quote to always take place instantly in successAction, even if validateQuote will
321
+ // close it when it creates the order, but it might take a little bit of time AND it might fail...
322
+ $this->_getHelper()->logDebugInfo('successAction closing quote id: ' . $quote->getId(), null, $checkoutId);
323
+ // Why not these lines?
324
+ //$quote->setIsActive(false);
325
+ //$quote->save();
326
+ /** @var Mage_Core_Model_Resource $resource */
327
+ $resource = Mage::getSingleton('core/resource');
328
+ $read = $resource->getConnection('core_read');
329
+ $read->update($resource->getTableName('sales/quote'), array('is_active' => 0), 'entity_id = ' . $quote->getId());
330
  if ($createOrderOnSuccess) {
331
  try {
332
 
338
 
339
  } else {
340
  // Why don't we set reserve order id on Quote??
 
 
 
 
 
 
 
 
 
341
  }
342
  return $res;
343
  }
431
  $quote->collectTotals();
432
 
433
  } catch(Exception $e) {
434
+ if (!$res) $res = array();
435
+ $res[] = $e->getMessage();
436
  }
437
  if ($res) {
438
+ $this->_getHelper()->logDebugInfo('_checkQuote return', $res, $createdKlarnaOrder->getId());
439
  }
440
  return $res;
441
  }
477
 
478
  protected function _createTheOrder($quote, $createdKlarnaOrder, $updatef, $pushf, $noticeTextArr = NULL)
479
  {
480
+ $this->_getHelper()->logDebugInfo('_createTheOrder quote ID: ' . $quote->getId());
481
 
482
  $this->_getHelper()->checkPaymentMethod($quote, true);
483
 
614
  Mage::throwException($this->_getHelper()->__('Order cannot be created, cart not valid') . ' ' . $quote->getId());
615
  }
616
 
617
+ $this->_getHelper()->logDebugInfo('_createTheOrder order ID: ' . $order->getId());
618
 
619
  if ($pushf) {
620
  if ($order->getState()==Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
663
  }
664
  $payment->save();
665
 
666
+ $this->_getHelper()->logDebugInfo('_createTheOrder payment ID: ' . $payment->getId());
667
+
668
+ if ($this->_orderMessages) {
669
+ foreach ($this->_orderMessages as $message) {
670
+ $order->addStatusHistoryComment($message);
671
+ }
672
+ $order->save();
673
+ }
674
 
675
  if ($pushf) {
676
  // send new order email
700
  // So I'm taking this out
701
  //Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($order->getId())) );
702
 
703
+ $this->_getHelper()->logDebugInfo('_createTheOrder order number: ' . $order->getIncrementId());
704
 
705
  } catch(Exception $e) {
706
  $this->_getHelper()->logKlarnaException($e);
710
 
711
  }
712
 
713
+ protected function _createOrderFromValidate($quote, $createdKlarnaOrder, $logInfo)
714
  {
 
 
 
 
 
 
715
  $this->_updateKlarnaOrderAddress($createdKlarnaOrder);
716
 
717
  $order = $this->_createTheOrder($quote, $createdKlarnaOrder, false, false);
726
  return $order;
727
  }
728
 
729
+ /**
730
+ * @param null|string $checkoutId
731
+ * @param bool $force
732
+ *
733
+ * @return array
734
+ * @deprecated Use createOrderFromPush instead
735
+ */
736
+ public function createOrder($checkoutId = null, $force = true)
737
+ {
738
+ return $this->createOrderFromPush($checkoutId, $force);
739
+ }
740
+
741
+ /**
742
+ * @param null|string $checkoutId
743
+ * @param bool $force
744
+ *
745
+ * @return array
746
+ */
747
+ public function createOrderFromPush($checkoutId = NULL, $force = true)
748
  {
749
  $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCOCREATE_ORDER);
750
+ $this->_getHelper()->logKlarnaCheckoutFunctionStart($checkoutId, Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCOCREATE_ORDER);
 
 
 
 
751
  $createdKlarnaOrder = $this->_api->fetchCreatedOrder($checkoutId);
752
+ $this->_getHelper()->logKlarnaDebug('createOrderFromPush', $createdKlarnaOrder->getData(), $checkoutId);
753
  if (!$createdKlarnaOrder) {
754
+ $this->_getHelper()->logDebugInfo('createOrderFromPush could not fetch createdKlarnaOrder');
755
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
756
  return array(
757
  'status' => 'retry',
758
  'message' => 'could not fetch createdKlarnaOrder'
763
  if ($quote == null) {
764
  $quote = $this->_api->loadQuote();
765
  if (!$quote) {
766
+ $this->_getHelper()->logDebugInfo('createOrderFromPush could not get quote');
767
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
768
  return array(
769
  'status' => 'fail',
770
  'message' => 'could not get quote'
772
  }
773
  $this->setQuote($quote);
774
  }
775
+ $this->_getHelper()->updateKlarnacheckoutHistory($checkoutId, null, $quote->getId(), null, $createdKlarnaOrder->getReservation());
776
+
777
+ if (!$quote->hasItems()) {
778
+ return array(
779
+ 'status' => 'retry',
780
+ 'message' => 'quote has no items'
781
+ );
782
+ }
783
 
784
  $noticeTextArr = $this->_checkQuote($quote, $createdKlarnaOrder);
785
 
786
  $this->_updateKlarnaOrderAddress($createdKlarnaOrder);
787
 
788
  $klarnaStatus = $createdKlarnaOrder->getStatus();
789
+ $this->_getHelper()->logDebugInfo('createOrderFromPush status of Klarna Order: ' . $klarnaStatus);
790
+
791
  if ($klarnaStatus != 'checkout_complete' && $klarnaStatus != 'created' && $klarnaStatus != 'AUTHORIZED') {
792
+ $this->_getHelper()->logDebugInfo('createOrderFromPush status not complete');
793
  // These statuses are only valid for Rest API, need to test for v2 API codes as well
794
  if ($klarnaStatus == 'CANCELLED' || $klarnaStatus == 'EXPIRED' || $klarnaStatus == 'CLOSED') {
795
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
796
  return array(
797
  'status' => 'fail',
798
  'message' => 'authorization not valid ' . $createdKlarnaOrder->getStatus()
799
  );
800
  } else {
801
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
802
  return array(
803
  'status' => 'retry',
804
  'message' => 'status not complete ' . $createdKlarnaOrder->getStatus()
808
 
809
  $updatef = false;
810
  $orderId = $this->_findAlreadyCreatedOrder($quote->getId());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
  if ($orderId>0) {
812
+ $this->_getHelper()->logDebugInfo('createOrderFromPush order already created, with ID ' . $orderId);
813
  $updatef = true;
814
  } else {
815
+ $this->_getHelper()->logDebugInfo('createOrderFromPush will create new order in Magento');
816
  }
817
  $order = $this->_createTheOrder($quote, $createdKlarnaOrder, $updatef, true, $noticeTextArr);
818
 
829
  $this->_getHelper()->logKlarnaException($e);
830
  }
831
 
832
+ $this->_getHelper()->logKlarnaCheckoutFunctionEnd();
833
  return array(
834
  'status' => 'success',
835
  'order' => $order
921
  $quote->collectTotals();
922
  $quote->save();
923
  $this->setQuote($quote);
924
+ $this->_getHelper()->logDebugInfo('taxshippingupdate A ' . $quote->getId());
925
 
926
  $res = $this->_api->prepareTaxAndShippingReply();
927
+ $this->_getHelper()->logDebugInfo('taxshippingupdate B ' . $res);
928
  return $res;
929
  }
930
 
953
  {
954
  return $this;
955
  }
 
956
  }
app/code/community/Vaimo/Klarna/Model/Klarnacheckout/History.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Klarnacheckout_History extends Mage_Core_Model_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->_init('klarna/klarnacheckout_history');
32
+ }
33
+
34
+ /**
35
+ * Register queue creation date
36
+ *
37
+ * @return Mage_Core_Model_Abstract|void
38
+ */
39
+ protected function _beforeSave()
40
+ {
41
+ parent::_beforeSave();
42
+
43
+ if (!$this->getCreatedAt()) {
44
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
45
+ }
46
+ }
47
+
48
+ public function loadByIdAndQuote($klarnaCheckoutId, $quoteId = null)
49
+ {
50
+ $this->_getResource()->loadByIdAndQuote($this, $klarnaCheckoutId, $quoteId);
51
+ return $this;
52
+ }
53
+
54
+ public function updateKlarnacheckoutHistory($checkoutId, $message, $quoteId, $orderId, $reservationId)
55
+ {
56
+ if ($this->getId()) {
57
+ $this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
58
+ } else {
59
+ $this->setklarnaCheckoutId($checkoutId);
60
+ }
61
+ if ($message) {
62
+ $this->setMessage($message);
63
+ }
64
+ if ($quoteId) {
65
+ $this->setQuoteId($quoteId);
66
+ }
67
+ if ($orderId) {
68
+ $this->setOrderId($orderId);
69
+ }
70
+ if ($reservationId) {
71
+ $this->setReservationId($reservationId);
72
+ }
73
+ $this->save();
74
+ }
75
+
76
+ }
app/code/community/Vaimo/Klarna/Model/Klarnacheckout/Semaphore.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Klarnacheckout_Semaphore extends Mage_Core_Model_Abstract
27
+ {
28
+ protected $_semaphoreTimeout = 90; // 1.5 minute
29
+
30
+ protected function _construct()
31
+ {
32
+ parent::_construct();
33
+ $this->_init('klarna/klarnacheckout_semaphore');
34
+ }
35
+
36
+ /**
37
+ * Register queue creation date
38
+ *
39
+ * @return Mage_Core_Model_Abstract|void
40
+ */
41
+ protected function _beforeSave()
42
+ {
43
+ parent::_beforeSave();
44
+
45
+ if (!$this->getCreatedAt()) {
46
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
47
+ $this->setTimestamp(time());
48
+ $this->setStatus('active');
49
+ }
50
+ }
51
+
52
+ public function loadActiveSemaphore($klarnaCheckoutId)
53
+ {
54
+ $this->_getResource()->loadActiveSemaphore($this, $klarnaCheckoutId);
55
+ return $this;
56
+ }
57
+
58
+ public function addSemaphore($checkoutId)
59
+ {
60
+ $res = true;
61
+ $this->loadActiveSemaphore($checkoutId);
62
+ if ($this->getId()) {
63
+ if (time() > ($this->getTimestamp() + $this->_semaphoreTimeout)) {
64
+ $message = 'Semaphore timed out, resetting it';
65
+ Mage::helper('klarna')->logKlarnaApi($message);
66
+ $this->failedSemaphore(array('message' => $message));
67
+ $this->clearInstance();
68
+ $this->unsetData();
69
+ $this->setklarnaCheckoutId($checkoutId);
70
+ } else {
71
+ $this->setRetryAttempts($this->getRetryAttempts() + 1);
72
+ $res = false;
73
+ }
74
+ } else {
75
+ $this->setklarnaCheckoutId($checkoutId);
76
+ }
77
+ try {
78
+ $this->save();
79
+ } catch (Exception $e) {
80
+ Mage::helper('klarna')->logKlarnaApi('Semaphore collision detected, need to wait to acquire it...');
81
+ $res = false;
82
+ }
83
+ return $res;
84
+ }
85
+
86
+ public function updateSemaphore($fieldArr = null)
87
+ {
88
+ if ($fieldArr) {
89
+ foreach ($fieldArr as $code => $value) {
90
+ $this->setData($code, $value);
91
+ }
92
+ try {
93
+ $this->save();
94
+ } catch (Exception $e) {
95
+ Mage::helper('klarna')->logKlarnaApi('Update of Semaphore failed: ' . $e->getMessage());
96
+ }
97
+ }
98
+ }
99
+
100
+ public function failedSemaphore($fieldArr = null)
101
+ {
102
+ $arr = array_merge($fieldArr, array('status' => 'failed ' . Mage::getSingleton('core/date')->gmtDate()));
103
+ $this->updateSemaphore($arr);
104
+ }
105
+
106
+ public function waitSemaphore($checkoutId, $seconds = 60)
107
+ {
108
+ Mage::helper('klarna')->logKlarnaApi('Semaphore locked, waiting for release (max ' . $seconds . ' seconds)...');
109
+ for ($i = 0; $i < $seconds; $i++) {
110
+ sleep(1);
111
+ if ($this->addSemaphore($checkoutId)) {
112
+ Mage::helper('klarna')->logKlarnaApi('Semaphore released after ' . $i . ' seconds, continuing...');
113
+ return true;
114
+ }
115
+ }
116
+ return $this->addSemaphore($checkoutId);
117
+ }
118
+
119
+ public function deleteSemaphore()
120
+ {
121
+ $this->delete();
122
+ }
123
+ }
app/code/community/Vaimo/Klarna/Model/{Pushqueue.php → Log.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2009-2014 Vaimo AB
4
  *
5
  * Vaimo reserves all rights in the Program as delivered. The Program
6
  * or any portion thereof may not be reproduced in any form whatsoever without
@@ -20,15 +20,15 @@
20
  *
21
  * @category Vaimo
22
  * @package Vaimo_Klarna
23
- * @copyright Copyright (c) 2009-2014 Vaimo AB
24
  */
25
 
26
- class Vaimo_Klarna_Model_Pushqueue extends Mage_Core_Model_Abstract
27
  {
28
  protected function _construct()
29
  {
30
  parent::_construct();
31
- $this->_init('klarna/pushqueue');
32
  }
33
 
34
  /**
@@ -45,10 +45,4 @@ class Vaimo_Klarna_Model_Pushqueue extends Mage_Core_Model_Abstract
45
  }
46
  }
47
 
48
- public function loadByKlarnaOrderNumber($klarnaOrderNumber)
49
- {
50
- $this->_getResource()->loadByKlarnaOrderNumber($this, $klarnaOrderNumber);
51
- return $this;
52
- }
53
-
54
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
  *
5
  * Vaimo reserves all rights in the Program as delivered. The Program
6
  * or any portion thereof may not be reproduced in any form whatsoever without
20
  *
21
  * @category Vaimo
22
  * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
  */
25
 
26
+ class Vaimo_Klarna_Model_Log extends Mage_Core_Model_Abstract
27
  {
28
  protected function _construct()
29
  {
30
  parent::_construct();
31
+ $this->_init('klarna/log');
32
  }
33
 
34
  /**
45
  }
46
  }
47
 
 
 
 
 
 
 
48
  }
app/code/community/Vaimo/Klarna/Model/Log/Data.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Log_Data extends Mage_Core_Model_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->_init('klarna/log_data');
32
+ }
33
+
34
+ /**
35
+ * Register queue creation date
36
+ *
37
+ * @return Mage_Core_Model_Abstract|void
38
+ */
39
+ protected function _beforeSave()
40
+ {
41
+ parent::_beforeSave();
42
+
43
+ if (!$this->getCreatedAt()) {
44
+ $this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
45
+ }
46
+ }
47
+ }
app/code/community/Vaimo/Klarna/Model/Observer.php CHANGED
@@ -95,6 +95,27 @@ class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
95
  }
96
  }
97
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
  }
100
 
@@ -220,6 +241,7 @@ class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
220
  $quote->collectTotals()->save();
221
  }
222
  }
 
223
  }
224
  }
225
 
@@ -247,4 +269,5 @@ class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
247
  $source = $observer->getEvent()->getSource();
248
  $quote->setKlarnaCheckoutId($source->getKlarnaCheckoutId());
249
  }
 
250
  }
95
  }
96
  }
97
  }
98
+ if ($quote->getKlarnaCheckoutId()) {
99
+ $oldQuote = Mage::getModel('sales/quote');
100
+ if ((version_compare(Mage::getVersion(), '1.7.0', '>=') && (version_compare(Mage::getVersion(), '1.10.0', '<'))) ||
101
+ (version_compare(Mage::getVersion(), '1.12.0', '>='))) {
102
+ $oldQuote->preventSaving();
103
+ }
104
+ $oldQuote = $oldQuote->load($quote->getId());
105
+ if ($oldQuote && $oldQuote->getId()) {
106
+ if (($quote->getKlarnaCheckoutId()!=$oldQuote->getKlarnaCheckoutId()) && $oldQuote->getKlarnaCheckoutId()) {
107
+ $message = 'POTENTIAL ERROR. _setKlarnaCheckoutId: Old checkout id: ' .
108
+ $oldQuote->getKlarnaCheckoutId() . ' new checkout id: ' .
109
+ $quote->getKlarnaCheckoutId();
110
+ Mage::helper('klarna')->logKlarnaDebugBT($message);
111
+ Mage::helper('klarna')->updateKlarnacheckoutHistory(
112
+ $oldQuote->getKlarnaCheckoutId(),
113
+ $message,
114
+ $quote->getId()
115
+ );
116
+ }
117
+ }
118
+ }
119
  }
120
  }
121
 
241
  $quote->collectTotals()->save();
242
  }
243
  }
244
+ Mage::helper('klarna')->logKlarnaClearFunctionName();
245
  }
246
  }
247
 
269
  $source = $observer->getEvent()->getSource();
270
  $quote->setKlarnaCheckoutId($source->getKlarnaCheckoutId());
271
  }
272
+
273
  }
app/code/community/Vaimo/Klarna/Model/Payment/Abstract.php CHANGED
@@ -88,8 +88,13 @@ class Vaimo_Klarna_Model_Payment_Abstract extends Mage_Payment_Model_Method_Abst
88
  public function canCapture()
89
  {
90
  $klarna = $this->_getKlarnaModel();
91
- $klarna->setQuote($this->getQuote(), $this->_code);
92
- if ($klarna->getConfigData('disable_backend_calls')) return false;
 
 
 
 
 
93
  return true;
94
  }
95
 
@@ -100,7 +105,20 @@ class Vaimo_Klarna_Model_Payment_Abstract extends Mage_Payment_Model_Method_Abst
100
 
101
  public function canCapturePartial()
102
  {
103
- return $this->canCapture();
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
105
 
106
  public function canRefundInvoicePartial()
@@ -139,11 +157,13 @@ class Vaimo_Klarna_Model_Payment_Abstract extends Mage_Payment_Model_Method_Abst
139
  if (isset($serviceMethod['group'])) {
140
  if (isset($serviceMethod['group']['title']) && isset($serviceMethod['title'])) {
141
  $presetTitle = $serviceMethod['group']['title'];
 
142
  if ($serviceMethod['vaimo_klarna_method']==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE ||
143
  $serviceMethod['vaimo_klarna_method']==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_SPECIAL) {
144
  $presetTitle = $serviceMethod['title'];
145
  // $presetTitle .= ' ' . $serviceMethod['title'];
146
  }
 
147
  break;
148
  }
149
  }
@@ -312,8 +332,15 @@ class Vaimo_Klarna_Model_Payment_Abstract extends Mage_Payment_Model_Method_Abst
312
  */
313
  protected function _canShowExceptionMessage(Exception $e)
314
  {
315
- return $this->_getConfigData(self::EXTENDED_ERROR_MESSAGE)
316
- && $e->getCode() && $e->getMessage() && !$this->_getHelper()->isXmlRpcException($e);
 
 
 
 
 
 
 
317
  }
318
 
319
  /**
88
  public function canCapture()
89
  {
90
  $klarna = $this->_getKlarnaModel();
91
+ $info = $this->getInfoInstance();
92
+ if ($info->getOrder()) {
93
+ $order = $info->getOrder();
94
+ $klarna->setInfoInstance($this->getInfoInstance());
95
+ $klarna->setOrder($order);
96
+ if ($klarna->getConfigData('disable_backend_calls')) return false;
97
+ }
98
  return true;
99
  }
100
 
105
 
106
  public function canCapturePartial()
107
  {
108
+ $res = $this->canCapture();
109
+ $klarna = $this->_getKlarnaModel();
110
+ $info = $this->getInfoInstance();
111
+ if ($info->getOrder()) {
112
+ $order = $info->getOrder();
113
+ $klarna->setInfoInstance($this->getInfoInstance());
114
+ $klarna->setOrder($order);
115
+ if (!$klarna->getConfigData('allow_part_capture_with_discount')) {
116
+ if ($klarna->orderHasDiscount()) {
117
+ $res = false;
118
+ }
119
+ }
120
+ }
121
+ return $res;
122
  }
123
 
124
  public function canRefundInvoicePartial()
157
  if (isset($serviceMethod['group'])) {
158
  if (isset($serviceMethod['group']['title']) && isset($serviceMethod['title'])) {
159
  $presetTitle = $serviceMethod['group']['title'];
160
+ /*
161
  if ($serviceMethod['vaimo_klarna_method']==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE ||
162
  $serviceMethod['vaimo_klarna_method']==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_SPECIAL) {
163
  $presetTitle = $serviceMethod['title'];
164
  // $presetTitle .= ' ' . $serviceMethod['title'];
165
  }
166
+ */
167
  break;
168
  }
169
  }
332
  */
333
  protected function _canShowExceptionMessage(Exception $e)
334
  {
335
+ if ($this->_getHelper()->isXmlRpcException($e)) {
336
+ return false;
337
+ }
338
+ if (!$this->_getConfigData(self::EXTENDED_ERROR_MESSAGE)) {
339
+ if ($e->getCode() && $e->getMessage()) {
340
+ return false;
341
+ }
342
+ }
343
+ return true;
344
  }
345
 
346
  /**
app/code/community/Vaimo/Klarna/Model/Resource/Klarnacheckout/History.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Resource_Klarnacheckout_History extends Mage_Core_Model_Resource_Db_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ $this->_init('klarna/klarnacheckout_history', 'id');
31
+ }
32
+
33
+ public function loadByIdAndQuote(Vaimo_Klarna_Model_Klarnacheckout_History $history,
34
+ $klarnaCheckoutId, $quoteId)
35
+ {
36
+ $adapter = $this->_getReadAdapter();
37
+ $historyTable = $this->getTable('klarna/klarnacheckout_history');
38
+ $bind = array('klarna_checkout_id' => $klarnaCheckoutId);
39
+ $select = $adapter->select()
40
+ ->from($historyTable)
41
+ ->where('klarna_checkout_id = :klarna_checkout_id');
42
+ if ($quoteId) {
43
+ $bind['quote_id'] = $quoteId;
44
+ $select->where('quote_id = :quote_id');
45
+ }
46
+ $historyId = $adapter->fetchOne($select, $bind);
47
+ if ($historyId) {
48
+ $this->load($history, $historyId);
49
+ } else {
50
+ $history->setData(array());
51
+ }
52
+
53
+ return $this;
54
+ }
55
+ }
app/code/community/Vaimo/Klarna/Model/Resource/Klarnacheckout/History/Collection.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Resource_Klarnacheckout_History_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->_init('klarna/klarnacheckout_history');
32
+ }
33
+ }
app/code/community/Vaimo/Klarna/Model/Resource/Klarnacheckout/Semaphore.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Resource_Klarnacheckout_Semaphore extends Mage_Core_Model_Resource_Db_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ $this->_init('klarna/klarnacheckout_semaphore', 'id');
31
+ }
32
+
33
+ public function loadActiveSemaphore(Vaimo_Klarna_Model_Klarnacheckout_Semaphore $semaphore, $klarnaCheckoutId)
34
+ {
35
+ $adapter = $this->_getReadAdapter();
36
+ $semaphoreTable = $this->getTable('klarna/klarnacheckout_semaphore');
37
+ $bind = array('klarna_checkout_id' => $klarnaCheckoutId,
38
+ 'status' => 'active'
39
+ );
40
+ $select = $adapter->select()
41
+ ->from($semaphoreTable)
42
+ ->where('status = :status')
43
+ ->where('klarna_checkout_id = :klarna_checkout_id');
44
+
45
+ $semaphoreId = $adapter->fetchOne($select, $bind);
46
+ if ($semaphoreId) {
47
+ $this->load($semaphore, $semaphoreId);
48
+ } else {
49
+ $semaphore->setData(array());
50
+ }
51
+
52
+ return $this;
53
+ }
54
+ }
app/code/community/Vaimo/Klarna/Model/Resource/{Pushqueue → Klarnacheckout/Semaphore}/Collection.php RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Copyright (c) 2009-2014 Vaimo AB
4
  *
5
  * Vaimo reserves all rights in the Program as delivered. The Program
6
  * or any portion thereof may not be reproduced in any form whatsoever without
@@ -20,26 +20,25 @@
20
  *
21
  * @category Vaimo
22
  * @package Vaimo_Klarna
23
- * @copyright Copyright (c) 2009-2014 Vaimo AB
24
  */
25
 
26
- class Vaimo_Klarna_Model_Resource_Pushqueue_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
27
  {
28
  protected function _construct()
29
  {
30
  parent::_construct();
31
- $this->_init('klarna/pushqueue');
32
  }
33
 
34
  /**
35
  * Apply retry filter
36
  *
37
- * @return Vaimo_Klarna_Model_Resource_Pushqueue_Collection
38
  */
39
  public function applyRetryFilter($maxCnt)
40
  {
41
  $this->getSelect()->where('retry_attempts < ?', $maxCnt);
42
  return $this;
43
  }
44
-
45
  }
1
  <?php
2
  /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
  *
5
  * Vaimo reserves all rights in the Program as delivered. The Program
6
  * or any portion thereof may not be reproduced in any form whatsoever without
20
  *
21
  * @category Vaimo
22
  * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
  */
25
 
26
+ class Vaimo_Klarna_Model_Resource_Klarnacheckout_Semaphore_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
27
  {
28
  protected function _construct()
29
  {
30
  parent::_construct();
31
+ $this->_init('klarna/klarnacheckout_semaphore');
32
  }
33
 
34
  /**
35
  * Apply retry filter
36
  *
37
+ * @return Vaimo_Klarna_Model_Resource_Klarnacheckout_Semaphore_Collection
38
  */
39
  public function applyRetryFilter($maxCnt)
40
  {
41
  $this->getSelect()->where('retry_attempts < ?', $maxCnt);
42
  return $this;
43
  }
 
44
  }
app/code/community/Vaimo/Klarna/Model/Resource/Log.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Resource_Log extends Mage_Core_Model_Resource_Db_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ $this->_init('klarna/log', 'entity_id');
31
+ }
32
+
33
+ public function purgeLog($date = null)
34
+ {
35
+ if (is_null($date))
36
+ $date = date('c');
37
+ else if (is_integer($date))
38
+ $date = date('c', time() + $date*24*60*60);
39
+ $this->_getWriteAdapter()->delete(
40
+ $this->getTable('klarna/log'),
41
+ array(
42
+ 'created_at < ?' => $date
43
+ )
44
+ );
45
+ }
46
+ }
app/code/community/Vaimo/Klarna/Model/Resource/Log/Collection.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Resource_Log_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->_init('klarna/log');
32
+ }
33
+ }
app/code/community/Vaimo/Klarna/Model/Resource/Log/Data.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Resource_Log_Data extends Mage_Core_Model_Resource_Db_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ $this->_init('klarna/log_data', 'entity_id');
31
+ }
32
+
33
+ public function purgeLog($date = null)
34
+ {
35
+ if (is_null($date)) {
36
+ $date = date('c');
37
+ } else if (is_integer($date)) {
38
+ $date = date('c', time() + $date*24*60*60);
39
+ }
40
+ $this->_getWriteAdapter()->delete(
41
+ $this->getTable('klarna/log_data'),
42
+ array(
43
+ 'created_at < ?' => $date
44
+ )
45
+ );
46
+ }
47
+ }
app/code/community/Vaimo/Klarna/Model/Resource/Log/Data/Collection.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Model_Resource_Log_Data_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
27
+ {
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->_init('klarna/log_data');
32
+ }
33
+ }
app/code/community/Vaimo/Klarna/Model/{Resource/Pushqueue.php → Source/Loglevel.php} RENAMED
@@ -23,30 +23,17 @@
23
  * @copyright Copyright (c) 2009-2014 Vaimo AB
24
  */
25
 
26
- class Vaimo_Klarna_Model_Resource_Pushqueue extends Mage_Core_Model_Resource_Db_Abstract
27
  {
28
- protected function _construct()
29
- {
30
- $this->_init('klarna/pushqueue', 'id');
31
- }
32
 
33
- public function loadByKlarnaOrderNumber(Vaimo_Klarna_Model_Pushqueue $pushqueue, $klarnaOrderNumber)
34
  {
35
- $adapter = $this->_getReadAdapter();
36
- $pushqueueTable = $this->getTable('klarna/pushqueue');
37
- $bind = array('klarna_order_number' => $klarnaOrderNumber);
38
- $select = $adapter->select()
39
- ->from($pushqueueTable)
40
- ->where('klarna_order_number = :klarna_order_number');
41
-
42
- $pushQueueId = $adapter->fetchOne($select, $bind);
43
- if ($pushQueueId) {
44
- $this->load($pushqueue, $pushQueueId);
45
- } else {
46
- $pushqueue->setData(array());
47
- }
48
-
49
- return $this;
50
  }
51
 
52
- }
23
  * @copyright Copyright (c) 2009-2014 Vaimo AB
24
  */
25
 
26
+ class Vaimo_Klarna_Model_Source_Loglevel extends Vaimo_Klarna_Model_Source_Abstract
27
  {
 
 
 
 
28
 
29
+ public function toOptionArray()
30
  {
31
+ return array(
32
+ array('value' => Vaimo_Klarna_Helper_Data::KLARNA_LOG_LEVEL_FULL, 'label' => $this->_getCoreHelper()->__('Full')),
33
+ array('value' => Vaimo_Klarna_Helper_Data::KLARNA_LOG_LEVEL_MODERATE, 'label' => $this->_getCoreHelper()->__('Moderate')),
34
+ array('value' => Vaimo_Klarna_Helper_Data::KLARNA_LOG_LEVEL_MINMIAL, 'label' => $this->_getCoreHelper()->__('Minimal')),
35
+ array('value' => Vaimo_Klarna_Helper_Data::KLARNA_LOG_LEVEL_NONE, 'label' => $this->_getCoreHelper()->__('None')),
36
+ );
 
 
 
 
 
 
 
 
 
37
  }
38
 
39
+ }
app/code/community/Vaimo/Klarna/Model/Transport/Abstract.php CHANGED
@@ -692,6 +692,46 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
692
  }
693
  }
694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  public function getAvailableMethods()
696
  {
697
  $res = array();
@@ -788,7 +828,93 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
788
  }
789
  return $res;
790
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
791
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
792
  /**
793
  * Returns this class country code
794
  *
@@ -961,6 +1087,19 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
961
  return $res;
962
  }
963
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  /**
965
  * A function that returns a few setup values unique to the current active session
966
  * If currently selected method is not setup it will default to Invoice method and try again
692
  }
693
  }
694
 
695
+ /**
696
+ * Germany has special hardcoded usecase... which includes links etc
697
+ *
698
+ * @param $useCaseText
699
+ * @return mixed
700
+ */
701
+ public function formatUseCase($useCaseText)
702
+ {
703
+ switch ($this->_getCountryCode()) {
704
+ case 'DE':
705
+ $fee = Mage::getStoreConfig('payment/vaimo_klarna_invoice/invoice_fee', $this->_getStoreId());
706
+ $merchantId = $this->getKlarnaSetup()->getMerchantId();
707
+ $linkWeiter = '<a href="https://cdn.klarna.com/1.0/shared/content/legal/terms/' . $merchantId .'/de_de/account" target="_blank">'
708
+ . $this->_getHelper()->__('weitere Informationen')
709
+ . '</a>';
710
+ $linkAGB = '<a href="https://cdn.klarna.com/1.0/shared/content/legal/de_de/account/terms.pdf" target="_blank">'
711
+ . $this->_getHelper()->__('AGB mit Widerrufsbelehrung')
712
+ . '</a>';
713
+ $linkStandard = '<a href="https://cdn.klarna.com/1.0/shared/content/legal/de_de/consumer_credit.pdf" target="_blank">'
714
+ . $this->_getHelper()->__('Standardinformationen für Verbraucherkredite')
715
+ . '</a>';
716
+ $linkRechnung = '<a href="https://cdn.klarna.com/1.0/shared/content/legal/terms/' . $merchantId .'/de_de/invoice?fee=' . $fee . '" target="_blank">'
717
+ . $this->_getHelper()->__('Rechnungskauf')
718
+ . '</a>';
719
+
720
+ $partOne = $this->_getHelper()->__('German specific hardcoded usecase with links (part one)');
721
+ $partTwo = $this->_getHelper()->__('German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s',
722
+ $linkWeiter,
723
+ $linkAGB,
724
+ $linkStandard
725
+ );
726
+ $partThree = $this->_getHelper()->__('German specific hardcoded usecase with links (part three), Rechnungskauf link %s',
727
+ $linkRechnung
728
+ );
729
+ return $partOne . ' ' . $partTwo . '<br/><br/>' . $partThree;
730
+ default:
731
+ return $useCaseText;
732
+ }
733
+ }
734
+
735
  public function getAvailableMethods()
736
  {
737
  $res = array();
828
  }
829
  return $res;
830
  }
831
+
832
+ /**
833
+ * Checks if one field is the same in both addresses
834
+ *
835
+ * @param $shipping
836
+ * @param $billing
837
+ * @param $fieldname
838
+ * @return bool
839
+ */
840
+ protected function _AddressFieldIsDifferent($shipping, $billing, $fieldname)
841
+ {
842
+ if ($shipping->getData($fieldname) && $billing->getData($fieldname)) {
843
+ if ($shipping->getData($fieldname) != $billing->getData($fieldname)) {
844
+ return true;
845
+ }
846
+ }
847
+ return false;
848
+ }
849
+ /**
850
+ * Check that shipping and billing have the same first and lastname, and the same country
851
+ * According to Klarna, this is a requirement for all countries.
852
+ *
853
+ * This function does not apply for Sweden, since it does address search.
854
+ *
855
+ * @return bool
856
+ */
857
+ public function validShippingAndBillingAddress()
858
+ {
859
+ if (!$this->useGetAddresses()) {
860
+ // if (!$this->shippingSameAsBilling()) {
861
+ if ($this->getQuote()) {
862
+ $billing = $this->getQuote()->getBillingAddress();
863
+ $shipping = $this->getQuote()->isVirtual() ? null : $this->getQuote()->getShippingAddress();
864
+ if ($shipping && $billing) {
865
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'firstname')) {
866
+ return false;
867
+ }
868
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'lastname')) {
869
+ return false;
870
+ }
871
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'country_id')) {
872
+ return false;
873
+ }
874
+ }
875
+ }
876
+ // }
877
+ }
878
+ return true;
879
+ }
880
 
881
+ /**
882
+ * Check if shipping and billing are the same
883
+ *
884
+ * @return bool
885
+ */
886
+ public function addressesAreTheSame()
887
+ {
888
+ if ($this->getQuote()) {
889
+ $billing = $this->getQuote()->getBillingAddress();
890
+ $shipping = $this->getQuote()->isVirtual() ? null : $this->getQuote()->getShippingAddress();
891
+ if ($shipping && $billing) {
892
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'firstname')) {
893
+ return false;
894
+ }
895
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'lastname')) {
896
+ return false;
897
+ }
898
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'country_id')) {
899
+ return false;
900
+ }
901
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'street')) {
902
+ return false;
903
+ }
904
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'city')) {
905
+ return false;
906
+ }
907
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'region_id')) {
908
+ return false;
909
+ }
910
+ if ($this->_AddressFieldIsDifferent($shipping, $billing, 'telephone')) {
911
+ return false;
912
+ }
913
+ }
914
+ }
915
+ return true;
916
+ }
917
+
918
  /**
919
  * Returns this class country code
920
  *
1087
  return $res;
1088
  }
1089
 
1090
+ public function orderHasDiscount()
1091
+ {
1092
+ $res = false;
1093
+ $discount_amount = 0;
1094
+ foreach ($this->getOrder()->getItemsCollection() as $item) {
1095
+ $discount_amount += $item->getDiscountAmount();
1096
+ }
1097
+ if ($discount_amount) {
1098
+ $res = true;
1099
+ }
1100
+ return $res;
1101
+ }
1102
+
1103
  /**
1104
  * A function that returns a few setup values unique to the current active session
1105
  * If currently selected method is not setup it will default to Invoice method and try again
app/code/community/Vaimo/Klarna/controllers/Checkout/KlarnaController.php CHANGED
@@ -25,6 +25,10 @@
25
 
26
  class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_Action
27
  {
 
 
 
 
28
  /**
29
  * @return Mage_Checkout_Model_Session
30
  */
@@ -63,6 +67,19 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
63
  return $this->_getCart()->getQuote();
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * This function checks valid shippingMethod
68
  *
@@ -142,6 +159,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
142
 
143
  public function indexAction()
144
  {
 
145
  if (!$this->_getCart()->hasQuote()) {
146
  // If recreate_cart_on_failed_validate is set to no, this parameter is not included
147
  $id = $this->getRequest()->getParam('quote_id');
@@ -300,7 +318,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
300
 
301
  public function taxshippingupdateAction()
302
  {
303
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
304
  $checkoutId = $this->getRequest()->getParam('klarna_order');
305
  Mage::helper('klarna')->logKlarnaApi('taxshippingupdate callback received for ID ' . $checkoutId);
306
 
@@ -313,22 +331,22 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
313
 
314
  $post_body = file_get_contents('php://input');
315
  $data = json_decode($post_body, true);
316
- Mage::helper('klarna')->logDebugInfo('taxshippingupdate data', $data);
317
 
318
  $result = $klarna->updateTaxAndShipping($quote, $data);
319
  } else {
320
  $result = '';
321
  }
322
 
323
- Mage::helper('klarna')->logDebugInfo('taxshippingupdate response', $result);
324
  $this->getResponse()->setBody(Zend_Json::encode($result));
325
 
326
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
327
  }
328
 
329
  public function validateFailedAction()
330
  {
331
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
332
 
333
  $checkoutId = $this->getRequest()->getParam('klarna_order');
334
  //$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
@@ -347,7 +365,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
347
  $this->_getSession()->addError($error);
348
  }
349
 
350
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
351
 
352
  $this->_redirectToCart($quote->getStoreId());
353
  return;
@@ -365,40 +383,43 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
365
  return $quote;
366
  }
367
 
368
- protected function _initPushQueue($checkoutId)
369
- {
370
- $pushQueue = Mage::getModel('klarna/pushqueue');
371
- $pushQueue->loadByKlarnaOrderNumber($checkoutId);
372
- if ($pushQueue->getId()) {
373
- $pushQueue->setRetryAttempts(0);
374
- } else {
375
- $pushQueue->setKlarnaOrderNumber($checkoutId);
376
- }
377
- $pushQueue->save();
378
- return $pushQueue;
379
- }
380
-
381
  public function validateAction()
382
  {
383
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
 
 
384
 
385
  $checkoutId = $this->getRequest()->getParam('klarna_order');
 
 
 
 
 
 
 
 
386
  $quote = $this->_initPushOrValidate($checkoutId);
387
 
388
- Mage::helper('klarna')->logKlarnaApi('validateAction checkout id: ' . $checkoutId);
389
  if (!$quote) {
390
- Mage::helper('klarna')->logKlarnaApi('validateAction checkout quote not found!');
391
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
 
 
 
 
392
  return;
393
  }
394
 
 
 
395
  /** @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
396
  $klarna = Mage::getModel('klarna/klarnacheckout');
397
  $klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
398
 
399
  $post_body = file_get_contents('php://input');
400
  $klarnaOrderData = json_decode($post_body, true);
401
- Mage::helper('klarna')->logDebugInfo('validateAction klarnaOrderData', $klarnaOrderData);
402
  $createdKlarnaOrder = new Varien_Object($klarnaOrderData);
403
 
404
  if (substr($checkoutId, -1, 1) == '/') {
@@ -412,9 +433,10 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
412
  // validateQuote returns true if successful, a string if failed
413
  $result = $klarna->validateQuote($checkoutId, $createOrderOnValidate, $createdKlarnaOrder);
414
 
415
- Mage::helper('klarna')->logKlarnaApi('validateAction result = ' . $result);
416
 
417
  if ($result !== true) {
 
418
  $payment = $quote->getPayment();
419
 
420
  if ($payment->getId()) {
@@ -422,14 +444,17 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
422
  $payment->save();
423
  }
424
 
 
425
  $this->getResponse()
426
  ->setHttpResponseCode(303)
427
  ->setHeader('Location', Mage::getUrl('checkout/klarna/validateFailed', array('klarna_order' => $checkoutId)));
428
  return;
429
  }
 
430
  $this->getResponse()
431
  ->setHttpResponseCode(200);
432
  } catch (Exception $e) {
 
433
  if ($quote && $quote->getId()) {
434
  $payment = $quote->getPayment();
435
  if ($payment && $payment->getId()) {
@@ -437,34 +462,46 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
437
  $payment->save();
438
  }
439
  }
440
- Mage::helper('klarna')->logKlarnaException($e);
441
  $this->getResponse()
442
  ->setHttpResponseCode(303)
443
  ->setHeader('Location', Mage::getUrl('checkout/klarna/validateFailed', array('klarna_order' => $checkoutId)));
444
  }
445
  }
446
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
447
  }
448
 
449
  public function pushAction()
450
  {
451
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
 
452
 
453
  $checkoutId = $this->getRequest()->getParam('klarna_order');
 
 
 
454
  if (!$checkoutId) {
455
- Mage::helper('klarna')->logKlarnaApi('pushAction klarna_order missing!');
456
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
457
  return;
458
  }
 
 
 
 
 
 
 
459
  $quote = $this->_initPushOrValidate($checkoutId);
460
- $pushQueue = $this->_initPushQueue($checkoutId);
461
 
462
- Mage::helper('klarna')->logKlarnaApi('pushAction checkout id: ' . $checkoutId);
463
  if (!$quote) {
464
- Mage::helper('klarna')->logKlarnaApi('pushAction checkout quote not found!');
465
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
 
466
  return;
467
  }
 
468
 
469
  /** @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
470
  $klarna = Mage::getModel('klarna/klarnacheckout');
@@ -476,41 +513,43 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
476
 
477
  if ($checkoutId) {
478
  try {
479
- // createOrder returns the order if successful, otherwise an error string
480
- $result = $klarna->createOrder($checkoutId, false);
481
 
482
  if (is_array($result)) {
483
  if ($result['status']=='success') {
484
- $pushQueue->delete();
485
- Mage::helper('klarna')->logKlarnaApi('pushAction order created successfully, order id: ' . $result['order']->getId());
 
486
  } elseif ($result['status']=='fail') {
487
- $pushQueue->delete();
488
- Mage::helper('klarna')->logKlarnaApi($result['message']);
489
  } else {
490
- $pushQueue->setMessage($result['message']);
491
- $pushQueue->save();
492
- Mage::helper('klarna')->logKlarnaApi($result['message']);
493
  }
494
  } else {
495
- $pushQueue->setMessage('Unkown error from createOrder');
496
- $pushQueue->save();
497
- Mage::helper('klarna')->logKlarnaApi('Unkown error from createOrder');
498
  }
499
  } catch (Exception $e) {
500
- $pushQueue->setMessage($e->getMessage());
501
- $pushQueue->save();
502
- Mage::helper('klarna')->logKlarnaException($e);
503
  }
504
  }
505
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
506
  }
507
 
508
  public function successAction()
509
  {
 
 
510
  try {
511
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
512
- $revisitedf = false;
513
  $checkoutId = $this->_getSession()->getKlarnaCheckoutId();
 
 
 
 
514
  if (!$checkoutId) {
515
  $checkoutId = $this->_getSession()->getKlarnaCheckoutPrevId();
516
  if ($checkoutId) {
@@ -518,25 +557,43 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
518
  }
519
  }
520
  if (!$checkoutId) {
521
- Mage::helper('klarna')->logKlarnaApi('successAction checkout id is empty, so we do nothing');
 
522
  exit(1);
523
  }
 
 
 
 
 
 
524
  if (!$revisitedf) {
525
- Mage::helper('klarna')->logKlarnaApi('successAction checkout id: ' . $checkoutId);
526
  } else {
527
- Mage::helper('klarna')->logKlarnaApi('successAction revisited, checkout id: ' . $checkoutId);
528
  }
529
  //$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
530
- $quote = Mage::helper('klarna')->findQuote($checkoutId);
531
  if (!$quote || !$quote->getId()) {
532
- Mage::throwException($this->__('Cart not available. Please try again') . ': ' . $checkoutId . ' revisitedf = ' . $revisitedf);
 
 
 
 
 
 
 
533
  }
534
  $klarna = Mage::getModel('klarna/klarnacheckout');
535
  $klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
536
 
537
  } catch (Exception $e) {
538
  // Will show empty success page... however unlikely it is to get here, it's not very good
539
- Mage::helper('klarna')->logKlarnaException($e);
 
 
 
 
540
  return $this;
541
  }
542
 
@@ -549,55 +606,62 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
549
  try {
550
  $status = $klarna->getCheckoutStatus($checkoutId, $useCurrentOrderSession);
551
  $canDisplaySuccess =
552
- $status == 'checkout_complete' ||
553
  $status == 'created' ||
554
  $status == 'AUTHORIZED';
555
  if (!$canDisplaySuccess) {
556
- Mage::helper('klarna')->logDebugInfo(
557
- 'successAction got incorrect status: ' . $status . ' ' .
558
- 'for klarna order id: ' . $checkoutId . '. ' .
559
- 'Retrying (' . ($cnt + 1) . ' / 5)'
560
- );
561
  $useCurrentOrderSession = false; // Reinitiate communication
562
  } else {
563
  break;
564
  }
565
  } catch (Exception $e) {
566
- Mage::helper('klarna')->logKlarnaException($e);
567
- Mage::helper('klarna')->logDebugInfo(
568
- 'successAction caused an exception: ' . $e->getMessage() .
569
- 'Retrying (' . ($cnt + 1) . ' / 5)'
570
- );
571
  $useCurrentOrderSession = false; // Reinitiate communication
572
  }
573
  }
574
 
575
  try {
576
  if (!$canDisplaySuccess) {
577
- Mage::helper('klarna')->logKlarnaApi('successAction ERROR: order not created: ' . $status);
578
  $error = $this->__('Checkout incomplete, please try again.');
579
  $this->_getSession()->addError($error);
 
 
 
580
  $this->_redirectToCart($quote->getStoreId());
 
581
  return $this;
582
  } else {
583
- Mage::helper('klarna')->logKlarnaApi('successAction displaying success');
584
  }
585
 
586
  $createOrderOnSuccess = $klarna->getConfigData('create_order_on_success');
 
 
 
587
 
588
  if (!$revisitedf) {
589
 
590
  if ($quote->getId() && $quote->getIsActive()) {
591
 
592
- // successQuote returns true if successful, a string if failed
593
  $createdKlarnaOrder = new Varien_Object($klarna->getActualKlarnaOrderArray());
594
- $result = $klarna->successQuote($checkoutId, $createOrderOnSuccess, $createdKlarnaOrder);
595
- Mage::helper('klarna')->logKlarnaApi('successQuote result = ' . $result);
 
596
 
597
  $order = Mage::getModel('sales/order')->load($quote->getId(), 'quote_id');
598
 
599
  if ($order && $order->getId()) {
600
- Mage::helper('klarna')->logDebugInfo('successQuote successfully created order with no: ' . $order->getIncrementId());
601
  }
602
 
603
  }
@@ -611,6 +675,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
611
  if ($order && $order->getId()) {
612
  $this->_getSession()->setLastOrderId($order->getId());
613
  $this->_getSession()->setLastRealOrderId($order->getIncrementId());
 
614
  }
615
  $this->_getSession()->setKlarnaCheckoutPrevId($checkoutId);
616
  $this->_getSession()->setKlarnaCheckoutId(''); // This needs to be cleared, to be able to create new orders
@@ -630,13 +695,25 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
630
  $block->setKlarnaCheckoutOrder($klarna->getActualKlarnaOrder());
631
  }
632
 
 
 
 
 
633
  $this->renderLayout();
634
 
635
- Mage::helper('klarna')->logKlarnaApi('successAction displayed success');
636
- Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
 
 
 
 
637
  } catch (Exception $e) {
638
  // Will show empty success page... however unlikely it is to get here, it's not very good
639
- Mage::helper('klarna')->logKlarnaException($e);
 
 
 
 
640
  return $this;
641
  }
642
  }
@@ -776,6 +853,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
776
 
777
  public function getKlarnaCheckoutAction()
778
  {
 
779
  $this->loadLayout('checkout_klarna_index');
780
 
781
  $block = $this->getLayout()->getBlock('checkout');
@@ -840,7 +918,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
840
 
841
  // Addon for ajax to redirect to cart
842
  if ($this->_getCart()->getSummaryQty() <= 0) {
843
- $result['redirect_url'] = Mage::getBaseUrl() . Mage::helper('klarna')->getKCORedirectToCartUrl($this->getQuote()->getStoreId());
844
  }
845
  }
846
  $this->_getSession()->setCartWasUpdated(true);
25
 
26
  class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_Action
27
  {
28
+
29
+ /* @var Vaimo_Klarna_Model_Klarnacheckout_Semaphore $_semaphore */
30
+ protected $_semaphore = null;
31
+
32
  /**
33
  * @return Mage_Checkout_Model_Session
34
  */
67
  return $this->_getCart()->getQuote();
68
  }
69
 
70
+ /**
71
+ * Get current active semaphore instance
72
+ *
73
+ * @return Vaimo_Klarna_Model_Klarnacheckout_Semaphore
74
+ */
75
+ protected function _getSemaphore()
76
+ {
77
+ if (!$this->_semaphore) {
78
+ $this->_semaphore = Mage::getModel('klarna/klarnacheckout_semaphore');
79
+ }
80
+ return $this->_semaphore;
81
+ }
82
+
83
  /**
84
  * This function checks valid shippingMethod
85
  *
159
 
160
  public function indexAction()
161
  {
162
+ Mage::helper('klarna')->setFunctionNameForLog('klarnacheckout');
163
  if (!$this->_getCart()->hasQuote()) {
164
  // If recreate_cart_on_failed_validate is set to no, this parameter is not included
165
  $id = $this->getRequest()->getParam('quote_id');
318
 
319
  public function taxshippingupdateAction()
320
  {
321
+ Mage::helper('klarna')->logKlarnaActionStart('klarnacheckout', 'taxshippingupdate');
322
  $checkoutId = $this->getRequest()->getParam('klarna_order');
323
  Mage::helper('klarna')->logKlarnaApi('taxshippingupdate callback received for ID ' . $checkoutId);
324
 
331
 
332
  $post_body = file_get_contents('php://input');
333
  $data = json_decode($post_body, true);
334
+ Mage::helper('klarna')->logDebugInfo('taxshippingupdate data', $data, $checkoutId);
335
 
336
  $result = $klarna->updateTaxAndShipping($quote, $data);
337
  } else {
338
  $result = '';
339
  }
340
 
341
+ Mage::helper('klarna')->logDebugInfo('taxshippingupdate response', $result, $checkoutId);
342
  $this->getResponse()->setBody(Zend_Json::encode($result));
343
 
344
+ Mage::helper('klarna')->logKlarnaActionEnd();
345
  }
346
 
347
  public function validateFailedAction()
348
  {
349
+ Mage::helper('klarna')->logKlarnaActionStart('klarnacheckout', 'validateFailed');
350
 
351
  $checkoutId = $this->getRequest()->getParam('klarna_order');
352
  //$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
365
  $this->_getSession()->addError($error);
366
  }
367
 
368
+ Mage::helper('klarna')->logKlarnaActionEnd();
369
 
370
  $this->_redirectToCart($quote->getStoreId());
371
  return;
383
  return $quote;
384
  }
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  public function validateAction()
387
  {
388
+ /* @var Vaimo_Klarna_Helper_Data $helper */
389
+ $helper = Mage::helper('klarna');
390
+ $helper->logKlarnaActionStart('klarnacheckout', 'validate');
391
 
392
  $checkoutId = $this->getRequest()->getParam('klarna_order');
393
+ if (!$this->_getSemaphore()->addSemaphore($checkoutId)) {
394
+ $helper->logKlarnaApi('Semaphore not acquired, exiting');
395
+ $helper->logKlarnaActionEnd();
396
+ $this->getResponse()
397
+ ->setHttpResponseCode(303)
398
+ ->setHeader('Location', Mage::getUrl('checkout/klarna/validateFailed', array('klarna_order' => $checkoutId)));
399
+ return;
400
+ }
401
  $quote = $this->_initPushOrValidate($checkoutId);
402
 
403
+ $helper->logKlarnaApi('Checkout id: ' . $checkoutId);
404
  if (!$quote) {
405
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'validate failed ' . 'quote not found'));
406
+ $helper->logKlarnaApi('checkout quote not found!');
407
+ $helper->logKlarnaActionEnd();
408
+ $this->getResponse()
409
+ ->setHttpResponseCode(303)
410
+ ->setHeader('Location', Mage::getUrl('checkout/klarna/validateFailed', array('klarna_order' => $checkoutId)));
411
  return;
412
  }
413
 
414
+ $this->_getSemaphore()->updateSemaphore(array('quote_id' => $quote->getId()));
415
+
416
  /** @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
417
  $klarna = Mage::getModel('klarna/klarnacheckout');
418
  $klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
419
 
420
  $post_body = file_get_contents('php://input');
421
  $klarnaOrderData = json_decode($post_body, true);
422
+ $helper->logDebugInfo('klarnaOrderData', $klarnaOrderData, $checkoutId);
423
  $createdKlarnaOrder = new Varien_Object($klarnaOrderData);
424
 
425
  if (substr($checkoutId, -1, 1) == '/') {
433
  // validateQuote returns true if successful, a string if failed
434
  $result = $klarna->validateQuote($checkoutId, $createOrderOnValidate, $createdKlarnaOrder);
435
 
436
+ $helper->logKlarnaApi('validateQuote result = ' . $result);
437
 
438
  if ($result !== true) {
439
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'validate failed ' . $result));
440
  $payment = $quote->getPayment();
441
 
442
  if ($payment->getId()) {
444
  $payment->save();
445
  }
446
 
447
+ $helper->logKlarnaActionEnd();
448
  $this->getResponse()
449
  ->setHttpResponseCode(303)
450
  ->setHeader('Location', Mage::getUrl('checkout/klarna/validateFailed', array('klarna_order' => $checkoutId)));
451
  return;
452
  }
453
+ $this->_getSemaphore()->deleteSemaphore();
454
  $this->getResponse()
455
  ->setHttpResponseCode(200);
456
  } catch (Exception $e) {
457
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'validate failed ' . $e->getMessage()));
458
  if ($quote && $quote->getId()) {
459
  $payment = $quote->getPayment();
460
  if ($payment && $payment->getId()) {
462
  $payment->save();
463
  }
464
  }
465
+ $helper->logKlarnaException($e);
466
  $this->getResponse()
467
  ->setHttpResponseCode(303)
468
  ->setHeader('Location', Mage::getUrl('checkout/klarna/validateFailed', array('klarna_order' => $checkoutId)));
469
  }
470
  }
471
+ $helper->logKlarnaActionEnd();
472
  }
473
 
474
  public function pushAction()
475
  {
476
+ /* @var Vaimo_Klarna_Helper_Data $helper */
477
+ $helper = Mage::helper('klarna');
478
 
479
  $checkoutId = $this->getRequest()->getParam('klarna_order');
480
+ $helper->setCheckoutId($checkoutId);
481
+ $helper->logKlarnaActionStart('klarnacheckout', 'push');
482
+
483
  if (!$checkoutId) {
484
+ $helper->logKlarnaApi('klarna_order missing!');
485
+ $helper->logKlarnaActionEnd();
486
  return;
487
  }
488
+ if (!$this->_getSemaphore()->addSemaphore($checkoutId)) {
489
+ if (!$this->_getSemaphore()->waitSemaphore($checkoutId)) {
490
+ $helper->logKlarnaApi('Semaphore not acquired, exiting');
491
+ $helper->logKlarnaActionEnd();
492
+ return;
493
+ }
494
+ }
495
  $quote = $this->_initPushOrValidate($checkoutId);
 
496
 
497
+ $helper->logKlarnaApi('Checkout id: ' . $checkoutId);
498
  if (!$quote) {
499
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'push failed, quote not found'));
500
+ $helper->logKlarnaApi('checkout quote not found!');
501
+ $helper->logKlarnaActionEnd();
502
  return;
503
  }
504
+ $this->_getSemaphore()->updateSemaphore(array('quote_id' => $quote->getId()));
505
 
506
  /** @var Vaimo_Klarna_Model_Klarnacheckout $klarna */
507
  $klarna = Mage::getModel('klarna/klarnacheckout');
513
 
514
  if ($checkoutId) {
515
  try {
516
+ // createOrderFromPush returns the order if successful, otherwise an error string
517
+ $result = $klarna->createOrderFromPush($checkoutId, false);
518
 
519
  if (is_array($result)) {
520
  if ($result['status']=='success') {
521
+ $this->_getSemaphore()->deleteSemaphore();
522
+ $helper->logKlarnaApi('order created successfully, order id: ' . $result['order']->getId());
523
+ $helper->updateKlarnacheckoutHistory($checkoutId, null, $quote->getId(), $result['order']->getId());
524
  } elseif ($result['status']=='fail') {
525
+ $this->_getSemaphore()->deleteSemaphore();
526
+ $helper->logKlarnaApi($result['message']);
527
  } else {
528
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'push failed ' . $result['message']));
529
+ $helper->logKlarnaApi($result['message']);
 
530
  }
531
  } else {
532
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'push failed ' . 'Unkown error from createOrderFromPush'));
533
+ $helper->logKlarnaApi('Unkown error from createOrderFromPush');
 
534
  }
535
  } catch (Exception $e) {
536
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'push failed ' . $e->getMessage()));
537
+ $helper->logKlarnaException($e);
 
538
  }
539
  }
540
+ $helper->logKlarnaActionEnd();
541
  }
542
 
543
  public function successAction()
544
  {
545
+ /* @var Vaimo_Klarna_Helper_Data $helper */
546
+ $helper = Mage::helper('klarna');
547
  try {
 
 
548
  $checkoutId = $this->_getSession()->getKlarnaCheckoutId();
549
+ $helper->setCheckoutId($checkoutId);
550
+ $helper->logKlarnaActionStart('klarnacheckout', 'success');
551
+ $semaphoreSkipped = false;
552
+ $revisitedf = false;
553
  if (!$checkoutId) {
554
  $checkoutId = $this->_getSession()->getKlarnaCheckoutPrevId();
555
  if ($checkoutId) {
557
  }
558
  }
559
  if (!$checkoutId) {
560
+ $helper->logKlarnaApi('Checkout id is empty, so we do nothing');
561
+ $helper->logKlarnaActionEnd();
562
  exit(1);
563
  }
564
+ if (!$this->_getSemaphore()->addSemaphore($checkoutId)) {
565
+ if (!$this->_getSemaphore()->waitSemaphore($checkoutId, 10)) {
566
+ $helper->logKlarnaApi('Semaphore not acquired, continuing without order');
567
+ $semaphoreSkipped = true;
568
+ }
569
+ }
570
  if (!$revisitedf) {
571
+ $helper->logKlarnaApi('Checkout id: ' . $checkoutId);
572
  } else {
573
+ $helper->logKlarnaApi('RE-VISITED, Checkout id: ' . $checkoutId);
574
  }
575
  //$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
576
+ $quote = $helper->findQuote($checkoutId);
577
  if (!$quote || !$quote->getId()) {
578
+ $message = $this->__('Cart not available. Please try again') . ': ' . $checkoutId . ' revisitedf = ' . $revisitedf;
579
+ if (!$semaphoreSkipped) {
580
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'success failed ' . $message));
581
+ }
582
+ Mage::throwException($message);
583
+ }
584
+ if (!$semaphoreSkipped) {
585
+ $this->_getSemaphore()->updateSemaphore(array('quote_id' => $quote->getId()));
586
  }
587
  $klarna = Mage::getModel('klarna/klarnacheckout');
588
  $klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
589
 
590
  } catch (Exception $e) {
591
  // Will show empty success page... however unlikely it is to get here, it's not very good
592
+ $helper->logKlarnaException($e);
593
+ $helper->logKlarnaActionEnd();
594
+ if (!$semaphoreSkipped) {
595
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'success failed ' . $e->getMessage()));
596
+ }
597
  return $this;
598
  }
599
 
606
  try {
607
  $status = $klarna->getCheckoutStatus($checkoutId, $useCurrentOrderSession);
608
  $canDisplaySuccess =
609
+ $status == 'checkout_complete' ||
610
  $status == 'created' ||
611
  $status == 'AUTHORIZED';
612
  if (!$canDisplaySuccess) {
613
+ $helper->logDebugInfo(
614
+ 'incorrect status: ' . $status . ' ' .
615
+ 'Retrying (' . ($cnt + 1) . ' / 5)',
616
+ $checkoutId);
 
617
  $useCurrentOrderSession = false; // Reinitiate communication
618
  } else {
619
  break;
620
  }
621
  } catch (Exception $e) {
622
+ $helper->logKlarnaException($e);
623
+ $helper->logDebugInfo(
624
+ 'exception: ' . $e->getMessage() .
625
+ 'Retrying (' . ($cnt + 1) . ' / 5)',
626
+ $checkoutId);
627
  $useCurrentOrderSession = false; // Reinitiate communication
628
  }
629
  }
630
 
631
  try {
632
  if (!$canDisplaySuccess) {
633
+ $helper->logKlarnaApi('ERROR: order not created: ' . $status);
634
  $error = $this->__('Checkout incomplete, please try again.');
635
  $this->_getSession()->addError($error);
636
+ if (!$semaphoreSkipped) {
637
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'success failed ' . $error));
638
+ }
639
  $this->_redirectToCart($quote->getStoreId());
640
+ $helper->logKlarnaActionEnd();
641
  return $this;
642
  } else {
643
+ $helper->logKlarnaApi('Displaying success');
644
  }
645
 
646
  $createOrderOnSuccess = $klarna->getConfigData('create_order_on_success');
647
+ if ($semaphoreSkipped) {
648
+ $createOrderOnSuccess = false;
649
+ }
650
 
651
  if (!$revisitedf) {
652
 
653
  if ($quote->getId() && $quote->getIsActive()) {
654
 
655
+ // successActionForQuote returns true if successful, a string if failed
656
  $createdKlarnaOrder = new Varien_Object($klarna->getActualKlarnaOrderArray());
657
+ $helper->updateKlarnacheckoutHistory($checkoutId, null, $quote->getId(), null, $createdKlarnaOrder->getReservation());
658
+ $result = $klarna->successActionForQuote($checkoutId, $createOrderOnSuccess, $createdKlarnaOrder);
659
+ $helper->logDebugInfo('successActionForQuote result = ' . $result, null, $checkoutId);
660
 
661
  $order = Mage::getModel('sales/order')->load($quote->getId(), 'quote_id');
662
 
663
  if ($order && $order->getId()) {
664
+ $helper->logKlarnaApi('successActionForQuote successfully created order with no: ' . $order->getIncrementId());
665
  }
666
 
667
  }
675
  if ($order && $order->getId()) {
676
  $this->_getSession()->setLastOrderId($order->getId());
677
  $this->_getSession()->setLastRealOrderId($order->getIncrementId());
678
+ $helper->updateKlarnacheckoutHistory($checkoutId, null, $quote->getId(), $order->getId());
679
  }
680
  $this->_getSession()->setKlarnaCheckoutPrevId($checkoutId);
681
  $this->_getSession()->setKlarnaCheckoutId(''); // This needs to be cleared, to be able to create new orders
695
  $block->setKlarnaCheckoutOrder($klarna->getActualKlarnaOrder());
696
  }
697
 
698
+ if (!$semaphoreSkipped) {
699
+ $this->_getSemaphore()->deleteSemaphore();
700
+ }
701
+
702
  $this->renderLayout();
703
 
704
+ // This needs to be cleared, to be able to create new orders
705
+ // Also, it needs to be done AFTER render layout has been run...
706
+ $this->_getSession()->setKlarnaCheckoutId('');
707
+
708
+ $helper->logKlarnaApi('Displayed success');
709
+ $helper->logKlarnaActionEnd();
710
  } catch (Exception $e) {
711
  // Will show empty success page... however unlikely it is to get here, it's not very good
712
+ $helper->logKlarnaException($e);
713
+ $helper->logKlarnaActionEnd();
714
+ if (!$semaphoreSkipped) {
715
+ $this->_getSemaphore()->failedSemaphore(array('message' => 'success failed ' . $e->getMessage()));
716
+ }
717
  return $this;
718
  }
719
  }
853
 
854
  public function getKlarnaCheckoutAction()
855
  {
856
+ Mage::helper('klarna')->setFunctionNameForLog('klarnacheckout');
857
  $this->loadLayout('checkout_klarna_index');
858
 
859
  $block = $this->getLayout()->getBlock('checkout');
918
 
919
  // Addon for ajax to redirect to cart
920
  if ($this->_getCart()->getSummaryQty() <= 0) {
921
+ $result['redirect_url'] = Mage::getBaseUrl() . Mage::helper('klarna')->getKCORedirectToCartUrl($quote->getStoreId());
922
  }
923
  }
924
  $this->_getSession()->setCartWasUpdated(true);
app/code/community/Vaimo/Klarna/etc/config.xml CHANGED
@@ -25,7 +25,7 @@
25
  --><config>
26
  <modules>
27
  <Vaimo_Klarna>
28
- <version>5.3.55</version>
29
  <name>Vaimo Klarna Module</name>
30
  <depends>
31
  <Mage_Payment/>
@@ -47,9 +47,18 @@
47
  <klarna_resource>
48
  <class>Vaimo_Klarna_Model_Resource</class>
49
  <entities>
50
- <pushqueue>
51
- <table>vaimo_klarna_pushqueue</table>
52
- </pushqueue>
 
 
 
 
 
 
 
 
 
53
  </entities>
54
  </klarna_resource>
55
  </models>
@@ -89,6 +98,20 @@
89
  <to_customer_address>*</to_customer_address>
90
  </care_of>
91
  </sales_convert_quote_address>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  </fieldsets>
93
 
94
  <events>
@@ -284,14 +307,14 @@
284
  <model>klarna/cron::statusUpdateOfPendingOrders</model>
285
  </run>
286
  </update_klarna_transactions>
287
- <check_klarna_pushqueue>
288
  <schedule>
289
- <cron_expr>0 * * * *</cron_expr>
290
  </schedule>
291
  <run>
292
- <model>klarna/cron::treatPushQueue</model>
293
  </run>
294
- </check_klarna_pushqueue>
295
  </jobs>
296
  </crontab>
297
 
@@ -359,6 +382,7 @@
359
  <host>BETA</host>
360
  <allow_separate_address>1</allow_separate_address>
361
  <show_extended_error_message>1</show_extended_error_message>
 
362
  </vaimo_klarna_invoice>
363
  <vaimo_klarna_account>
364
  <title>Klarna Account</title>
@@ -373,6 +397,7 @@
373
  <host>BETA</host>
374
  <allow_separate_address>1</allow_separate_address>
375
  <show_extended_error_message>1</show_extended_error_message>
 
376
  </vaimo_klarna_account>
377
  <vaimo_klarna_special>
378
  <title>Klarna Campaign</title>
@@ -387,6 +412,7 @@
387
  <host>BETA</host>
388
  <allow_separate_address>1</allow_separate_address>
389
  <show_extended_error_message>1</show_extended_error_message>
 
390
  </vaimo_klarna_special>
391
  <vaimo_klarna_checkout>
392
  <title>Klarna Checkout</title>
@@ -400,19 +426,29 @@
400
  <host>BETA</host>
401
  <allow_when_logged_in>1</allow_when_logged_in>
402
  <allow_customer_group>99</allow_customer_group>
403
- <klarna_layout>0</klarna_layout>
404
  <auto_prefil>1</auto_prefil>
405
  <allow_separate_address>2</allow_separate_address>
406
  <enable_cart_above_kco>1</enable_cart_above_kco>
407
- <enable_other_button>1</enable_other_button>
408
  <enable_auto_focus>1</enable_auto_focus>
409
  <shipping_countries>US,MX,CA,GL</shipping_countries>
410
  <auto_register_guest>1</auto_register_guest>
411
  <create_order_on_validation>1</create_order_on_validation>
412
- <other_countries>1</other_countries>
 
 
413
  <show_extended_error_message>1</show_extended_error_message>
 
 
 
414
  </vaimo_klarna_checkout>
415
  </payment>
 
 
 
 
 
416
  <icorder>
417
  <excluded_payment_methods>
418
  <vaimo_klarna_checkout/>
25
  --><config>
26
  <modules>
27
  <Vaimo_Klarna>
28
+ <version>5.5.1</version>
29
  <name>Vaimo Klarna Module</name>
30
  <depends>
31
  <Mage_Payment/>
47
  <klarna_resource>
48
  <class>Vaimo_Klarna_Model_Resource</class>
49
  <entities>
50
+ <klarnacheckout_semaphore>
51
+ <table>vaimo_klarna_semaphore</table>
52
+ </klarnacheckout_semaphore>
53
+ <klarnacheckout_history>
54
+ <table>vaimo_klarna_history</table>
55
+ </klarnacheckout_history>
56
+ <log>
57
+ <table>vaimo_klarna_log</table>
58
+ </log>
59
+ <log_data>
60
+ <table>vaimo_klarna_log_data</table>
61
+ </log_data>
62
  </entities>
63
  </klarna_resource>
64
  </models>
98
  <to_customer_address>*</to_customer_address>
99
  </care_of>
100
  </sales_convert_quote_address>
101
+ <sales_convert_quote>
102
+ <vaimo_klarna_fee>
103
+ <to_order>*</to_order>
104
+ </vaimo_klarna_fee>
105
+ <vaimo_klarna_fee_tax>-
106
+ <to_order>*</to_order>
107
+ </vaimo_klarna_fee_tax>
108
+ <vaimo_klarna_base_fee>
109
+ <to_order>*</to_order>
110
+ </vaimo_klarna_base_fee>
111
+ <vaimo_klarna_base_fee_tax>
112
+ <to_order>*</to_order>
113
+ </vaimo_klarna_base_fee_tax>
114
+ </sales_convert_quote>
115
  </fieldsets>
116
 
117
  <events>
307
  <model>klarna/cron::statusUpdateOfPendingOrders</model>
308
  </run>
309
  </update_klarna_transactions>
310
+ <purge_logs>
311
  <schedule>
312
+ <cron_expr>37 18 * * *</cron_expr>
313
  </schedule>
314
  <run>
315
+ <model>klarna/cron::purgeLogs</model>
316
  </run>
317
+ </purge_logs>
318
  </jobs>
319
  </crontab>
320
 
382
  <host>BETA</host>
383
  <allow_separate_address>1</allow_separate_address>
384
  <show_extended_error_message>1</show_extended_error_message>
385
+ <allow_part_capture_with_discount>0</allow_part_capture_with_discount>
386
  </vaimo_klarna_invoice>
387
  <vaimo_klarna_account>
388
  <title>Klarna Account</title>
397
  <host>BETA</host>
398
  <allow_separate_address>1</allow_separate_address>
399
  <show_extended_error_message>1</show_extended_error_message>
400
+ <allow_part_capture_with_discount>0</allow_part_capture_with_discount>
401
  </vaimo_klarna_account>
402
  <vaimo_klarna_special>
403
  <title>Klarna Campaign</title>
412
  <host>BETA</host>
413
  <allow_separate_address>1</allow_separate_address>
414
  <show_extended_error_message>1</show_extended_error_message>
415
+ <allow_part_capture_with_discount>0</allow_part_capture_with_discount>
416
  </vaimo_klarna_special>
417
  <vaimo_klarna_checkout>
418
  <title>Klarna Checkout</title>
426
  <host>BETA</host>
427
  <allow_when_logged_in>1</allow_when_logged_in>
428
  <allow_customer_group>99</allow_customer_group>
429
+ <klarna_layout>1</klarna_layout>
430
  <auto_prefil>1</auto_prefil>
431
  <allow_separate_address>2</allow_separate_address>
432
  <enable_cart_above_kco>1</enable_cart_above_kco>
433
+ <enable_other_button>0</enable_other_button>
434
  <enable_auto_focus>1</enable_auto_focus>
435
  <shipping_countries>US,MX,CA,GL</shipping_countries>
436
  <auto_register_guest>1</auto_register_guest>
437
  <create_order_on_validation>1</create_order_on_validation>
438
+ <create_order_on_success>1</create_order_on_success>
439
+ <recreate_cart_on_failed_validate>1</recreate_cart_on_failed_validate>
440
+ <other_countries>0</other_countries>
441
  <show_extended_error_message>1</show_extended_error_message>
442
+ <enable_validation>0</enable_validation>
443
+ <activate_ab_testing>0</activate_ab_testing>
444
+ <allow_part_capture_with_discount>0</allow_part_capture_with_discount>
445
  </vaimo_klarna_checkout>
446
  </payment>
447
+ <dev>
448
+ <vaimo_klarna_debug>
449
+ <vaimo_klarna_log_level>0</vaimo_klarna_log_level>
450
+ </vaimo_klarna_debug>
451
+ </dev>
452
  <icorder>
453
  <excluded_payment_methods>
454
  <vaimo_klarna_checkout/>
app/code/community/Vaimo/Klarna/etc/system.xml CHANGED
@@ -113,21 +113,70 @@
113
  <show_in_store>1</show_in_store>
114
  <show_in_website>1</show_in_website>
115
  </minimum_order_cost>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  <pending_status_action translate="label comment">
117
  <label>Cancel pending reservations</label>
118
  <frontend_type>select</frontend_type>
 
119
  <source_model>adminhtml/system_config_source_yesno</source_model>
120
- <sort_order>100</sort_order>
121
  <show_in_default>1</show_in_default>
122
  <show_in_store>1</show_in_store>
123
  <show_in_website>1</show_in_website>
124
  <comment>Automatically cancel orders when the reservation becomes pending</comment>
125
  </pending_status_action>
 
 
 
 
 
 
 
 
 
 
 
126
  <send_klarna_email translate="label comment">
127
  <label>Send invoice via e-mail</label>
128
  <frontend_type>select</frontend_type>
 
129
  <source_model>adminhtml/system_config_source_yesno</source_model>
130
- <sort_order>200</sort_order>
131
  <show_in_default>1</show_in_default>
132
  <show_in_store>1</show_in_store>
133
  <show_in_website>1</show_in_website>
@@ -136,8 +185,9 @@
136
  <allow_separate_address translate="label comment">
137
  <label>Allow separate addresses</label>
138
  <frontend_type>select</frontend_type>
 
139
  <source_model>adminhtml/system_config_source_yesno</source_model>
140
- <sort_order>210</sort_order>
141
  <show_in_default>1</show_in_default>
142
  <show_in_store>1</show_in_store>
143
  <show_in_website>1</show_in_website>
@@ -146,8 +196,9 @@
146
  <disable_company_purchase translate="label comment">
147
  <label>Disable method for company purchase</label>
148
  <frontend_type>select</frontend_type>
 
149
  <source_model>adminhtml/system_config_source_yesno</source_model>
150
- <sort_order>220</sort_order>
151
  <show_in_default>1</show_in_default>
152
  <show_in_store>1</show_in_store>
153
  <show_in_website>1</show_in_website>
@@ -156,8 +207,9 @@
156
  <disable_backend_calls translate="label comment">
157
  <label>Disable Klarna Backend</label>
158
  <frontend_type>select</frontend_type>
 
159
  <source_model>adminhtml/system_config_source_yesno</source_model>
160
- <sort_order>230</sort_order>
161
  <show_in_default>1</show_in_default>
162
  <show_in_store>1</show_in_store>
163
  <show_in_website>1</show_in_website>
@@ -167,57 +219,36 @@
167
  <label>Show Extended Error Message</label>
168
  <frontend_type>select</frontend_type>
169
  <source_model>adminhtml/system_config_source_yesno</source_model>
170
- <sort_order>240</sort_order>
 
171
  <show_in_default>1</show_in_default>
172
  <show_in_store>1</show_in_store>
173
  <show_in_website>1</show_in_website>
174
  <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
175
  <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
176
  </show_extended_error_message>
177
- <terms_url translate="label comment">
178
- <label>URL to terms and conditions</label>
179
- <frontend_type>text</frontend_type>
180
- <sort_order>700</sort_order>
181
- <show_in_default>1</show_in_default>
182
- <show_in_store>1</show_in_store>
183
- <show_in_website>1</show_in_website>
184
- <comment>URL to this stores own terms and conditions (only used in Germany and Austria)</comment>
185
- </terms_url>
186
- <klarna_language translate="label">
187
- <label>Language</label>
188
- <frontend_type>select</frontend_type>
189
- <source_model>klarna/source_language</source_model>
190
- <sort_order>800</sort_order>
191
- <show_in_default>1</show_in_default>
192
- <show_in_store>1</show_in_store>
193
- <show_in_website>1</show_in_website>
194
- </klarna_language>
195
  <allowspecific translate="label">
196
  <label>Allowed countries</label>
197
  <frontend_type>allowspecific</frontend_type>
198
- <sort_order>900</sort_order>
 
199
  <source_model>klarna/source_allspecificcountries</source_model>
200
  <show_in_default>1</show_in_default>
201
  <show_in_website>1</show_in_website>
202
  <show_in_store>1</show_in_store>
 
203
  </allowspecific>
204
  <specificcountry translate="label">
205
  <label>Specific countries</label>
206
  <frontend_type>multiselect</frontend_type>
207
- <sort_order>910</sort_order>
 
208
  <source_model>klarna/source_country</source_model>
209
  <show_in_default>1</show_in_default>
210
  <show_in_website>1</show_in_website>
211
  <show_in_store>1</show_in_store>
 
212
  </specificcountry>
213
- <sort_order translate="label">
214
- <label>Sort order</label>
215
- <frontend_type>text</frontend_type>
216
- <sort_order>920</sort_order>
217
- <show_in_default>1</show_in_default>
218
- <show_in_website>1</show_in_website>
219
- <show_in_store>1</show_in_store>
220
- </sort_order>
221
  </fields>
222
  </vaimo_klarna_invoice>
223
  <vaimo_klarna_account translate="label" module="klarna">
@@ -235,6 +266,7 @@
235
  <show_in_default>1</show_in_default>
236
  <show_in_store>1</show_in_store>
237
  <show_in_website>1</show_in_website>
 
238
  </active>
239
  <merchant_id translate="label comment">
240
  <label>Merchant ID</label>
@@ -291,21 +323,80 @@
291
  <show_in_store>1</show_in_store>
292
  <show_in_website>1</show_in_website>
293
  </order_status>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  <pending_status_action translate="label comment">
295
  <label>Cancel pending reservations</label>
296
  <frontend_type>select</frontend_type>
 
297
  <source_model>adminhtml/system_config_source_yesno</source_model>
298
- <sort_order>100</sort_order>
299
  <show_in_default>1</show_in_default>
300
  <show_in_store>1</show_in_store>
301
  <show_in_website>1</show_in_website>
302
  <comment>Automatically cancel orders when the reservation becomes pending</comment>
303
  </pending_status_action>
 
 
 
 
 
 
 
 
 
 
 
304
  <send_klarna_email translate="label comment">
305
  <label>Send invoice via e-mail</label>
306
  <frontend_type>select</frontend_type>
 
307
  <source_model>adminhtml/system_config_source_yesno</source_model>
308
- <sort_order>200</sort_order>
309
  <show_in_default>1</show_in_default>
310
  <show_in_store>1</show_in_store>
311
  <show_in_website>1</show_in_website>
@@ -314,8 +405,9 @@
314
  <allow_separate_address translate="label comment">
315
  <label>Allow separate addresses</label>
316
  <frontend_type>select</frontend_type>
 
317
  <source_model>adminhtml/system_config_source_yesno</source_model>
318
- <sort_order>210</sort_order>
319
  <show_in_default>1</show_in_default>
320
  <show_in_store>1</show_in_store>
321
  <show_in_website>1</show_in_website>
@@ -324,8 +416,9 @@
324
  <disable_company_purchase translate="label comment">
325
  <label>Disable method for company purchase</label>
326
  <frontend_type>select</frontend_type>
 
327
  <source_model>adminhtml/system_config_source_yesno</source_model>
328
- <sort_order>220</sort_order>
329
  <show_in_default>1</show_in_default>
330
  <show_in_store>1</show_in_store>
331
  <show_in_website>1</show_in_website>
@@ -334,8 +427,9 @@
334
  <disable_backend_calls translate="label comment">
335
  <label>Disable Klarna Backend</label>
336
  <frontend_type>select</frontend_type>
 
337
  <source_model>adminhtml/system_config_source_yesno</source_model>
338
- <sort_order>230</sort_order>
339
  <show_in_default>1</show_in_default>
340
  <show_in_store>1</show_in_store>
341
  <show_in_website>1</show_in_website>
@@ -344,68 +438,37 @@
344
  <show_extended_error_message translate="label comment tooltip">
345
  <label>Show Extended Error Message</label>
346
  <frontend_type>select</frontend_type>
 
347
  <source_model>adminhtml/system_config_source_yesno</source_model>
348
- <sort_order>240</sort_order>
349
  <show_in_default>1</show_in_default>
350
  <show_in_store>1</show_in_store>
351
  <show_in_website>1</show_in_website>
352
  <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
353
  <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
354
  </show_extended_error_message>
355
- <disable_product_widget translate="label comment">
356
- <label>Disable payment widget on product page</label>
357
- <frontend_type>select</frontend_type>
358
- <source_model>adminhtml/system_config_source_yesno</source_model>
359
- <sort_order>250</sort_order>
360
- <show_in_default>1</show_in_default>
361
- <show_in_store>1</show_in_store>
362
- <show_in_website>1</show_in_website>
363
- <comment>If set to yes, the payment information from Klarna will not appear on the product page</comment>
364
- </disable_product_widget>
365
- <terms_url translate="label comment">
366
- <label>URL to terms and conditions</label>
367
- <frontend_type>text</frontend_type>
368
- <sort_order>700</sort_order>
369
- <show_in_default>1</show_in_default>
370
- <show_in_store>1</show_in_store>
371
- <show_in_website>1</show_in_website>
372
- <comment>URL to this stores own terms and conditions (only used in Germany and Austria)</comment>
373
- </terms_url>
374
- <klarna_language translate="label">
375
- <label>Language</label>
376
- <frontend_type>select</frontend_type>
377
- <source_model>klarna/source_language</source_model>
378
- <sort_order>800</sort_order>
379
- <show_in_default>1</show_in_default>
380
- <show_in_store>1</show_in_store>
381
- <show_in_website>1</show_in_website>
382
- </klarna_language>
383
  <allowspecific translate="label">
384
  <label>Allowed countries</label>
385
  <frontend_type>allowspecific</frontend_type>
386
- <sort_order>900</sort_order>
 
387
  <source_model>klarna/source_allspecificcountries</source_model>
388
  <show_in_default>1</show_in_default>
389
  <show_in_website>1</show_in_website>
390
  <show_in_store>1</show_in_store>
 
391
  </allowspecific>
392
  <specificcountry translate="label">
393
  <label>Specific countries</label>
394
  <frontend_type>multiselect</frontend_type>
395
- <sort_order>910</sort_order>
 
396
  <source_model>klarna/source_country</source_model>
397
  <show_in_default>1</show_in_default>
398
  <show_in_website>1</show_in_website>
399
  <show_in_store>1</show_in_store>
 
400
  </specificcountry>
401
- <sort_order translate="label">
402
- <label>Sort order</label>
403
- <frontend_type>text</frontend_type>
404
- <sort_order>920</sort_order>
405
- <show_in_default>1</show_in_default>
406
- <show_in_website>1</show_in_website>
407
- <show_in_store>1</show_in_store>
408
- </sort_order>
409
  </fields>
410
  </vaimo_klarna_account>
411
  <vaimo_klarna_special translate="label" module="klarna">
@@ -469,21 +532,89 @@
469
  <show_in_store>1</show_in_store>
470
  <show_in_website>1</show_in_website>
471
  </order_status>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
  <pending_status_action translate="label comment">
473
  <label>Cancel pending reservations</label>
474
  <frontend_type>select</frontend_type>
 
475
  <source_model>adminhtml/system_config_source_yesno</source_model>
476
- <sort_order>100</sort_order>
477
  <show_in_default>1</show_in_default>
478
  <show_in_store>1</show_in_store>
479
  <show_in_website>1</show_in_website>
480
  <comment>Automatically cancel orders when the reservation becomes pending</comment>
481
  </pending_status_action>
 
 
 
 
 
 
 
 
 
 
 
482
  <send_klarna_email translate="label comment">
483
  <label>Send invoice via e-mail</label>
484
  <frontend_type>select</frontend_type>
 
485
  <source_model>adminhtml/system_config_source_yesno</source_model>
486
- <sort_order>200</sort_order>
487
  <show_in_default>1</show_in_default>
488
  <show_in_store>1</show_in_store>
489
  <show_in_website>1</show_in_website>
@@ -492,8 +623,9 @@
492
  <allow_separate_address translate="label comment">
493
  <label>Allow separate addresses</label>
494
  <frontend_type>select</frontend_type>
 
495
  <source_model>adminhtml/system_config_source_yesno</source_model>
496
- <sort_order>210</sort_order>
497
  <show_in_default>1</show_in_default>
498
  <show_in_store>1</show_in_store>
499
  <show_in_website>1</show_in_website>
@@ -502,8 +634,9 @@
502
  <disable_company_purchase translate="label comment">
503
  <label>Disable method for company purchase</label>
504
  <frontend_type>select</frontend_type>
 
505
  <source_model>adminhtml/system_config_source_yesno</source_model>
506
- <sort_order>220</sort_order>
507
  <show_in_default>1</show_in_default>
508
  <show_in_store>1</show_in_store>
509
  <show_in_website>1</show_in_website>
@@ -512,8 +645,9 @@
512
  <disable_backend_calls translate="label comment">
513
  <label>Disable Klarna Backend</label>
514
  <frontend_type>select</frontend_type>
 
515
  <source_model>adminhtml/system_config_source_yesno</source_model>
516
- <sort_order>230</sort_order>
517
  <show_in_default>1</show_in_default>
518
  <show_in_store>1</show_in_store>
519
  <show_in_website>1</show_in_website>
@@ -522,77 +656,37 @@
522
  <show_extended_error_message translate="label comment tooltip">
523
  <label>Show Extended Error Message</label>
524
  <frontend_type>select</frontend_type>
 
525
  <source_model>adminhtml/system_config_source_yesno</source_model>
526
- <sort_order>240</sort_order>
527
  <show_in_default>1</show_in_default>
528
  <show_in_store>1</show_in_store>
529
  <show_in_website>1</show_in_website>
530
  <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
531
  <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
532
  </show_extended_error_message>
533
- <terms_url translate="label comment">
534
- <label>URL to terms and conditions</label>
535
- <frontend_type>text</frontend_type>
536
- <sort_order>700</sort_order>
537
- <show_in_default>1</show_in_default>
538
- <show_in_store>1</show_in_store>
539
- <show_in_website>1</show_in_website>
540
- <comment>URL to this stores own terms and conditions (only used in Germany and Austria)</comment>
541
- </terms_url>
542
- <cdn_logotype_override translate="label comment">
543
- <label>URL to special logotype</label>
544
- <frontend_type>text</frontend_type>
545
- <sort_order>710</sort_order>
546
- <show_in_default>1</show_in_default>
547
- <show_in_store>1</show_in_store>
548
- <show_in_website>1</show_in_website>
549
- <comment>Special campaign methods have various logotypes depending on campaign, this is a way to choose a logotype from Klarna</comment>
550
- </cdn_logotype_override>
551
- <!--
552
- <cdn_terms_override translate="label">
553
- <label>URL to terms</label>
554
- <frontend_type>text</frontend_type>
555
- <sort_order>710</sort_order>
556
- <show_in_default>1</show_in_default>
557
- <show_in_store>1</show_in_store>
558
- <show_in_website>1</show_in_website>
559
- </cdn_terms_override>
560
- -->
561
- <klarna_language translate="label">
562
- <label>Language</label>
563
- <frontend_type>select</frontend_type>
564
- <source_model>klarna/source_language</source_model>
565
- <sort_order>800</sort_order>
566
- <show_in_default>1</show_in_default>
567
- <show_in_store>1</show_in_store>
568
- <show_in_website>1</show_in_website>
569
- </klarna_language>
570
  <allowspecific translate="label">
571
  <label>Allowed countries</label>
572
  <frontend_type>allowspecific</frontend_type>
573
- <sort_order>900</sort_order>
 
574
  <source_model>klarna/source_allspecificcountries</source_model>
575
  <show_in_default>1</show_in_default>
576
  <show_in_website>1</show_in_website>
577
  <show_in_store>1</show_in_store>
 
578
  </allowspecific>
579
  <specificcountry translate="label">
580
  <label>Specific countries</label>
581
  <frontend_type>multiselect</frontend_type>
582
- <sort_order>910</sort_order>
 
583
  <source_model>klarna/source_country</source_model>
584
  <show_in_default>1</show_in_default>
585
  <show_in_website>1</show_in_website>
586
  <show_in_store>1</show_in_store>
 
587
  </specificcountry>
588
- <sort_order translate="label">
589
- <label>Sort order</label>
590
- <frontend_type>text</frontend_type>
591
- <sort_order>920</sort_order>
592
- <show_in_default>1</show_in_default>
593
- <show_in_website>1</show_in_website>
594
- <show_in_store>1</show_in_store>
595
- </sort_order>
596
  </fields>
597
  </vaimo_klarna_special>
598
  <vaimo_klarna_checkout translate="label" module="klarna">
@@ -648,16 +742,6 @@
648
  <show_in_store>1</show_in_store>
649
  <comment>Choose what server to make calls to</comment>
650
  </host>
651
- <auto_prefil translate="label comment">
652
- <label>Auto prefill known Klarna details</label>
653
- <frontend_type>select</frontend_type>
654
- <source_model>adminhtml/system_config_source_yesno</source_model>
655
- <sort_order>60</sort_order>
656
- <show_in_default>1</show_in_default>
657
- <show_in_website>1</show_in_website>
658
- <show_in_store>1</show_in_store>
659
- <comment>When activated, it will use the logged in customer details to prefill the Klarna Checkout form</comment>
660
- </auto_prefil>
661
  <order_status translate="label">
662
  <label>New order status</label>
663
  <frontend_type>select</frontend_type>
@@ -667,88 +751,141 @@
667
  <show_in_website>1</show_in_website>
668
  <show_in_store>0</show_in_store>
669
  </order_status>
670
- <disable_backend_calls translate="label comment">
671
- <label>Disable Klarna Backend</label>
672
  <frontend_type>select</frontend_type>
673
  <source_model>adminhtml/system_config_source_yesno</source_model>
674
- <sort_order>79</sort_order>
675
  <show_in_default>1</show_in_default>
 
676
  <show_in_store>1</show_in_store>
 
 
 
 
 
 
 
677
  <show_in_website>1</show_in_website>
678
- <comment>Disable all calls to Klarna from Admin, such as Capture, Credit and Cancel. This feature can be used if those functions are maintained by an external system</comment>
679
- </disable_backend_calls>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
680
  <disable_product_widget translate="label comment">
681
  <label>Disable payment widget on product page</label>
682
  <frontend_type>select</frontend_type>
683
  <source_model>adminhtml/system_config_source_yesno</source_model>
684
- <sort_order>80</sort_order>
685
  <show_in_default>1</show_in_default>
686
  <show_in_website>1</show_in_website>
687
  <show_in_store>1</show_in_store>
688
  <comment>If set to yes, the payment information from Klarna will not appear on the product page</comment>
689
  </disable_product_widget>
690
- <show_extended_error_message translate="label comment tooltip">
691
- <label>Show Extended Error Message</label>
692
  <frontend_type>select</frontend_type>
693
  <source_model>adminhtml/system_config_source_yesno</source_model>
694
- <sort_order>85</sort_order>
695
  <show_in_default>1</show_in_default>
696
  <show_in_store>1</show_in_store>
697
  <show_in_website>1</show_in_website>
698
- <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
699
- <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
700
- </show_extended_error_message>
701
- <terms_url translate="label comment">
702
- <label>URL to terms and conditions</label>
703
- <frontend_type>text</frontend_type>
704
- <sort_order>90</sort_order>
705
- <show_in_default>1</show_in_default>
706
- <show_in_website>1</show_in_website>
707
- <show_in_store>1</show_in_store>
708
- <comment>URL to this stores own terms and conditions</comment>
709
- </terms_url>
710
  <cart_redirect translate="label comment">
711
  <label>Cart redirect</label>
712
  <frontend_type>text</frontend_type>
713
- <sort_order>95</sort_order>
 
714
  <show_in_default>1</show_in_default>
715
  <show_in_store>1</show_in_store>
716
  <show_in_website>1</show_in_website>
717
  <comment>Default is cart, custom redirect must not go to any checkout page</comment>
718
  </cart_redirect>
719
- <klarna_layout translate="label">
720
- <label>Layout</label>
721
  <frontend_type>select</frontend_type>
722
- <source_model>klarna/source_klarnalayout</source_model>
723
- <sort_order>100</sort_order>
 
724
  <show_in_default>1</show_in_default>
725
  <show_in_website>1</show_in_website>
726
  <show_in_store>1</show_in_store>
727
- </klarna_layout>
728
- <klarna_language translate="label comment">
729
- <label>Language</label>
 
730
  <frontend_type>select</frontend_type>
731
- <source_model>klarna/source_language</source_model>
732
- <sort_order>110</sort_order>
 
733
  <show_in_default>1</show_in_default>
734
  <show_in_store>1</show_in_store>
735
  <show_in_website>1</show_in_website>
736
- <comment>Can be used if site is in a different language than the official language of current country</comment>
737
- </klarna_language>
738
- <show_login_form translate="label comment">
739
- <label>Show login form</label>
740
  <frontend_type>select</frontend_type>
 
741
  <source_model>adminhtml/system_config_source_yesno</source_model>
742
- <sort_order>120</sort_order>
743
  <show_in_default>1</show_in_default>
744
- <show_in_website>1</show_in_website>
745
  <show_in_store>1</show_in_store>
746
- <comment>Only for 2 column layout</comment>
747
- </show_login_form>
 
 
748
  <extra_order_attribute translate="label comment">
749
  <label>Extra order ID attribute</label>
750
  <frontend_type>text</frontend_type>
751
- <sort_order>150</sort_order>
 
752
  <show_in_default>1</show_in_default>
753
  <show_in_website>1</show_in_website>
754
  <show_in_store>1</show_in_store>
@@ -757,18 +894,31 @@
757
  <allow_separate_address translate="label comment">
758
  <label>Allow separate addresses</label>
759
  <frontend_type>select</frontend_type>
 
760
  <source_model>klarna/source_yesnodefault</source_model>
761
- <sort_order>210</sort_order>
762
  <show_in_default>1</show_in_default>
763
  <show_in_store>1</show_in_store>
764
  <show_in_website>1</show_in_website>
765
  <comment>Allow shipping address to be different from billing address. You might need acceptance from Klarna if activated</comment>
766
  </allow_separate_address>
 
 
 
 
 
 
 
 
 
 
 
767
  <force_phonenumber translate="label">
768
  <label>Force entry of phonenumber</label>
769
  <frontend_type>select</frontend_type>
 
770
  <source_model>adminhtml/system_config_source_yesno</source_model>
771
- <sort_order>220</sort_order>
772
  <show_in_default>1</show_in_default>
773
  <show_in_website>1</show_in_website>
774
  <show_in_store>1</show_in_store>
@@ -776,36 +926,20 @@
776
  <packstation_enabled translate="label comment">
777
  <label>Enable DHL Packstation</label>
778
  <frontend_type>select</frontend_type>
 
779
  <source_model>adminhtml/system_config_source_yesno</source_model>
780
- <sort_order>230</sort_order>
781
  <show_in_default>1</show_in_default>
782
  <show_in_website>1</show_in_website>
783
  <show_in_store>1</show_in_store>
784
  <comment>Only available in Germany</comment>
785
  </packstation_enabled>
786
- <enable_cart_above_kco translate="label">
787
- <label>Enable cart in checkout page</label>
788
- <frontend_type>select</frontend_type>
789
- <source_model>adminhtml/system_config_source_yesno</source_model>
790
- <sort_order>240</sort_order>
791
- <show_in_default>1</show_in_default>
792
- <show_in_website>1</show_in_website>
793
- <show_in_store>1</show_in_store>
794
- </enable_cart_above_kco>
795
- <enable_auto_focus translate="label">
796
- <label>Enable Autofocus for Klarna Checkout</label>
797
- <frontend_type>select</frontend_type>
798
- <source_model>adminhtml/system_config_source_yesno</source_model>
799
- <sort_order>250</sort_order>
800
- <show_in_default>1</show_in_default>
801
- <show_in_website>1</show_in_website>
802
- <show_in_store>1</show_in_store>
803
- </enable_auto_focus>
804
  <enable_trigger_changed_js translate="label">
805
  <label>Enable javascript trigger for address update</label>
806
  <frontend_type>select</frontend_type>
 
807
  <source_model>adminhtml/system_config_source_yesno</source_model>
808
- <sort_order>270</sort_order>
809
  <show_in_default>1</show_in_default>
810
  <show_in_website>1</show_in_website>
811
  <show_in_store>1</show_in_store>
@@ -813,28 +947,20 @@
813
  <auto_register_guest translate="label comment">
814
  <label>Automatically register guests on checkout</label>
815
  <frontend_type>select</frontend_type>
 
816
  <source_model>adminhtml/system_config_source_yesno</source_model>
817
- <sort_order>280</sort_order>
818
  <show_in_default>1</show_in_default>
819
  <show_in_store>1</show_in_store>
820
  <show_in_website>1</show_in_website>
821
  <comment>If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.</comment>
822
  </auto_register_guest>
823
- <create_order_on_success translate="label comment">
824
- <label>Create order on Success</label>
825
- <frontend_type>select</frontend_type>
826
- <source_model>adminhtml/system_config_source_yesno</source_model>
827
- <sort_order>290</sort_order>
828
- <show_in_default>1</show_in_default>
829
- <show_in_website>1</show_in_website>
830
- <show_in_store>1</show_in_store>
831
- <comment>Create pending order on Success and only update it when completed (will work together with creating it on Validate).</comment>
832
- </create_order_on_success>
833
  <user_defined_json translate="label comment">
834
  <label>User Defined Variables</label>
835
  <backend_model>klarna/adminhtml_system_config_backend_admin_json</backend_model>
836
  <frontend_type>textarea</frontend_type>
837
- <sort_order>390</sort_order>
 
838
  <show_in_default>1</show_in_default>
839
  <show_in_website>1</show_in_website>
840
  <show_in_store>1</show_in_store>
@@ -1144,5 +1270,31 @@
1144
  </calculation>
1145
  </groups>
1146
  </tax>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1147
  </sections>
1148
  </config>
113
  <show_in_store>1</show_in_store>
114
  <show_in_website>1</show_in_website>
115
  </minimum_order_cost>
116
+ <terms_url translate="label comment">
117
+ <label>URL to terms and conditions</label>
118
+ <frontend_type>text</frontend_type>
119
+ <sort_order>100</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_store>1</show_in_store>
122
+ <show_in_website>1</show_in_website>
123
+ <comment>URL to this stores own terms and conditions (only used in Germany and Austria)</comment>
124
+ </terms_url>
125
+ <klarna_language translate="label">
126
+ <label>Language</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>klarna/source_language</source_model>
129
+ <sort_order>110</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_store>1</show_in_store>
132
+ <show_in_website>1</show_in_website>
133
+ </klarna_language>
134
+ <sort_order translate="label">
135
+ <label>Sort order</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>120</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ </sort_order>
142
+ <show_advanced_options translate="label comment">
143
+ <label>Show advanced options</label>
144
+ <frontend_type>select</frontend_type>
145
+ <source_model>adminhtml/system_config_source_yesno</source_model>
146
+ <sort_order>500</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_store>1</show_in_store>
149
+ <show_in_website>1</show_in_website>
150
+ <comment>Display advanced or seldomly used settings</comment>
151
+ </show_advanced_options>
152
  <pending_status_action translate="label comment">
153
  <label>Cancel pending reservations</label>
154
  <frontend_type>select</frontend_type>
155
+ <depends><show_advanced_options>1</show_advanced_options></depends>
156
  <source_model>adminhtml/system_config_source_yesno</source_model>
157
+ <sort_order>510</sort_order>
158
  <show_in_default>1</show_in_default>
159
  <show_in_store>1</show_in_store>
160
  <show_in_website>1</show_in_website>
161
  <comment>Automatically cancel orders when the reservation becomes pending</comment>
162
  </pending_status_action>
163
+ <allow_part_capture_with_discount translate="label comment">
164
+ <label>Allow part capture when orders have discount</label>
165
+ <frontend_type>select</frontend_type>
166
+ <depends><show_advanced_options>1</show_advanced_options></depends>
167
+ <source_model>adminhtml/system_config_source_yesno</source_model>
168
+ <sort_order>515</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_store>1</show_in_store>
171
+ <show_in_website>1</show_in_website>
172
+ <comment>Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.</comment>
173
+ </allow_part_capture_with_discount>
174
  <send_klarna_email translate="label comment">
175
  <label>Send invoice via e-mail</label>
176
  <frontend_type>select</frontend_type>
177
+ <depends><show_advanced_options>1</show_advanced_options></depends>
178
  <source_model>adminhtml/system_config_source_yesno</source_model>
179
+ <sort_order>520</sort_order>
180
  <show_in_default>1</show_in_default>
181
  <show_in_store>1</show_in_store>
182
  <show_in_website>1</show_in_website>
185
  <allow_separate_address translate="label comment">
186
  <label>Allow separate addresses</label>
187
  <frontend_type>select</frontend_type>
188
+ <depends><show_advanced_options>1</show_advanced_options></depends>
189
  <source_model>adminhtml/system_config_source_yesno</source_model>
190
+ <sort_order>530</sort_order>
191
  <show_in_default>1</show_in_default>
192
  <show_in_store>1</show_in_store>
193
  <show_in_website>1</show_in_website>
196
  <disable_company_purchase translate="label comment">
197
  <label>Disable method for company purchase</label>
198
  <frontend_type>select</frontend_type>
199
+ <depends><show_advanced_options>1</show_advanced_options></depends>
200
  <source_model>adminhtml/system_config_source_yesno</source_model>
201
+ <sort_order>540</sort_order>
202
  <show_in_default>1</show_in_default>
203
  <show_in_store>1</show_in_store>
204
  <show_in_website>1</show_in_website>
207
  <disable_backend_calls translate="label comment">
208
  <label>Disable Klarna Backend</label>
209
  <frontend_type>select</frontend_type>
210
+ <depends><show_advanced_options>1</show_advanced_options></depends>
211
  <source_model>adminhtml/system_config_source_yesno</source_model>
212
+ <sort_order>550</sort_order>
213
  <show_in_default>1</show_in_default>
214
  <show_in_store>1</show_in_store>
215
  <show_in_website>1</show_in_website>
219
  <label>Show Extended Error Message</label>
220
  <frontend_type>select</frontend_type>
221
  <source_model>adminhtml/system_config_source_yesno</source_model>
222
+ <depends><show_advanced_options>1</show_advanced_options></depends>
223
+ <sort_order>560</sort_order>
224
  <show_in_default>1</show_in_default>
225
  <show_in_store>1</show_in_store>
226
  <show_in_website>1</show_in_website>
227
  <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
228
  <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
229
  </show_extended_error_message>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  <allowspecific translate="label">
231
  <label>Allowed countries</label>
232
  <frontend_type>allowspecific</frontend_type>
233
+ <sort_order>570</sort_order>
234
+ <depends><show_advanced_options>1</show_advanced_options></depends>
235
  <source_model>klarna/source_allspecificcountries</source_model>
236
  <show_in_default>1</show_in_default>
237
  <show_in_website>1</show_in_website>
238
  <show_in_store>1</show_in_store>
239
+ <comment>Klarna supports one country per store</comment>
240
  </allowspecific>
241
  <specificcountry translate="label">
242
  <label>Specific countries</label>
243
  <frontend_type>multiselect</frontend_type>
244
+ <sort_order>575</sort_order>
245
+ <depends><show_advanced_options>1</show_advanced_options></depends>
246
  <source_model>klarna/source_country</source_model>
247
  <show_in_default>1</show_in_default>
248
  <show_in_website>1</show_in_website>
249
  <show_in_store>1</show_in_store>
250
+ <comment>Klarna supports one country per store</comment>
251
  </specificcountry>
 
 
 
 
 
 
 
 
252
  </fields>
253
  </vaimo_klarna_invoice>
254
  <vaimo_klarna_account translate="label" module="klarna">
266
  <show_in_default>1</show_in_default>
267
  <show_in_store>1</show_in_store>
268
  <show_in_website>1</show_in_website>
269
+ <comment>Not available for Austria and the Netherlands</comment>
270
  </active>
271
  <merchant_id translate="label comment">
272
  <label>Merchant ID</label>
323
  <show_in_store>1</show_in_store>
324
  <show_in_website>1</show_in_website>
325
  </order_status>
326
+ <disable_product_widget translate="label comment">
327
+ <label>Disable payment widget on product page</label>
328
+ <frontend_type>select</frontend_type>
329
+ <source_model>adminhtml/system_config_source_yesno</source_model>
330
+ <sort_order>50</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_store>1</show_in_store>
333
+ <show_in_website>1</show_in_website>
334
+ <comment>If set to yes, the payment information from Klarna will not appear on the product page</comment>
335
+ </disable_product_widget>
336
+ <terms_url translate="label comment">
337
+ <label>URL to terms and conditions</label>
338
+ <frontend_type>text</frontend_type>
339
+ <sort_order>100</sort_order>
340
+ <show_in_default>1</show_in_default>
341
+ <show_in_store>1</show_in_store>
342
+ <show_in_website>1</show_in_website>
343
+ <comment>URL to this stores own terms and conditions (only used in Germany and Austria)</comment>
344
+ </terms_url>
345
+ <klarna_language translate="label">
346
+ <label>Language</label>
347
+ <frontend_type>select</frontend_type>
348
+ <source_model>klarna/source_language</source_model>
349
+ <sort_order>110</sort_order>
350
+ <show_in_default>1</show_in_default>
351
+ <show_in_store>1</show_in_store>
352
+ <show_in_website>1</show_in_website>
353
+ </klarna_language>
354
+ <sort_order translate="label">
355
+ <label>Sort order</label>
356
+ <frontend_type>text</frontend_type>
357
+ <sort_order>120</sort_order>
358
+ <show_in_default>1</show_in_default>
359
+ <show_in_website>1</show_in_website>
360
+ <show_in_store>1</show_in_store>
361
+ </sort_order>
362
+ <show_advanced_options translate="label comment">
363
+ <label>Show advanced options</label>
364
+ <frontend_type>select</frontend_type>
365
+ <source_model>adminhtml/system_config_source_yesno</source_model>
366
+ <sort_order>500</sort_order>
367
+ <show_in_default>1</show_in_default>
368
+ <show_in_store>1</show_in_store>
369
+ <show_in_website>1</show_in_website>
370
+ <comment>Display advanced or seldomly used settings</comment>
371
+ </show_advanced_options>
372
  <pending_status_action translate="label comment">
373
  <label>Cancel pending reservations</label>
374
  <frontend_type>select</frontend_type>
375
+ <depends><show_advanced_options>1</show_advanced_options></depends>
376
  <source_model>adminhtml/system_config_source_yesno</source_model>
377
+ <sort_order>510</sort_order>
378
  <show_in_default>1</show_in_default>
379
  <show_in_store>1</show_in_store>
380
  <show_in_website>1</show_in_website>
381
  <comment>Automatically cancel orders when the reservation becomes pending</comment>
382
  </pending_status_action>
383
+ <allow_part_capture_with_discount translate="label comment">
384
+ <label>Allow part capture when orders have discount</label>
385
+ <frontend_type>select</frontend_type>
386
+ <depends><show_advanced_options>1</show_advanced_options></depends>
387
+ <source_model>adminhtml/system_config_source_yesno</source_model>
388
+ <sort_order>515</sort_order>
389
+ <show_in_default>1</show_in_default>
390
+ <show_in_store>1</show_in_store>
391
+ <show_in_website>1</show_in_website>
392
+ <comment>Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.</comment>
393
+ </allow_part_capture_with_discount>
394
  <send_klarna_email translate="label comment">
395
  <label>Send invoice via e-mail</label>
396
  <frontend_type>select</frontend_type>
397
+ <depends><show_advanced_options>1</show_advanced_options></depends>
398
  <source_model>adminhtml/system_config_source_yesno</source_model>
399
+ <sort_order>520</sort_order>
400
  <show_in_default>1</show_in_default>
401
  <show_in_store>1</show_in_store>
402
  <show_in_website>1</show_in_website>
405
  <allow_separate_address translate="label comment">
406
  <label>Allow separate addresses</label>
407
  <frontend_type>select</frontend_type>
408
+ <depends><show_advanced_options>1</show_advanced_options></depends>
409
  <source_model>adminhtml/system_config_source_yesno</source_model>
410
+ <sort_order>530</sort_order>
411
  <show_in_default>1</show_in_default>
412
  <show_in_store>1</show_in_store>
413
  <show_in_website>1</show_in_website>
416
  <disable_company_purchase translate="label comment">
417
  <label>Disable method for company purchase</label>
418
  <frontend_type>select</frontend_type>
419
+ <depends><show_advanced_options>1</show_advanced_options></depends>
420
  <source_model>adminhtml/system_config_source_yesno</source_model>
421
+ <sort_order>540</sort_order>
422
  <show_in_default>1</show_in_default>
423
  <show_in_store>1</show_in_store>
424
  <show_in_website>1</show_in_website>
427
  <disable_backend_calls translate="label comment">
428
  <label>Disable Klarna Backend</label>
429
  <frontend_type>select</frontend_type>
430
+ <depends><show_advanced_options>1</show_advanced_options></depends>
431
  <source_model>adminhtml/system_config_source_yesno</source_model>
432
+ <sort_order>550</sort_order>
433
  <show_in_default>1</show_in_default>
434
  <show_in_store>1</show_in_store>
435
  <show_in_website>1</show_in_website>
438
  <show_extended_error_message translate="label comment tooltip">
439
  <label>Show Extended Error Message</label>
440
  <frontend_type>select</frontend_type>
441
+ <depends><show_advanced_options>1</show_advanced_options></depends>
442
  <source_model>adminhtml/system_config_source_yesno</source_model>
443
+ <sort_order>560</sort_order>
444
  <show_in_default>1</show_in_default>
445
  <show_in_store>1</show_in_store>
446
  <show_in_website>1</show_in_website>
447
  <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
448
  <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
449
  </show_extended_error_message>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  <allowspecific translate="label">
451
  <label>Allowed countries</label>
452
  <frontend_type>allowspecific</frontend_type>
453
+ <depends><show_advanced_options>1</show_advanced_options></depends>
454
+ <sort_order>570</sort_order>
455
  <source_model>klarna/source_allspecificcountries</source_model>
456
  <show_in_default>1</show_in_default>
457
  <show_in_website>1</show_in_website>
458
  <show_in_store>1</show_in_store>
459
+ <comment>Klarna supports one country per store</comment>
460
  </allowspecific>
461
  <specificcountry translate="label">
462
  <label>Specific countries</label>
463
  <frontend_type>multiselect</frontend_type>
464
+ <depends><show_advanced_options>1</show_advanced_options></depends>
465
+ <sort_order>575</sort_order>
466
  <source_model>klarna/source_country</source_model>
467
  <show_in_default>1</show_in_default>
468
  <show_in_website>1</show_in_website>
469
  <show_in_store>1</show_in_store>
470
+ <comment>Klarna supports one country per store</comment>
471
  </specificcountry>
 
 
 
 
 
 
 
 
472
  </fields>
473
  </vaimo_klarna_account>
474
  <vaimo_klarna_special translate="label" module="klarna">
532
  <show_in_store>1</show_in_store>
533
  <show_in_website>1</show_in_website>
534
  </order_status>
535
+ <terms_url translate="label comment">
536
+ <label>URL to terms and conditions</label>
537
+ <frontend_type>text</frontend_type>
538
+ <sort_order>100</sort_order>
539
+ <show_in_default>1</show_in_default>
540
+ <show_in_store>1</show_in_store>
541
+ <show_in_website>1</show_in_website>
542
+ <comment>URL to this stores own terms and conditions (only used in Germany and Austria)</comment>
543
+ </terms_url>
544
+ <cdn_logotype_override translate="label comment">
545
+ <label>URL to special logotype</label>
546
+ <frontend_type>text</frontend_type>
547
+ <sort_order>110</sort_order>
548
+ <show_in_default>1</show_in_default>
549
+ <show_in_store>1</show_in_store>
550
+ <show_in_website>1</show_in_website>
551
+ <comment>Special campaign methods have various logotypes depending on campaign, this is a way to choose a logotype from Klarna</comment>
552
+ </cdn_logotype_override>
553
+ <!--
554
+ <cdn_terms_override translate="label">
555
+ <label>URL to terms</label>
556
+ <frontend_type>text</frontend_type>
557
+ <sort_order>120</sort_order>
558
+ <show_in_default>1</show_in_default>
559
+ <show_in_store>1</show_in_store>
560
+ <show_in_website>1</show_in_website>
561
+ </cdn_terms_override>
562
+ -->
563
+ <klarna_language translate="label">
564
+ <label>Language</label>
565
+ <frontend_type>select</frontend_type>
566
+ <source_model>klarna/source_language</source_model>
567
+ <sort_order>130</sort_order>
568
+ <show_in_default>1</show_in_default>
569
+ <show_in_store>1</show_in_store>
570
+ <show_in_website>1</show_in_website>
571
+ </klarna_language>
572
+ <sort_order translate="label">
573
+ <label>Sort order</label>
574
+ <frontend_type>text</frontend_type>
575
+ <sort_order>140</sort_order>
576
+ <show_in_default>1</show_in_default>
577
+ <show_in_website>1</show_in_website>
578
+ <show_in_store>1</show_in_store>
579
+ </sort_order>
580
+ <show_advanced_options translate="label comment">
581
+ <label>Show advanced options</label>
582
+ <frontend_type>select</frontend_type>
583
+ <source_model>adminhtml/system_config_source_yesno</source_model>
584
+ <sort_order>500</sort_order>
585
+ <show_in_default>1</show_in_default>
586
+ <show_in_store>1</show_in_store>
587
+ <show_in_website>1</show_in_website>
588
+ <comment>Display advanced or seldomly used settings</comment>
589
+ </show_advanced_options>
590
  <pending_status_action translate="label comment">
591
  <label>Cancel pending reservations</label>
592
  <frontend_type>select</frontend_type>
593
+ <depends><show_advanced_options>1</show_advanced_options></depends>
594
  <source_model>adminhtml/system_config_source_yesno</source_model>
595
+ <sort_order>510</sort_order>
596
  <show_in_default>1</show_in_default>
597
  <show_in_store>1</show_in_store>
598
  <show_in_website>1</show_in_website>
599
  <comment>Automatically cancel orders when the reservation becomes pending</comment>
600
  </pending_status_action>
601
+ <allow_part_capture_with_discount translate="label comment">
602
+ <label>Allow part capture when orders have discount</label>
603
+ <frontend_type>select</frontend_type>
604
+ <depends><show_advanced_options>1</show_advanced_options></depends>
605
+ <source_model>adminhtml/system_config_source_yesno</source_model>
606
+ <sort_order>515</sort_order>
607
+ <show_in_default>1</show_in_default>
608
+ <show_in_store>1</show_in_store>
609
+ <show_in_website>1</show_in_website>
610
+ <comment>Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.</comment>
611
+ </allow_part_capture_with_discount>
612
  <send_klarna_email translate="label comment">
613
  <label>Send invoice via e-mail</label>
614
  <frontend_type>select</frontend_type>
615
+ <depends><show_advanced_options>1</show_advanced_options></depends>
616
  <source_model>adminhtml/system_config_source_yesno</source_model>
617
+ <sort_order>520</sort_order>
618
  <show_in_default>1</show_in_default>
619
  <show_in_store>1</show_in_store>
620
  <show_in_website>1</show_in_website>
623
  <allow_separate_address translate="label comment">
624
  <label>Allow separate addresses</label>
625
  <frontend_type>select</frontend_type>
626
+ <depends><show_advanced_options>1</show_advanced_options></depends>
627
  <source_model>adminhtml/system_config_source_yesno</source_model>
628
+ <sort_order>530</sort_order>
629
  <show_in_default>1</show_in_default>
630
  <show_in_store>1</show_in_store>
631
  <show_in_website>1</show_in_website>
634
  <disable_company_purchase translate="label comment">
635
  <label>Disable method for company purchase</label>
636
  <frontend_type>select</frontend_type>
637
+ <depends><show_advanced_options>1</show_advanced_options></depends>
638
  <source_model>adminhtml/system_config_source_yesno</source_model>
639
+ <sort_order>540</sort_order>
640
  <show_in_default>1</show_in_default>
641
  <show_in_store>1</show_in_store>
642
  <show_in_website>1</show_in_website>
645
  <disable_backend_calls translate="label comment">
646
  <label>Disable Klarna Backend</label>
647
  <frontend_type>select</frontend_type>
648
+ <depends><show_advanced_options>1</show_advanced_options></depends>
649
  <source_model>adminhtml/system_config_source_yesno</source_model>
650
+ <sort_order>550</sort_order>
651
  <show_in_default>1</show_in_default>
652
  <show_in_store>1</show_in_store>
653
  <show_in_website>1</show_in_website>
656
  <show_extended_error_message translate="label comment tooltip">
657
  <label>Show Extended Error Message</label>
658
  <frontend_type>select</frontend_type>
659
+ <depends><show_advanced_options>1</show_advanced_options></depends>
660
  <source_model>adminhtml/system_config_source_yesno</source_model>
661
+ <sort_order>560</sort_order>
662
  <show_in_default>1</show_in_default>
663
  <show_in_store>1</show_in_store>
664
  <show_in_website>1</show_in_website>
665
  <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
666
  <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
667
  </show_extended_error_message>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
  <allowspecific translate="label">
669
  <label>Allowed countries</label>
670
  <frontend_type>allowspecific</frontend_type>
671
+ <depends><show_advanced_options>1</show_advanced_options></depends>
672
+ <sort_order>570</sort_order>
673
  <source_model>klarna/source_allspecificcountries</source_model>
674
  <show_in_default>1</show_in_default>
675
  <show_in_website>1</show_in_website>
676
  <show_in_store>1</show_in_store>
677
+ <comment>Klarna supports one country per store</comment>
678
  </allowspecific>
679
  <specificcountry translate="label">
680
  <label>Specific countries</label>
681
  <frontend_type>multiselect</frontend_type>
682
+ <depends><show_advanced_options>1</show_advanced_options></depends>
683
+ <sort_order>580</sort_order>
684
  <source_model>klarna/source_country</source_model>
685
  <show_in_default>1</show_in_default>
686
  <show_in_website>1</show_in_website>
687
  <show_in_store>1</show_in_store>
688
+ <comment>Klarna supports one country per store</comment>
689
  </specificcountry>
 
 
 
 
 
 
 
 
690
  </fields>
691
  </vaimo_klarna_special>
692
  <vaimo_klarna_checkout translate="label" module="klarna">
742
  <show_in_store>1</show_in_store>
743
  <comment>Choose what server to make calls to</comment>
744
  </host>
 
 
 
 
 
 
 
 
 
 
745
  <order_status translate="label">
746
  <label>New order status</label>
747
  <frontend_type>select</frontend_type>
751
  <show_in_website>1</show_in_website>
752
  <show_in_store>0</show_in_store>
753
  </order_status>
754
+ <create_order_on_success translate="label comment">
755
+ <label>Create order on Success</label>
756
  <frontend_type>select</frontend_type>
757
  <source_model>adminhtml/system_config_source_yesno</source_model>
758
+ <sort_order>100</sort_order>
759
  <show_in_default>1</show_in_default>
760
+ <show_in_website>1</show_in_website>
761
  <show_in_store>1</show_in_store>
762
+ <comment>Create pending order on Success and only update it when completed (will work together with creating it on Validate).</comment>
763
+ </create_order_on_success>
764
+ <terms_url translate="label comment">
765
+ <label>URL to terms and conditions</label>
766
+ <frontend_type>text</frontend_type>
767
+ <sort_order>110</sort_order>
768
+ <show_in_default>1</show_in_default>
769
  <show_in_website>1</show_in_website>
770
+ <show_in_store>1</show_in_store>
771
+ <comment>URL to this stores own terms and conditions</comment>
772
+ </terms_url>
773
+ <klarna_language translate="label comment">
774
+ <label>Language</label>
775
+ <frontend_type>select</frontend_type>
776
+ <source_model>klarna/source_language</source_model>
777
+ <sort_order>120</sort_order>
778
+ <show_in_default>1</show_in_default>
779
+ <show_in_store>1</show_in_store>
780
+ <show_in_website>1</show_in_website>
781
+ <comment>Can be used if site is in a different language than the official language of current country</comment>
782
+ </klarna_language>
783
+ <klarna_layout translate="label">
784
+ <label>Layout</label>
785
+ <frontend_type>select</frontend_type>
786
+ <source_model>klarna/source_klarnalayout</source_model>
787
+ <sort_order>130</sort_order>
788
+ <show_in_default>1</show_in_default>
789
+ <show_in_website>1</show_in_website>
790
+ <show_in_store>1</show_in_store>
791
+ </klarna_layout>
792
+ <show_login_form translate="label comment">
793
+ <label>Show login form</label>
794
+ <frontend_type>select</frontend_type>
795
+ <source_model>adminhtml/system_config_source_yesno</source_model>
796
+ <sort_order>140</sort_order>
797
+ <show_in_default>1</show_in_default>
798
+ <show_in_website>1</show_in_website>
799
+ <show_in_store>1</show_in_store>
800
+ <comment>Only for 2 column layout</comment>
801
+ </show_login_form>
802
+ <enable_cart_above_kco translate="label">
803
+ <label>Enable cart in checkout page</label>
804
+ <frontend_type>select</frontend_type>
805
+ <source_model>adminhtml/system_config_source_yesno</source_model>
806
+ <sort_order>150</sort_order>
807
+ <show_in_default>1</show_in_default>
808
+ <show_in_website>1</show_in_website>
809
+ <show_in_store>1</show_in_store>
810
+ </enable_cart_above_kco>
811
+ <enable_auto_focus translate="label">
812
+ <label>Enable Autofocus for Klarna Checkout</label>
813
+ <frontend_type>select</frontend_type>
814
+ <source_model>adminhtml/system_config_source_yesno</source_model>
815
+ <sort_order>160</sort_order>
816
+ <show_in_default>1</show_in_default>
817
+ <show_in_website>1</show_in_website>
818
+ <show_in_store>1</show_in_store>
819
+ </enable_auto_focus>
820
  <disable_product_widget translate="label comment">
821
  <label>Disable payment widget on product page</label>
822
  <frontend_type>select</frontend_type>
823
  <source_model>adminhtml/system_config_source_yesno</source_model>
824
+ <sort_order>170</sort_order>
825
  <show_in_default>1</show_in_default>
826
  <show_in_website>1</show_in_website>
827
  <show_in_store>1</show_in_store>
828
  <comment>If set to yes, the payment information from Klarna will not appear on the product page</comment>
829
  </disable_product_widget>
830
+ <show_advanced_options translate="label comment">
831
+ <label>Show advanced options</label>
832
  <frontend_type>select</frontend_type>
833
  <source_model>adminhtml/system_config_source_yesno</source_model>
834
+ <sort_order>500</sort_order>
835
  <show_in_default>1</show_in_default>
836
  <show_in_store>1</show_in_store>
837
  <show_in_website>1</show_in_website>
838
+ <comment>Display advanced or seldomly used settings</comment>
839
+ </show_advanced_options>
 
 
 
 
 
 
 
 
 
 
840
  <cart_redirect translate="label comment">
841
  <label>Cart redirect</label>
842
  <frontend_type>text</frontend_type>
843
+ <depends><show_advanced_options>1</show_advanced_options></depends>
844
+ <sort_order>505</sort_order>
845
  <show_in_default>1</show_in_default>
846
  <show_in_store>1</show_in_store>
847
  <show_in_website>1</show_in_website>
848
  <comment>Default is cart, custom redirect must not go to any checkout page</comment>
849
  </cart_redirect>
850
+ <auto_prefil translate="label comment">
851
+ <label>Auto prefill known Klarna details</label>
852
  <frontend_type>select</frontend_type>
853
+ <depends><show_advanced_options>1</show_advanced_options></depends>
854
+ <source_model>adminhtml/system_config_source_yesno</source_model>
855
+ <sort_order>510</sort_order>
856
  <show_in_default>1</show_in_default>
857
  <show_in_website>1</show_in_website>
858
  <show_in_store>1</show_in_store>
859
+ <comment>When activated, it will use the logged in customer details to prefill the Klarna Checkout form</comment>
860
+ </auto_prefil>
861
+ <disable_backend_calls translate="label comment">
862
+ <label>Disable Klarna Backend</label>
863
  <frontend_type>select</frontend_type>
864
+ <depends><show_advanced_options>1</show_advanced_options></depends>
865
+ <source_model>adminhtml/system_config_source_yesno</source_model>
866
+ <sort_order>520</sort_order>
867
  <show_in_default>1</show_in_default>
868
  <show_in_store>1</show_in_store>
869
  <show_in_website>1</show_in_website>
870
+ <comment>Disable all calls to Klarna from Admin, such as Capture, Credit and Cancel. This feature can be used if those functions are maintained by an external system</comment>
871
+ </disable_backend_calls>
872
+ <show_extended_error_message translate="label comment tooltip">
873
+ <label>Show Extended Error Message</label>
874
  <frontend_type>select</frontend_type>
875
+ <depends><show_advanced_options>1</show_advanced_options></depends>
876
  <source_model>adminhtml/system_config_source_yesno</source_model>
877
+ <sort_order>530</sort_order>
878
  <show_in_default>1</show_in_default>
 
879
  <show_in_store>1</show_in_store>
880
+ <show_in_website>1</show_in_website>
881
+ <comment><![CDATA["Yes" - show error messages provided by Klarna. "No" - show default error message]]></comment>
882
+ <tooltip><![CDATA[Show extended error message in case if authorization was failed]]></tooltip>
883
+ </show_extended_error_message>
884
  <extra_order_attribute translate="label comment">
885
  <label>Extra order ID attribute</label>
886
  <frontend_type>text</frontend_type>
887
+ <depends><show_advanced_options>1</show_advanced_options></depends>
888
+ <sort_order>540</sort_order>
889
  <show_in_default>1</show_in_default>
890
  <show_in_website>1</show_in_website>
891
  <show_in_store>1</show_in_store>
894
  <allow_separate_address translate="label comment">
895
  <label>Allow separate addresses</label>
896
  <frontend_type>select</frontend_type>
897
+ <depends><show_advanced_options>1</show_advanced_options></depends>
898
  <source_model>klarna/source_yesnodefault</source_model>
899
+ <sort_order>550</sort_order>
900
  <show_in_default>1</show_in_default>
901
  <show_in_store>1</show_in_store>
902
  <show_in_website>1</show_in_website>
903
  <comment>Allow shipping address to be different from billing address. You might need acceptance from Klarna if activated</comment>
904
  </allow_separate_address>
905
+ <allow_part_capture_with_discount translate="label comment">
906
+ <label>Allow part capture when orders have discount</label>
907
+ <frontend_type>select</frontend_type>
908
+ <depends><show_advanced_options>1</show_advanced_options></depends>
909
+ <source_model>adminhtml/system_config_source_yesno</source_model>
910
+ <sort_order>515</sort_order>
911
+ <show_in_default>1</show_in_default>
912
+ <show_in_store>1</show_in_store>
913
+ <show_in_website>1</show_in_website>
914
+ <comment>Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.</comment>
915
+ </allow_part_capture_with_discount>
916
  <force_phonenumber translate="label">
917
  <label>Force entry of phonenumber</label>
918
  <frontend_type>select</frontend_type>
919
+ <depends><show_advanced_options>1</show_advanced_options></depends>
920
  <source_model>adminhtml/system_config_source_yesno</source_model>
921
+ <sort_order>560</sort_order>
922
  <show_in_default>1</show_in_default>
923
  <show_in_website>1</show_in_website>
924
  <show_in_store>1</show_in_store>
926
  <packstation_enabled translate="label comment">
927
  <label>Enable DHL Packstation</label>
928
  <frontend_type>select</frontend_type>
929
+ <depends><show_advanced_options>1</show_advanced_options></depends>
930
  <source_model>adminhtml/system_config_source_yesno</source_model>
931
+ <sort_order>570</sort_order>
932
  <show_in_default>1</show_in_default>
933
  <show_in_website>1</show_in_website>
934
  <show_in_store>1</show_in_store>
935
  <comment>Only available in Germany</comment>
936
  </packstation_enabled>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
937
  <enable_trigger_changed_js translate="label">
938
  <label>Enable javascript trigger for address update</label>
939
  <frontend_type>select</frontend_type>
940
+ <depends><show_advanced_options>1</show_advanced_options></depends>
941
  <source_model>adminhtml/system_config_source_yesno</source_model>
942
+ <sort_order>580</sort_order>
943
  <show_in_default>1</show_in_default>
944
  <show_in_website>1</show_in_website>
945
  <show_in_store>1</show_in_store>
947
  <auto_register_guest translate="label comment">
948
  <label>Automatically register guests on checkout</label>
949
  <frontend_type>select</frontend_type>
950
+ <depends><show_advanced_options>1</show_advanced_options></depends>
951
  <source_model>adminhtml/system_config_source_yesno</source_model>
952
+ <sort_order>590</sort_order>
953
  <show_in_default>1</show_in_default>
954
  <show_in_store>1</show_in_store>
955
  <show_in_website>1</show_in_website>
956
  <comment>If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.</comment>
957
  </auto_register_guest>
 
 
 
 
 
 
 
 
 
 
958
  <user_defined_json translate="label comment">
959
  <label>User Defined Variables</label>
960
  <backend_model>klarna/adminhtml_system_config_backend_admin_json</backend_model>
961
  <frontend_type>textarea</frontend_type>
962
+ <depends><show_advanced_options>1</show_advanced_options></depends>
963
+ <sort_order>599</sort_order>
964
  <show_in_default>1</show_in_default>
965
  <show_in_website>1</show_in_website>
966
  <show_in_store>1</show_in_store>
1270
  </calculation>
1271
  </groups>
1272
  </tax>
1273
+ <dev>
1274
+ <groups>
1275
+ <vaimo_klarna_debug translate="label">
1276
+ <label>Klarna Debug</label>
1277
+ <frontend_type>text</frontend_type>
1278
+ <sort_order>999</sort_order>
1279
+ <show_in_default>1</show_in_default>
1280
+ <show_in_website>0</show_in_website>
1281
+ <show_in_store>0</show_in_store>
1282
+ <fields>
1283
+ <vaimo_klarna_log_level translate="label">
1284
+ <label>Log Level</label>
1285
+ <frontend_type>select</frontend_type>
1286
+ <source_model>klarna/source_loglevel</source_model>
1287
+ <sort_order>10</sort_order>
1288
+ <show_in_default>1</show_in_default>
1289
+ <show_in_website>0</show_in_website>
1290
+ <show_in_store>0</show_in_store>
1291
+ <comment>
1292
+ Log information is now logged to database, instead of file. Only klarnaerror.log still exists as a file. The database logs are automatically cleaned. Moderate means that selected exceptions are logged only to DB and no parameters or additional information is added to each log item. Minimal means that selected exceptions are not logged at all plus no debug type logs are made
1293
+ </comment>
1294
+ </vaimo_klarna_log_level>
1295
+ </fields>
1296
+ </vaimo_klarna_debug>
1297
+ </groups>
1298
+ </dev>
1299
  </sections>
1300
  </config>
app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.3.4-5.3.5.php CHANGED
@@ -27,7 +27,7 @@
27
  $installer = Mage::getResourceModel('sales/setup', 'sales_setup');
28
 
29
  $installer->startSetup();
30
-
31
  $table = $installer->getConnection()
32
  ->newTable($installer->getTable('klarna/pushqueue'))
33
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
@@ -47,5 +47,5 @@ $table = $installer->getConnection()
47
  ->setComment('Klarna Push Queue');
48
 
49
  $installer->getConnection()->createTable($table);
50
-
51
  $installer->endSetup();
27
  $installer = Mage::getResourceModel('sales/setup', 'sales_setup');
28
 
29
  $installer->startSetup();
30
+ /* Table removed from config, will no longer be used, so remove it from this old setup script
31
  $table = $installer->getConnection()
32
  ->newTable($installer->getTable('klarna/pushqueue'))
33
  ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
47
  ->setComment('Klarna Push Queue');
48
 
49
  $installer->getConnection()->createTable($table);
50
+ */
51
  $installer->endSetup();
app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.3.63-5.3.64.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $connection = $installer->getConnection();
7
+
8
+ $table = $installer->getConnection()
9
+ ->newTable($installer->getTable('klarna/klarnacheckout_semaphore'))
10
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
11
+ 'identity' => true,
12
+ 'unsigned' => true,
13
+ 'nullable' => false,
14
+ 'primary' => true,
15
+ ), 'Id')
16
+ ->addColumn('klarna_checkout_id', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(), 'Klarna Checkout Id')
17
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 40, array(), 'Status of semaphore')
18
+ ->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
19
+ 'unsigned' => true,
20
+ 'nullable' => false,
21
+ ), 'Quote ID')
22
+ ->addColumn('timestamp', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
23
+ 'unsigned' => true,
24
+ 'nullable' => false,
25
+ ), 'Semaphore Timestamp')
26
+ ->addColumn('retry_attempts', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
27
+ 'nullable' => false,
28
+ ), 'Retry attempts')
29
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
30
+ 'nullable' => false,
31
+ ), 'Created At')
32
+ ->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Possible error message')
33
+ ->addIndex(
34
+ 'UNQ_KLARNA_KLARNACHECKOUT_SEMAPHORE_ID',
35
+ array('klarna_checkout_id', 'status'),
36
+ array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
37
+ )
38
+ ->setComment('Klarna Semaphore');
39
+
40
+ $installer->getConnection()->createTable($table);
41
+ $table = $installer->getConnection()
42
+ ->newTable($installer->getTable('klarna/klarnacheckout_history'))
43
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
44
+ 'identity' => true,
45
+ 'unsigned' => true,
46
+ 'nullable' => false,
47
+ 'primary' => true,
48
+ ), 'Id')
49
+ ->addColumn('klarna_checkout_id', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(), 'Klarna Checkout Id')
50
+ ->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
51
+ 'nullable' => false,
52
+ ), 'Quote ID')
53
+ ->addColumn('reservation_id', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Reservation ID for non Rest API')
54
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
55
+ 'nullable' => false,
56
+ ), 'Order ID')
57
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
58
+ 'nullable' => false,
59
+ ), 'Created At')
60
+ ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
61
+ 'nullable' => false,
62
+ ), 'Updated At')
63
+ ->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Information')
64
+ ->setComment('Klarna History');
65
+
66
+ $installer->getConnection()->createTable($table);
67
+
68
+ $installer->endSetup();
app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.3.64-5.3.65.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2009-2016 Vaimo AB
4
+ *
5
+ * Vaimo reserves all rights in the Program as delivered. The Program
6
+ * or any portion thereof may not be reproduced in any form whatsoever without
7
+ * the written consent of Vaimo, except as provided by licence. A licence
8
+ * under Vaimo's rights in the Program may be available directly from
9
+ * Vaimo.
10
+ *
11
+ * Disclaimer:
12
+ * THIS NOTICE MAY NOT BE REMOVED FROM THE PROGRAM BY ANY USER THEREOF.
13
+ * THE PROGRAM IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE PROGRAM OR THE USE OR OTHER DEALINGS
19
+ * IN THE PROGRAM.
20
+ *
21
+ * @category Vaimo
22
+ * @package Vaimo_Klarna
23
+ * @copyright Copyright (c) 2009-2016 Vaimo AB
24
+ */
25
+
26
+ /** @var $installer Mage_Sales_Model_Resource_Setup */
27
+ $installer = Mage::getResourceModel('sales/setup', 'sales_setup');
28
+
29
+ $installer->startSetup();
30
+
31
+ $table = $installer->getConnection()
32
+ ->newTable($installer->getTable('klarna/log'))
33
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
34
+ 'identity' => true,
35
+ 'unsigned' => true,
36
+ 'nullable' => false,
37
+ 'primary' => true,
38
+ ), 'Id')
39
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
40
+ 'nullable' => false,
41
+ ), 'Created At')
42
+ ->addColumn('process', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
43
+ 'nullable' => false,
44
+ ), 'Process ID')
45
+ ->addColumn('tag', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Tag')
46
+ ->addColumn('function', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Function')
47
+ ->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(), 'Logging message')
48
+ ->addIndex($installer->getIdxName('klarna/log', array('created_at')),
49
+ array('created_at'))
50
+ ->setComment('Klarna Log');
51
+
52
+ $installer->getConnection()->createTable($table);
53
+
54
+ $table = $installer->getConnection()
55
+ ->newTable($installer->getTable('klarna/log_data'))
56
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
57
+ 'identity' => true,
58
+ 'unsigned' => true,
59
+ 'nullable' => false,
60
+ 'primary' => true,
61
+ ), 'Id')
62
+ ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
63
+ 'nullable' => false,
64
+ ), 'Created At')
65
+ ->addColumn('parent', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
66
+ 'nullable' => false,
67
+ ), 'Parent in klarna/log')
68
+ ->addColumn('extra', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(), 'Additional Data')
69
+ ->addIndex($installer->getIdxName('klarna/log_data', array('created_at')),
70
+ array('created_at'))
71
+ ->addForeignKey($installer->getFkName('klarna/log_data', 'parent', 'klarna/log', 'entity_id'),
72
+ 'parent', $installer->getTable('klarna/log'), 'entity_id',
73
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
74
+ ->setComment('Klarna Log Additional Data');
75
+
76
+ $installer->getConnection()->createTable($table);
77
+
78
+ $installer->endSetup();
app/code/community/Vaimo/Klarna/sql/klarna_setup/mysql4-upgrade-5.4.10-5.4.11.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $connection = $installer->getConnection();
7
+
8
+ $table = $installer->getTable('sales_flat_order');
9
+ $connection->addColumn($table, 'vaimo_klarna_fee',
10
+ array(
11
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
12
+ 'length' => '12,4',
13
+ 'unsigned' => true,
14
+ 'nullable' => true,
15
+ 'default' => NULL,
16
+ 'comment' => 'Klarna Payment Fee'
17
+ )
18
+ );
19
+
20
+ $connection->addColumn($table, 'vaimo_klarna_fee_tax',
21
+ array(
22
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
23
+ 'length' => '12,4',
24
+ 'unsigned' => true,
25
+ 'nullable' => true,
26
+ 'default' => NULL,
27
+ 'comment' => 'Klarna Payment Fee Tax'
28
+ )
29
+ );
30
+
31
+ $connection->addColumn($table, 'vaimo_klarna_base_fee',
32
+ array(
33
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
34
+ 'length' => '12,4',
35
+ 'unsigned' => true,
36
+ 'nullable' => true,
37
+ 'default' => NULL,
38
+ 'comment' => 'Base Klarna Payment Fee'
39
+ )
40
+ );
41
+
42
+ $connection->addColumn($table, 'vaimo_klarna_base_fee_tax',
43
+ array(
44
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
45
+ 'length' => '12,4',
46
+ 'unsigned' => true,
47
+ 'nullable' => true,
48
+ 'default' => NULL,
49
+ 'comment' => 'Base Klarna Payment Fee Tax'
50
+ )
51
+ );
52
+
53
+ $table = $installer->getTable('sales_flat_invoice');
54
+ $connection->addColumn($table, 'vaimo_klarna_fee',
55
+ array(
56
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
57
+ 'length' => '12,4',
58
+ 'unsigned' => true,
59
+ 'nullable' => true,
60
+ 'default' => NULL,
61
+ 'comment' => 'Klarna Payment Fee'
62
+ )
63
+ );
64
+
65
+ $connection->addColumn($table, 'vaimo_klarna_fee_tax',
66
+ array(
67
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
68
+ 'length' => '12,4',
69
+ 'unsigned' => true,
70
+ 'nullable' => true,
71
+ 'default' => NULL,
72
+ 'comment' => 'Klarna Payment Fee Tax'
73
+ )
74
+ );
75
+
76
+ $connection->addColumn($table, 'vaimo_klarna_base_fee',
77
+ array(
78
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
79
+ 'length' => '12,4',
80
+ 'unsigned' => true,
81
+ 'nullable' => true,
82
+ 'default' => NULL,
83
+ 'comment' => 'Base Klarna Payment Fee'
84
+ )
85
+ );
86
+
87
+ $connection->addColumn($table, 'vaimo_klarna_base_fee_tax',
88
+ array(
89
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
90
+ 'length' => '12,4',
91
+ 'unsigned' => true,
92
+ 'nullable' => true,
93
+ 'default' => NULL,
94
+ 'comment' => 'Base Klarna Payment Fee Tax'
95
+ )
96
+ );
97
+
98
+ $table = $installer->getTable('sales_flat_quote');
99
+ $connection->addColumn($table, 'vaimo_klarna_fee',
100
+ array(
101
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
102
+ 'length' => '12,4',
103
+ 'unsigned' => true,
104
+ 'nullable' => true,
105
+ 'default' => NULL,
106
+ 'comment' => 'Klarna Payment Fee'
107
+ )
108
+ );
109
+
110
+ $connection->addColumn($table, 'vaimo_klarna_fee_tax',
111
+ array(
112
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
113
+ 'length' => '12,4',
114
+ 'unsigned' => true,
115
+ 'nullable' => true,
116
+ 'default' => NULL,
117
+ 'comment' => 'Klarna Payment Fee Tax'
118
+ )
119
+ );
120
+
121
+ $connection->addColumn($table, 'vaimo_klarna_base_fee',
122
+ array(
123
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
124
+ 'length' => '12,4',
125
+ 'unsigned' => true,
126
+ 'nullable' => true,
127
+ 'default' => NULL,
128
+ 'comment' => 'Base Klarna Payment Fee'
129
+ )
130
+ );
131
+
132
+ $connection->addColumn($table, 'vaimo_klarna_base_fee_tax',
133
+ array(
134
+ 'type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,
135
+ 'length' => '12,4',
136
+ 'unsigned' => true,
137
+ 'nullable' => true,
138
+ 'default' => NULL,
139
+ 'comment' => 'Base Klarna Payment Fee Tax'
140
+ )
141
+ );
142
+
143
+
144
+ $table = $installer->getTable('vaimo_klarna_log');
145
+ $connection->addColumn($table, 'extra',
146
+ array(
147
+ 'type'=>Varien_Db_Ddl_Table::TYPE_TEXT,
148
+ 'nullable' => true,
149
+ 'length' => '64k',
150
+ 'default' => NULL,
151
+ 'comment' => 'Additional Data'
152
+ )
153
+ );
154
+
155
+ $installer->endSetup();
app/design/frontend/base/default/template/vaimo/klarna/form/address/search.phtml CHANGED
@@ -67,12 +67,6 @@ $limit_for_radiobuttons = 2; // When you have more addresses than this, create d
67
  </li>
68
  <?php endforeach; ?>
69
 
70
- <?php if ($this->shippingSameAsBilling()): ?>
71
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that both shipping and billing address will be updated to this address when you place your order'); ?></li>
72
- <?php else: ?>
73
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that shipping address will be updated to this address when you place your order'); ?></li>
74
- <?php endif; ?>
75
-
76
  <?php
77
  /*
78
  *
@@ -158,13 +152,6 @@ $limit_for_radiobuttons = 2; // When you have more addresses than this, create d
158
  <?php endforeach; ?>
159
  </select>
160
 
161
- <?php if ($this->shippingSameAsBilling()): ?>
162
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that both shipping and billing address will be updated to this address when you place your order'); ?></li>
163
- <?php else: ?>
164
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that shipping address will be updated to this address when you place your order'); ?></li>
165
- <?php endif; ?>
166
-
167
-
168
  <?php endif; ?>
169
 
170
  </ul>
67
  </li>
68
  <?php endforeach; ?>
69
 
 
 
 
 
 
 
70
  <?php
71
  /*
72
  *
152
  <?php endforeach; ?>
153
  </select>
154
 
 
 
 
 
 
 
 
155
  <?php endif; ?>
156
 
157
  </ul>
app/design/frontend/base/default/template/vaimo/klarna/form/children/addressresult.phtml CHANGED
@@ -24,6 +24,12 @@
24
  */
25
 
26
  ?>
 
 
 
 
 
 
27
  <?php if ($this->needDateOfBirth()==false): ?>
28
  <?php if ($this->needAddressSearch()): ?>
29
 
@@ -32,22 +38,32 @@
32
  <span id="<?php echo $this->getMethodCode(); ?>_update_address_message" class="klarna_msg_txt"></span>
33
  </li>
34
 
 
 
 
 
 
 
35
  <?php else: ?>
36
 
37
- <?php if ($this->shippingSameAsBilling()): ?>
38
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that your official address will be used for shipping and billing address when you place your order'); ?></li>
39
  <?php else: ?>
40
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that your official address will be used for shipping and billing address when you place your order'); ?></li>
 
 
41
  <?php endif; ?>
42
 
43
  <?php endif; ?>
44
 
45
  <?php else: ?>
46
 
47
- <?php if ($this->shippingSameAsBilling()): ?>
48
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that your official address will be used for shipping and billing address when you place your order'); ?></li>
49
  <?php else: ?>
50
- <li class="klarna_notification"><?php echo Mage::helper('klarna')->__('Please note that your official address will be used for shipping and billing address when you place your order'); ?></li>
 
 
51
  <?php endif; ?>
52
 
53
  <?php endif; ?>
24
  */
25
 
26
  ?>
27
+ <?php if ($this->addressesAreTheSame()): ?>
28
+ <?php $extraClassStr = ''; ?>
29
+ <?php else: ?>
30
+ <?php $extraClassStr = ' error'; ?>
31
+ <?php endif; ?>
32
+
33
  <?php if ($this->needDateOfBirth()==false): ?>
34
  <?php if ($this->needAddressSearch()): ?>
35
 
38
  <span id="<?php echo $this->getMethodCode(); ?>_update_address_message" class="klarna_msg_txt"></span>
39
  </li>
40
 
41
+ <?php if ($this->shippingSameAsBilling()): ?>
42
+ <li class="klarna_notification<?php echo $extraClassStr; ?>"><?php echo Mage::helper('klarna')->__('Please note that your official address will be used for shipping and billing address when you place your order'); ?></li>
43
+ <?php else: ?>
44
+ <li class="klarna_notification<?php echo $extraClassStr; ?>"><?php echo Mage::helper('klarna')->__('Please note that your official address will be used for shipping address when you place your order'); ?></li>
45
+ <?php endif; ?>
46
+
47
  <?php else: ?>
48
 
49
+ <?php if (!$this->validShippingAndBillingAddress()): ?>
50
+ <li class="klarna_notification error"><?php echo Mage::helper('klarna')->__('Name and country must be the same for shipping and billing address!'); ?></li>
51
  <?php else: ?>
52
+ <?php if ($this->shippingSameAsBilling()): ?>
53
+ <li class="klarna_notification<?php echo $extraClassStr; ?>"><?php echo Mage::helper('klarna')->__('Please note that the shipping address will be used for both shipping and billing address when you place your order'); ?></li>
54
+ <?php endif; ?>
55
  <?php endif; ?>
56
 
57
  <?php endif; ?>
58
 
59
  <?php else: ?>
60
 
61
+ <?php if (!$this->validShippingAndBillingAddress()): ?>
62
+ <li class="klarna_notification error"><?php echo Mage::helper('klarna')->__('Name and country must be the same for shipping and billing address!'); ?></li>
63
  <?php else: ?>
64
+ <?php if ($this->shippingSameAsBilling()): ?>
65
+ <li class="klarna_notification<?php echo $extraClassStr; ?>"><?php echo Mage::helper('klarna')->__('Please note that the shipping address will be used for both shipping and billing address when you place your order'); ?></li>
66
+ <?php endif; ?>
67
  <?php endif; ?>
68
 
69
  <?php endif; ?>
app/design/frontend/base/default/template/vaimo/klarna/form/children/checkoutservice.phtml CHANGED
@@ -43,6 +43,10 @@
43
 
44
  <?php if ($this->getMethodCode()==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_SPECIAL): ?>
45
  <input id="pclass_<?php echo $serviceMethod['pclass_id']?>" onclick="toggleInformationBoxes('<?php echo $serviceMethod['pclass_id']; ?>');" type="hidden" name="payment[<?php echo $this->getMethodCode(); ?>_payment_plan]" value='<?php echo $serviceMethod['pclass_id']; ?>' <?php echo $checkedstr ?> />
 
 
 
 
46
  <?php elseif ($this->getMethodCode()==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT): ?>
47
  <input id="pclass_<?php echo $serviceMethod['pclass_id']?>" onclick="toggleInformationBoxes('<?php echo $serviceMethod['pclass_id']; ?>');" type="radio" name="payment[<?php echo $this->getMethodCode(); ?>_payment_plan]" value='<?php echo $serviceMethod['pclass_id']; ?>' <?php echo $checkedstr ?> />
48
  <?php echo $serviceMethod['title']; ?>
@@ -55,19 +59,24 @@
55
  <li class="payment_plan_info_wrapper" id="infobox_pclass_<?php echo $serviceMethod['pclass_id']?>" <?php if (!$_firstf): ?> style="display: none;" <?php endif; ?>>
56
  <div class="payment_plan_details" id="<?php echo $this->getMethodCode(); ?>_update_paymentplan_information_message">
57
  <dl>
58
- <?php foreach ($serviceMethod['details'] as $detail): ?>
 
59
  <dt><?php echo $detail['label']; ?></dt>
60
  <dd>
61
  <?php echo $detail['value']; ?>
62
  <?php if (isset($detail['symbol'])): ?>
63
  <?php echo ' ' . $detail['symbol']; ?>
 
 
 
64
  <?php endif; ?>
65
  </dd>
66
  <?php endforeach; ?>
67
  <?php if (isset($serviceMethod['use_case'])): ?>
68
  <?php if ($serviceMethod['use_case']): ?>
 
69
  <dt> &nbsp;</dt>
70
- <dt> <?php echo $serviceMethod['use_case']; ?> </dt>
71
  <?php endif; ?>
72
  <?php endif; ?>
73
  </dl>
43
 
44
  <?php if ($this->getMethodCode()==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_SPECIAL): ?>
45
  <input id="pclass_<?php echo $serviceMethod['pclass_id']?>" onclick="toggleInformationBoxes('<?php echo $serviceMethod['pclass_id']; ?>');" type="hidden" name="payment[<?php echo $this->getMethodCode(); ?>_payment_plan]" value='<?php echo $serviceMethod['pclass_id']; ?>' <?php echo $checkedstr ?> />
46
+ <?php echo $serviceMethod['title']; ?>
47
+ <?php elseif ($this->getMethodCode()==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE): ?>
48
+ <input id="pclass_<?php echo $serviceMethod['pclass_id']?>" onclick="toggleInformationBoxes('<?php echo $serviceMethod['pclass_id']; ?>');" type="hidden" name="payment[<?php echo $this->getMethodCode(); ?>_payment_plan]" value='<?php echo $serviceMethod['pclass_id']; ?>' <?php echo $checkedstr ?> />
49
+ <?php echo $serviceMethod['title']; ?>
50
  <?php elseif ($this->getMethodCode()==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT): ?>
51
  <input id="pclass_<?php echo $serviceMethod['pclass_id']?>" onclick="toggleInformationBoxes('<?php echo $serviceMethod['pclass_id']; ?>');" type="radio" name="payment[<?php echo $this->getMethodCode(); ?>_payment_plan]" value='<?php echo $serviceMethod['pclass_id']; ?>' <?php echo $checkedstr ?> />
52
  <?php echo $serviceMethod['title']; ?>
59
  <li class="payment_plan_info_wrapper" id="infobox_pclass_<?php echo $serviceMethod['pclass_id']?>" <?php if (!$_firstf): ?> style="display: none;" <?php endif; ?>>
60
  <div class="payment_plan_details" id="<?php echo $this->getMethodCode(); ?>_update_paymentplan_information_message">
61
  <dl>
62
+ <?php foreach ($serviceMethod['details'] as $detailId => $detail): ?>
63
+ <?php if ($detail['label']=='N/A') continue; ?>
64
  <dt><?php echo $detail['label']; ?></dt>
65
  <dd>
66
  <?php echo $detail['value']; ?>
67
  <?php if (isset($detail['symbol'])): ?>
68
  <?php echo ' ' . $detail['symbol']; ?>
69
+ <?php if ($detail['symbol'] != '%' && strpos($detailId, 'monthly') !== false): ?>
70
+ <?php echo '/ ' . $this->__('month'); ?>
71
+ <?php endif; ?>
72
  <?php endif; ?>
73
  </dd>
74
  <?php endforeach; ?>
75
  <?php if (isset($serviceMethod['use_case'])): ?>
76
  <?php if ($serviceMethod['use_case']): ?>
77
+ <?php $outputUseCase = $this->formatUseCase($serviceMethod['use_case']); ?>
78
  <dt> &nbsp;</dt>
79
+ <dt> <?php echo $outputUseCase; ?> </dt>
80
  <?php endif; ?>
81
  <?php endif; ?>
82
  </dl>
app/design/frontend/base/default/template/vaimo/klarna/form/invoice.phtml CHANGED
@@ -81,6 +81,14 @@ $_showServiceMethods = false;
81
  <li class="klarna_input_wrapper">
82
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
83
 
 
 
 
 
 
 
 
 
84
  <?php echo $this->getNotificationsHtml(); ?>
85
 
86
  <?php echo $this->getPersonalNumberHtml(); ?>
81
  <li class="klarna_input_wrapper">
82
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
83
 
84
+ <?php if (!$_showServiceMethods): ?>
85
+ <li>
86
+ <label>
87
+ <?php echo $this->getInvoiceSubTitle(); ?>
88
+ </label>
89
+ </li>
90
+ <?php endif; ?>
91
+
92
  <?php echo $this->getNotificationsHtml(); ?>
93
 
94
  <?php echo $this->getPersonalNumberHtml(); ?>
app/design/frontend/base/default/template/vaimo/klarna/klarnacheckout/discount/giftcardaccount.phtml CHANGED
@@ -47,7 +47,7 @@
47
  <?php echo $this->__('Gift Card (%s)', $_c['c']); ?>
48
  <?php $_url = Mage::getUrl('checkout/klarna/removeGiftCard', array('code'=>$_c['c'])); ?>
49
  <?php $_title = $this->__('Remove'); ?>
50
- <a href="<?php echo $_url ?>" title="<?php echo $_title; ?>" class="btn-remove"><img src="<?php echo $this->getSkinUrl('images/btn_remove.gif') ?>" alt="<?php echo $this->__('Remove')?>" /></a>
51
  </span>
52
  <span class="right">
53
  -<?php echo $this->helper('checkout')->formatPrice($_c['a']) ?>
47
  <?php echo $this->__('Gift Card (%s)', $_c['c']); ?>
48
  <?php $_url = Mage::getUrl('checkout/klarna/removeGiftCard', array('code'=>$_c['c'])); ?>
49
  <?php $_title = $this->__('Remove'); ?>
50
+ <a href="<?php echo $_url ?>" title="<?php echo $_title; ?>" class="btn-remove" id="klarna-giftcard-remove"><img src="<?php echo $this->getSkinUrl('images/btn_remove.gif') ?>" alt="<?php echo $this->__('Remove')?>" /></a>
51
  </span>
52
  <span class="right">
53
  -<?php echo $this->helper('checkout')->formatPrice($_c['a']) ?>
app/locale/da_DK/Vaimo_Klarna.csv CHANGED
@@ -66,7 +66,7 @@
66
  "Months","Måneder"
67
  "Minimum amount","Minimumsbeløb"
68
  "Address","Adresse"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Fødselsdag"
71
  "Gender","Køn"
72
  "Male","Mand"
@@ -166,3 +166,48 @@
166
  "Shipping Countries","Shipping Countries"
167
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
168
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  "Months","Måneder"
67
  "Minimum amount","Minimumsbeløb"
68
  "Address","Adresse"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Fødselsdag"
71
  "Gender","Køn"
72
  "Male","Mand"
166
  "Shipping Countries","Shipping Countries"
167
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
168
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
169
+ "Technical problem occurred while using %s payment method. Please try again later.","Technical problem occurred while using %s payment method. Please try again later."
170
+
171
+ "Cart redirect","Cart redirect"
172
+ "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
173
+ "Enable javascript trigger for address update","Enable javascript trigger for address update"
174
+ "Automatically register guests on checkout","Automatically register guests on checkout"
175
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
176
+ "Only when https is activated in checkout","Only when https is activated in checkout"
177
+ "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
178
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
179
+ "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
180
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
181
+ "Enable A/B Testing","Enable A/B Testing"
182
+ "Specific for API V.3x (US and UK)","Specific for API V.3x (US and UK)"
183
+ "Show other allowed shipping countries","Show other allowed shipping countries"
184
+ "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
185
+ "Include Shipping Options","Include Shipping Options"
186
+ "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
187
+ "Show Extended Error Message","Show Extended Error Message"
188
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
189
+ "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
190
+ "Show advanced options","Show advanced options"
191
+ "Display advanced or seldomly used settings","Display advanced or seldomly used settings"
192
+ "Can be used if site is in a different language than the official language of current country","Can be used if site is in a different language than the official language of current country"
193
+
194
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Please note that the shipping address will be used for both shipping and billing address when you place your order"
195
+ "Name and country must be the same for shipping and billing address!","Name and country must be the same for shipping and billing address!"
196
+ "Allow part capture when orders have discount","Allow part capture when orders have discount"
197
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk."
198
+
199
+ "Shopping Cart","Shopping Cart"
200
+ "Choose shipping method","Choose shipping method"
201
+ "Quantity","Quantity"
202
+ "Payment cancelled or some error occured. Please try again.","Payment cancelled or some error occured. Please try again."
203
+
204
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
205
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
206
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
207
+ "weitere Informationen","weitere Informationen"
208
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
209
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
210
+ "Rechnungskauf","Rechnungskauf"
211
+ "Pay in 15 days","Pay in 15 days"
212
+ "Not available for Austria and the Netherlands","Not available for Austria and the Netherlands"
213
+ "Klarna supports one country per store","Klarna supports one country per store"
app/locale/de_AT/Vaimo_Klarna.csv CHANGED
@@ -66,7 +66,7 @@
66
  "Months","Monate"
67
  "Minimum amount","Minimaler Betrag"
68
  "Address","Adresse"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Geburtsdatum"
71
  "Gender","Geschlecht"
72
  "Male","Mann"
@@ -170,3 +170,48 @@
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  "Months","Monate"
67
  "Minimum amount","Minimaler Betrag"
68
  "Address","Adresse"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Geburtsdatum"
71
  "Gender","Geschlecht"
72
  "Male","Mann"
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
173
+ "Technical problem occurred while using %s payment method. Please try again later.","Technical problem occurred while using %s payment method. Please try again later."
174
+
175
+ "Cart redirect","Cart redirect"
176
+ "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
177
+ "Enable javascript trigger for address update","Enable javascript trigger for address update"
178
+ "Automatically register guests on checkout","Automatically register guests on checkout"
179
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
180
+ "Only when https is activated in checkout","Only when https is activated in checkout"
181
+ "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
182
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
183
+ "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
184
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
185
+ "Enable A/B Testing","Enable A/B Testing"
186
+ "Specific for API V.3x (US and UK)","Specific for API V.3x (US and UK)"
187
+ "Show other allowed shipping countries","Show other allowed shipping countries"
188
+ "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
189
+ "Include Shipping Options","Include Shipping Options"
190
+ "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
191
+ "Show Extended Error Message","Show Extended Error Message"
192
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
193
+ "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
194
+ "Show advanced options","Show advanced options"
195
+ "Display advanced or seldomly used settings","Display advanced or seldomly used settings"
196
+ "Can be used if site is in a different language than the official language of current country","Can be used if site is in a different language than the official language of current country"
197
+
198
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Please note that the shipping address will be used for both shipping and billing address when you place your order"
199
+ "Name and country must be the same for shipping and billing address!","Name and country must be the same for shipping and billing address!"
200
+ "Allow part capture when orders have discount","Allow part capture when orders have discount"
201
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk."
202
+
203
+ "Shopping Cart","Shopping Cart"
204
+ "Choose shipping method","Choose shipping method"
205
+ "Quantity","Quantity"
206
+ "Payment cancelled or some error occured. Please try again.","Payment cancelled or some error occured. Please try again."
207
+
208
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
209
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
210
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
211
+ "weitere Informationen","weitere Informationen"
212
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
213
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
214
+ "Rechnungskauf","Rechnungskauf"
215
+ "Pay in 15 days","In 14 Tagen bezahlen"
216
+ "Not available for Austria and the Netherlands","Not available for Austria and the Netherlands"
217
+ "Klarna supports one country per store","Klarna supports one country per store"
app/locale/de_DE/Vaimo_Klarna.csv CHANGED
@@ -57,7 +57,7 @@
57
 
58
  "Invoice","Rechnung"
59
  "Refund","Erstattung"
60
- "month","monat"
61
  "Reservation","Reservierung"
62
  "Reservation Pending","Reservierung pending"
63
  "Reservation Denied","Reservierung abgelehnt"
@@ -66,7 +66,7 @@
66
  "Months","Monate"
67
  "Minimum amount","Minimaler Betrag"
68
  "Address","Adresse"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Geburtsdatum"
71
  "Gender","Geschlecht"
72
  "Male","Mann"
@@ -170,3 +170,49 @@
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  "Invoice","Rechnung"
59
  "Refund","Erstattung"
60
+ "month","Monat"
61
  "Reservation","Reservierung"
62
  "Reservation Pending","Reservierung pending"
63
  "Reservation Denied","Reservierung abgelehnt"
66
  "Months","Monate"
67
  "Minimum amount","Minimaler Betrag"
68
  "Address","Adresse"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Geburtsdatum"
71
  "Gender","Geschlecht"
72
  "Male","Mann"
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
173
+ "Technical problem occurred while using %s payment method. Please try again later.","Technical problem occurred while using %s payment method. Please try again later."
174
+
175
+ "Cart redirect","Cart redirect"
176
+ "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
177
+ "Enable javascript trigger for address update","Enable javascript trigger for address update"
178
+ "Automatically register guests on checkout","Automatically register guests on checkout"
179
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
180
+ "Only when https is activated in checkout","Only when https is activated in checkout"
181
+ "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
182
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
183
+ "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
184
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
185
+ "Enable A/B Testing","Enable A/B Testing"
186
+ "Specific for API V.3x (US and UK)","Specific for API V.3x (US and UK)"
187
+ "Show other allowed shipping countries","Show other allowed shipping countries"
188
+ "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
189
+ "Include Shipping Options","Include Shipping Options"
190
+ "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
191
+ "Show Extended Error Message","Show Extended Error Message"
192
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
193
+ "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
194
+ "Show advanced options","Show advanced options"
195
+ "Display advanced or seldomly used settings","Display advanced or seldomly used settings"
196
+ "Can be used if site is in a different language than the official language of current country","Can be used if site is in a different language than the official language of current country"
197
+
198
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Please note that the shipping address will be used for both shipping and billing address when you place your order"
199
+ "Name and country must be the same for shipping and billing address!","Name and country must be the same for shipping and billing address!"
200
+ "Allow part capture when orders have discount","Allow part capture when orders have discount"
201
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk."
202
+
203
+ "Shopping Cart","Shopping Cart"
204
+ "Choose shipping method","Choose shipping method"
205
+ "Quantity","Quantity"
206
+ "Payment cancelled or some error occured. Please try again.","Payment cancelled or some error occured. Please try again."
207
+ "Payment cancelled or some error occured. Please try again.","Betalningen avbruten eller så uppstod ett fel. Vänligen försök igen."
208
+
209
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
210
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
211
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
212
+ "weitere Informationen","weitere Informationen"
213
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
214
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
215
+ "Rechnungskauf","Rechnungskauf"
216
+ "Pay in 15 days","In 14 Tagen bezahlen"
217
+ "Not available for Austria and the Netherlands","Not available for Austria and the Netherlands"
218
+ "Klarna supports one country per store","Klarna supports one country per store"
app/locale/fi_FI/Vaimo_Klarna.csv CHANGED
@@ -66,7 +66,7 @@
66
  "Months","Kuukaudet"
67
  "Minimum amount","Vähimmäissumma"
68
  "Address","Osoite"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Syntymäaika"
71
  "Gender","Sukupuoli"
72
  "Male","Mies"
@@ -150,7 +150,7 @@
150
  "Capture ID","Capture ID"
151
  "Klarna Checkout is not responding properly. Please try again in a while or choose another payment method.","Klarna Checkout ei vastaa normaalisti. Ole hyvä ja yritä hetken kuluttua uudelleen tai valitse jokin toinen maksutapa."
152
 
153
- "Please note that your official address will be used for shipping and billing address when you place your order","Please note that your official address will be used for shipping and billing address when you place your order"
154
  "User Defined Variables","User Defined Variables"
155
  "JSON encoded array. Please consult Klarna before using this, incorrect information may cause the integration to stop working","JSON encoded array. Please consult Klarna before using this, incorrect information may cause the integration to stop working"
156
  "Disable Klarna Backend","Disable Klarna Backend"
@@ -170,7 +170,48 @@
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  "Shopping Cart","Ostoskori"
174
  "Choose shipping method","Valitse toimitustapa"
175
  "Quantity","Määrä"
176
  "Payment cancelled or some error occured. Please try again.","Maksu peruuntui tai tapahtui jokin muu virhe. Yritä hetken kuluttua uudelleen."
 
 
 
 
 
 
 
 
 
 
 
66
  "Months","Kuukaudet"
67
  "Minimum amount","Vähimmäissumma"
68
  "Address","Osoite"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Syntymäaika"
71
  "Gender","Sukupuoli"
72
  "Male","Mies"
150
  "Capture ID","Capture ID"
151
  "Klarna Checkout is not responding properly. Please try again in a while or choose another payment method.","Klarna Checkout ei vastaa normaalisti. Ole hyvä ja yritä hetken kuluttua uudelleen tai valitse jokin toinen maksutapa."
152
 
153
+ "Please note that your official address will be used for shipping and billing address when you place your order","Huomioithan että osoitettasi käytetään sekä toimitus- että laskutusosoitteena jätettyäsi tilauksen"
154
  "User Defined Variables","User Defined Variables"
155
  "JSON encoded array. Please consult Klarna before using this, incorrect information may cause the integration to stop working","JSON encoded array. Please consult Klarna before using this, incorrect information may cause the integration to stop working"
156
  "Disable Klarna Backend","Disable Klarna Backend"
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
173
+ "Technical problem occurred while using %s payment method. Please try again later.","Ett tekniskt problem inträffade för betalningsmetoden %s. Var god försök igen senare."
174
+
175
+ "Cart redirect","Cart redirect"
176
+ "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
177
+ "Enable javascript trigger for address update","Enable javascript trigger for address update"
178
+ "Automatically register guests on checkout","Automatically register guests on checkout"
179
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
180
+ "Only when https is activated in checkout","Only when https is activated in checkout"
181
+ "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
182
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
183
+ "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
184
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
185
+ "Enable A/B Testing","Enable A/B Testing"
186
+ "Specific for API V.3x (US and UK)","Endast för API V.3x (US och UK)"
187
+ "Show other allowed shipping countries","Show other allowed shipping countries"
188
+ "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Lista över tillåtna länder att leverera till. Är ingen vald, visas ingen. Listan visas i Klarna Checkout"
189
+ "Include Shipping Options","Include Shipping Options"
190
+ "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
191
+ "Show Extended Error Message","Show Extended Error Message"
192
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
193
+ "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
194
+ "Show advanced options","Visa avancerade alternativ"
195
+ "Display advanced or seldomly used settings","Visa avancerade eller sällan använda alternativ"
196
+ "Can be used if site is in a different language than the official language of current country","Kan användas om språket på siten är ett annat än det officiella språket för landet"
197
+
198
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Leveransadressen kommer att användas för både leverans och fakturaadress när du lägger ordern"
199
+ "Name and country must be the same for shipping and billing address!","Namn och land måste vara samma på både leverans och faktura adress!"
200
+ "Allow part capture when orders have discount","Tillåt del aktivering när ordrar har rabatter"
201
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","På grund av hur rabatter läggs till i Klarnas reservation, att del aktivera kan orsaka att för låg summa fångas. Aktivera på egen risk."
202
+
203
  "Shopping Cart","Ostoskori"
204
  "Choose shipping method","Valitse toimitustapa"
205
  "Quantity","Määrä"
206
  "Payment cancelled or some error occured. Please try again.","Maksu peruuntui tai tapahtui jokin muu virhe. Yritä hetken kuluttua uudelleen."
207
+
208
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
209
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
210
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
211
+ "weitere Informationen","weitere Informationen"
212
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
213
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
214
+ "Rechnungskauf","Rechnungskauf"
215
+ "Pay in 15 days","Pay in 15 days"
216
+ "Not available for Austria and the Netherlands","Not available for Austria and the Netherlands"
217
+ "Klarna supports one country per store","Klarna supports one country per store"
app/locale/nb_NO/Vaimo_Klarna.csv CHANGED
@@ -66,7 +66,7 @@
66
  "Months","Måneder"
67
  "Minimum amount","Minste beløp"
68
  "Address","Adresse"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Fødselsdato"
71
  "Gender","Kjønn"
72
  "Male","Mann"
@@ -170,3 +170,48 @@
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  "Months","Måneder"
67
  "Minimum amount","Minste beløp"
68
  "Address","Adresse"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Fødselsdato"
71
  "Gender","Kjønn"
72
  "Male","Mann"
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
173
+ "Technical problem occurred while using %s payment method. Please try again later.","Technical problem occurred while using %s payment method. Please try again later."
174
+
175
+ "Cart redirect","Cart redirect"
176
+ "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
177
+ "Enable javascript trigger for address update","Enable javascript trigger for address update"
178
+ "Automatically register guests on checkout","Automatically register guests on checkout"
179
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
180
+ "Only when https is activated in checkout","Only when https is activated in checkout"
181
+ "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
182
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
183
+ "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
184
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
185
+ "Enable A/B Testing","Enable A/B Testing"
186
+ "Specific for API V.3x (US and UK)","Specific for API V.3x (US and UK)"
187
+ "Show other allowed shipping countries","Show other allowed shipping countries"
188
+ "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
189
+ "Include Shipping Options","Include Shipping Options"
190
+ "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
191
+ "Show Extended Error Message","Show Extended Error Message"
192
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
193
+ "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
194
+ "Show advanced options","Show advanced options"
195
+ "Display advanced or seldomly used settings","Display advanced or seldomly used settings"
196
+ "Can be used if site is in a different language than the official language of current country","Can be used if site is in a different language than the official language of current country"
197
+
198
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Please note that the shipping address will be used for both shipping and billing address when you place your order"
199
+ "Name and country must be the same for shipping and billing address!","Name and country must be the same for shipping and billing address!"
200
+ "Allow part capture when orders have discount","Allow part capture when orders have discount"
201
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk."
202
+
203
+ "Shopping Cart","Shopping Cart"
204
+ "Choose shipping method","Choose shipping method"
205
+ "Quantity","Quantity"
206
+ "Payment cancelled or some error occured. Please try again.","Payment cancelled or some error occured. Please try again."
207
+
208
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
209
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
210
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
211
+ "weitere Informationen","weitere Informationen"
212
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
213
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
214
+ "Rechnungskauf","Rechnungskauf"
215
+ "Pay in 15 days","Pay in 15 days"
216
+ "Not available for Austria and the Netherlands","Not available for Austria and the Netherlands"
217
+ "Klarna supports one country per store","Klarna supports one country per store"
app/locale/nl_NL/Vaimo_Klarna.csv CHANGED
@@ -1,4 +1,4 @@
1
- "Klarna Invoice","Klarna Factuur"
2
  "Klarna Account","Klarna Account"
3
  "Klarna Campaign","Klarna Campagne"
4
  "Enabled","Geactiveerd"
@@ -66,7 +66,7 @@
66
  "Months","Maanden"
67
  "Minimum amount","Minimum bedrag"
68
  "Address","Adres"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Geboorte datum"
71
  "Gender","Geslacht"
72
  "Male","Man"
@@ -170,3 +170,48 @@
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Klarna Invoice","Achteraf betalen"
2
  "Klarna Account","Klarna Account"
3
  "Klarna Campaign","Klarna Campagne"
4
  "Enabled","Geactiveerd"
66
  "Months","Maanden"
67
  "Minimum amount","Minimum bedrag"
68
  "Address","Adres"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Geboorte datum"
71
  "Gender","Geslacht"
72
  "Male","Man"
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
173
+ "Technical problem occurred while using %s payment method. Please try again later.","Technical problem occurred while using %s payment method. Please try again later."
174
+
175
+ "Cart redirect","Cart redirect"
176
+ "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
177
+ "Enable javascript trigger for address update","Enable javascript trigger for address update"
178
+ "Automatically register guests on checkout","Automatically register guests on checkout"
179
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
180
+ "Only when https is activated in checkout","Only when https is activated in checkout"
181
+ "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
182
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
183
+ "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
184
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
185
+ "Enable A/B Testing","Enable A/B Testing"
186
+ "Specific for API V.3x (US and UK)","Specific for API V.3x (US and UK)"
187
+ "Show other allowed shipping countries","Show other allowed shipping countries"
188
+ "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
189
+ "Include Shipping Options","Include Shipping Options"
190
+ "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
191
+ "Show Extended Error Message","Show Extended Error Message"
192
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
193
+ "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
194
+ "Show advanced options","Show advanced options"
195
+ "Display advanced or seldomly used settings","Display advanced or seldomly used settings"
196
+ "Can be used if site is in a different language than the official language of current country","Can be used if site is in a different language than the official language of current country"
197
+
198
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Please note that the shipping address will be used for both shipping and billing address when you place your order"
199
+ "Name and country must be the same for shipping and billing address!","Name and country must be the same for shipping and billing address!"
200
+ "Allow part capture when orders have discount","Allow part capture when orders have discount"
201
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk."
202
+
203
+ "Shopping Cart","Shopping Cart"
204
+ "Choose shipping method","Choose shipping method"
205
+ "Quantity","Quantity"
206
+ "Payment cancelled or some error occured. Please try again.","Payment cancelled or some error occured. Please try again."
207
+
208
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
209
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
210
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
211
+ "weitere Informationen","weitere Informationen"
212
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
213
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
214
+ "Rechnungskauf","Rechnungskauf"
215
+ "Pay in 15 days","Binnen 14 dagen"
216
+ "Not available for Austria and the Netherlands","Not available for Austria and the Netherlands"
217
+ "Klarna supports one country per store","Klarna supports one country per store"
app/locale/nn_NO/Vaimo_Klarna.csv CHANGED
@@ -66,7 +66,7 @@
66
  "Months","Måneder"
67
  "Minimum amount","Minste beløp"
68
  "Address","Adresse"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Fødselsdato"
71
  "Gender","Kjønn"
72
  "Male","Mann"
@@ -170,3 +170,48 @@
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  "Months","Måneder"
67
  "Minimum amount","Minste beløp"
68
  "Address","Adresse"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Fødselsdato"
71
  "Gender","Kjønn"
72
  "Male","Mann"
170
  "Shipping Countries","Shipping Countries"
171
  "Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
172
  "Please note that your official address will be used for shipping address when you place your order","Please note that your official address will be used for shipping address when you place your order"
173
+ "Technical problem occurred while using %s payment method. Please try again later.","Technical problem occurred while using %s payment method. Please try again later."
174
+
175
+ "Cart redirect","Cart redirect"
176
+ "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
177
+ "Enable javascript trigger for address update","Enable javascript trigger for address update"
178
+ "Automatically register guests on checkout","Automatically register guests on checkout"
179
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
180
+ "Only when https is activated in checkout","Only when https is activated in checkout"
181
+ "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
182
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
183
+ "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
184
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
185
+ "Enable A/B Testing","Enable A/B Testing"
186
+ "Specific for API V.3x (US and UK)","Specific for API V.3x (US and UK)"
187
+ "Show other allowed shipping countries","Show other allowed shipping countries"
188
+ "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout"
189
+ "Include Shipping Options","Include Shipping Options"
190
+ "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
191
+ "Show Extended Error Message","Show Extended Error Message"
192
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
193
+ "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
194
+ "Show advanced options","Show advanced options"
195
+ "Display advanced or seldomly used settings","Display advanced or seldomly used settings"
196
+ "Can be used if site is in a different language than the official language of current country","Can be used if site is in a different language than the official language of current country"
197
+
198
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Please note that the shipping address will be used for both shipping and billing address when you place your order"
199
+ "Name and country must be the same for shipping and billing address!","Name and country must be the same for shipping and billing address!"
200
+ "Allow part capture when orders have discount","Allow part capture when orders have discount"
201
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk."
202
+
203
+ "Shopping Cart","Shopping Cart"
204
+ "Choose shipping method","Choose shipping method"
205
+ "Quantity","Quantity"
206
+ "Payment cancelled or some error occured. Please try again.","Payment cancelled or some error occured. Please try again."
207
+
208
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
209
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
210
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
211
+ "weitere Informationen","weitere Informationen"
212
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
213
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
214
+ "Rechnungskauf","Rechnungskauf"
215
+ "Pay in 15 days","Pay in 15 days"
216
+ "Not available for Austria and the Netherlands","Not available for Austria and the Netherlands"
217
+ "Klarna supports one country per store","Klarna supports one country per store"
app/locale/sv_SE/Vaimo_Klarna.csv CHANGED
@@ -52,7 +52,7 @@
52
  "Klarna was not able to cancel the reservation","Klarna kunde inte avbryta reservationen."
53
  "Please enter a positive number in this field","Beloppet måste vara positivt."
54
  "No address found. Verify the personal id and try again","Ingen adress hittades. Kontrollera personnummer och försök igen."
55
- "Please note that both shipping and invoice address will be updated to this address when you place your order","Både leverans och fakturaadress kommer att uppdateras till denna adress när du lägger ordern."
56
  "Please note that shipping address will be updated to this address when you place your order","Leveransadress kommer att uppdateras till denna adress när du lägger ordern."
57
 
58
  "Invoice","Faktura"
@@ -66,7 +66,7 @@
66
  "Months","Månader"
67
  "Minimum amount","Minsta belopp"
68
  "Address","Adress"
69
- "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Datenverarbeitung der für die Abwicklungdes Rechnungskaufes und einer Identitäts-und Bonitätsprüfung erforderlichen Daten durch Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Födelsedag"
71
  "Gender","Kön"
72
  "Male","Man"
@@ -172,22 +172,46 @@
172
  "Please note that your official address will be used for shipping address when you place your order","Leveransadressen kommer att uppdateras till din officiella adress när du lägger ordern"
173
  "Technical problem occurred while using %s payment method. Please try again later.","Ett tekniskt problem inträffade för betalningsmetoden %s. Var god försök igen senare."
174
 
175
- "Cart redirect","Cart redirect"
176
- "Default is cart, custom redirect must not go to any checkout page","Default is cart, custom redirect must not go to any checkout page"
177
- "Enable javascript trigger for address update","Enable javascript trigger for address update"
178
- "Automatically register guests on checkout","Automatically register guests on checkout"
179
- "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests."
180
- "Only when https is activated in checkout","Only when https is activated in checkout"
181
- "Automatically reactivate Klarna Checkout","Automatically reactivate Klarna Checkout"
182
- "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!"
183
- "Only run Klarma Checkout if Explicitly called","Only run Klarma Checkout if Explicitly called"
184
- "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default"
185
- "Enable A/B Testing","Enable A/B Testing"
186
  "Specific for API V.3x (US and UK)","Endast för API V.3x (US och UK)"
187
- "Show other allowed shipping countries","Show other allowed shipping countries"
188
  "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Lista över tillåtna länder att leverera till. Är ingen vald, visas ingen. Listan visas i Klarna Checkout"
189
- "Include Shipping Options","Include Shipping Options"
190
- "List of available shipping options that should appear in Klarna Checkout.","List of available shipping options that should appear in Klarna Checkout."
191
- "Show Extended Error Message","Show Extended Error Message"
192
- """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Yes"" - show error messages provided by Klarna. ""No"" - show default error message"
193
- "Show extended error message in case if authorization was failed","Show extended error message in case if authorization was failed"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  "Klarna was not able to cancel the reservation","Klarna kunde inte avbryta reservationen."
53
  "Please enter a positive number in this field","Beloppet måste vara positivt."
54
  "No address found. Verify the personal id and try again","Ingen adress hittades. Kontrollera personnummer och försök igen."
55
+ "Please note that both shipping and billing address will be updated to this address when you place your order","Både leverans och fakturaadress kommer att uppdateras till denna adress när du lägger ordern."
56
  "Please note that shipping address will be updated to this address when you place your order","Leveransadress kommer att uppdateras till denna adress när du lägger ordern."
57
 
58
  "Invoice","Faktura"
66
  "Months","Månader"
67
  "Minimum amount","Minsta belopp"
68
  "Address","Adress"
69
+ "By submitting my data I consent to the processing of my data by Klarna for the purposes of identity- and credit assessment and the settlement of the purchase. I may revoke my %s for the processing of data and for the purposes for which this is possible according to law. The general %s apply.","Mit der Übermittlung der für die Abwicklung der gewählten Klarna Zahlungsmethode und einer Identitätsund Bonitätsprüfung erforderlichen Daten an Klarna bin ich einverstanden. Meine %s kann ich jederzeit mit Wirkung für die Zukunft widerrufen. Es gelten die %s des Händlers."
70
  "Date of birth","Födelsedag"
71
  "Gender","Kön"
72
  "Male","Man"
172
  "Please note that your official address will be used for shipping address when you place your order","Leveransadressen kommer att uppdateras till din officiella adress när du lägger ordern"
173
  "Technical problem occurred while using %s payment method. Please try again later.","Ett tekniskt problem inträffade för betalningsmetoden %s. Var god försök igen senare."
174
 
175
+ "Cart redirect","Tillbaka till varukorg"
176
+ "Default is cart, custom redirect must not go to any checkout page","Normalt är att gå till varukorgen, om man vill ha en annan sida kan man välja det här, men det får inte vara någon checkout sida"
177
+ "Enable javascript trigger for address update","Aktivera javascript för address uppdatering"
178
+ "Automatically register guests on checkout","Automatiskt skapa kundkort för gäster i checkout"
179
+ "If disabled and Guest Checkout is allowed in Magento Checkout Options, orders will be placed as guests.","Om deaktiverad och Gäst Checkout är tillåten, kommer ordrar placerade som gäst att vara gäst ordrar, i annat fall skapas ett kundkort"
180
+ "Only when https is activated in checkout","Endast när https är aktiverad i checkout"
181
+ "Automatically reactivate Klarna Checkout","Automatiskt återgå till Klarna Checkout"
182
+ "If enabled, it will go to Klarna Checkout next time checkout is requested, if user exits standard checkout by going to another page. Attention! If there are many customizations in standard checkout, it might cause this reactivation as well!","Om aktiverad, kommer systemet att styra om till Klarna Checkout nästa gång checkout anropas. OBS! Om standard checkout har många anpassningar, kan det orsaka samma automatisk aktivering oavsett!"
183
+ "Only run Klarma Checkout if Explicitly called","Kör Klarna Checkout endast om direkt anropad"
184
+ "If set to Yes, and you go to checkout without any customisation, it will go to standard checkout rather than Klarna Checkout by default","Om aktiverad, kommer du till standard kassan om du klickar checkout, istället för till Klarna Checkout"
185
+ "Enable A/B Testing","Aktivera A/B testning"
186
  "Specific for API V.3x (US and UK)","Endast för API V.3x (US och UK)"
187
+ "Show other allowed shipping countries","Visa andra tillåtna leverans länder"
188
  "List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout","Lista över tillåtna länder att leverera till. Är ingen vald, visas ingen. Listan visas i Klarna Checkout"
189
+ "Include Shipping Options","Inkludera frakt alternativ"
190
+ "List of available shipping options that should appear in Klarna Checkout.","Lista över tillgängla leverans alternativ som ska visas i Klarna Checkout."
191
+ "Show Extended Error Message","Visa utökade felmeddelanden till kund"
192
+ """Yes"" - show error messages provided by Klarna. ""No"" - show default error message","""Ja"" - visa felmeddelandet som Klarna skickar. ""Nej"" - visa ett standard meddelande"
193
+ "Show extended error message in case if authorization was failed","Visa utökade felmeddelande om reservation misslyckas"
194
+ "Show advanced options","Visa avancerade alternativ"
195
+ "Display advanced or seldomly used settings","Visa avancerade eller sällan använda alternativ"
196
+ "Can be used if site is in a different language than the official language of current country","Kan användas om språket på siten är ett annat än det officiella språket för landet"
197
+
198
+ "Please note that the shipping address will be used for both shipping and billing address when you place your order","Leveransadressen kommer att användas för både leverans och fakturaadress när du lägger ordern"
199
+ "Name and country must be the same for shipping and billing address!","Namn och land måste vara samma på både leverans och faktura adress!"
200
+ "Allow part capture when orders have discount","Tillåt del aktivering när ordrar har rabatter"
201
+ "Due to how discounts are added on the Klarna reservation, part capturing an order with a discount can result in too low amounts being captured. Activate on your own risk.","På grund av hur rabatter läggs till i Klarnas reservation, att del aktivera kan orsaka att för låg summa fångas. Aktivera på egen risk."
202
+
203
+ "Shopping Cart","Varurkorg"
204
+ "Choose shipping method","Visa leverans alternativ"
205
+ "Quantity","Antal"
206
+ "Payment cancelled or some error occured. Please try again.","Betalningen avbruten eller så uppstod ett fel. Vänligen försök igen."
207
+
208
+ "German specific hardcoded usecase with links (part one)","Verfügungsrahmen ab 199,99 € (abhängig von der Höhe Ihrer Einkäufe), effektiver Jahreszins 18,07 %* und Gesamtbetrag 218,57 €* (bei Ausnutzung des vollen Verfügungsrahmens und Rückzahlung in 12 monatlichen Raten je 18,21 €)."
209
+ "German specific hardcoded usecase with links (part two), weitere Informationen link %s AGB link %s Standardinformationen link %s","Hier finden Sie %s, %s und %s."
210
+ "German specific hardcoded usecase with links (part three), Rechnungskauf link %s","Übersteigt Ihr Einkauf mit Klarna Ratenkauf erstmals einen Betrag von 199,99 €, erhalten Sie von Klarna einen Ratenkaufvertrag mit der Bitte um Unterzeichnung zugesandt. Ihr Kauf gilt solange als %s."
211
+ "weitere Informationen","weitere Informationen"
212
+ "AGB mit Widerrufsbelehrung","AGB mit Widerrufsbelehrung"
213
+ "Standardinformationen für Verbraucherkredite","Standardinformationen für Verbraucherkredite"
214
+ "Rechnungskauf","Rechnungskauf"
215
+ "Pay in 15 days","Betala om 14 dagar"
216
+ "Not available for Austria and the Netherlands","Inte tillgänglig för Österrike och Holland"
217
+ "Klarna supports one country per store","Klarna stödjer bara ett land per butik"
js/vaimo/klarna/klarnacheckout.js CHANGED
@@ -27,6 +27,32 @@ function refreshCheckout(data) {
27
  //klarnaMsgContent.innerHTML = obj.success;
28
  //fadeIn(klarnaMsg);
29
  console.log(obj.success);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  } else {
31
  document.cookie = 'klarnaAddShipping=0; expires=-1;';
32
  }
@@ -129,16 +155,17 @@ function reloadKlarnaIFrame(results) {
129
  };
130
 
131
  function updateCartKlarna(type) {
132
- var klarnaCart = document.getElementById("klarna_sidebar"),
133
  klarnaContainer = document.getElementById("klarna_container"),
134
- klarnaLoader = document.getElementById("klarna_loader"),
135
- klarnaMsg = document.getElementById("klarna_msg"),
136
- klarnaMsgContent = document.getElementById("klarna_msg_content"),
137
- klarnaCartHtml = document.getElementById("klarna_cart_reload"),
138
- klarnaHtml = document.getElementById("klarna_checkout_reload"),
139
- klarnaCheckout = document.getElementById("klarna_checkout"),
140
- klarnaTotals = document.getElementById("klarna_totals"),
141
- klarnaCheckoutContainer = document.getElementById('klarna-checkout-container');
 
142
 
143
  klarnaMsg.style.display = 'none';
144
  klarnaMsg.className = klarnaMsg.className.replace( /(?:^|\s)error(?!\S)/g , '' );
@@ -160,7 +187,7 @@ function updateCartKlarna(type) {
160
  break;
161
  case 'giftcard-remove':
162
  formID = document.getElementById('giftcard-form');
163
- ajaxUrl = input;
164
  break;
165
  case 'reward':
166
  formID = document.getElementById('klarna-checkout-reward');
@@ -329,7 +356,7 @@ function bindCheckoutControls() {
329
  fadeIn(giftcardInput);
330
  }
331
  setTimeout(function() {
332
- giftcardInput.className = couponInput.className.replace(
333
  /(?:^|\s)error(?!\S)/g, '')
334
  }, 6000)
335
  } else {
27
  //klarnaMsgContent.innerHTML = obj.success;
28
  //fadeIn(klarnaMsg);
29
  console.log(obj.success);
30
+
31
+ // JS HOOKS IE5 - 11 Fallback
32
+ var createCustomEvent = function(name) {
33
+ return new Event(name);
34
+ };
35
+
36
+ try {
37
+ new Event('supported');
38
+ } catch (e) {
39
+ // does not support `new Event()`
40
+ console.log('Event fallback for IE used');
41
+ createCustomEvent = function (name) {
42
+ var event = document.createEvent('Event');
43
+ event.initEvent(name, true, false);
44
+ return event;
45
+ };
46
+ }
47
+
48
+ if (obj.shipping_method) {
49
+ var customEvent = createCustomEvent('klarna:shippingMethodSaved');
50
+ klarnaContainer.dispatchEvent(customEvent);
51
+ }
52
+ if (!obj.shipping_method && obj.success) {
53
+ var customEvent = createCustomEvent('klarna:shippingCartUpdated');
54
+ klarnaContainer.dispatchEvent(customEvent);
55
+ }
56
  } else {
57
  document.cookie = 'klarnaAddShipping=0; expires=-1;';
58
  }
155
  };
156
 
157
  function updateCartKlarna(type) {
158
+ var klarnaCart = document.getElementById("klarna_sidebar"),
159
  klarnaContainer = document.getElementById("klarna_container"),
160
+ klarnaLoader = document.getElementById("klarna_loader"),
161
+ klarnaMsg = document.getElementById("klarna_msg"),
162
+ klarnaMsgContent = document.getElementById("klarna_msg_content"),
163
+ klarnaCartHtml = document.getElementById("klarna_cart_reload"),
164
+ klarnaHtml = document.getElementById("klarna_checkout_reload"),
165
+ klarnaCheckout = document.getElementById("klarna_checkout"),
166
+ klarnaTotals = document.getElementById("klarna_totals"),
167
+ klarnaCheckoutContainer = document.getElementById('klarna-checkout-container'),
168
+ klarnaGiftcardRemove = document.getElementById('klarna-giftcard-remove');
169
 
170
  klarnaMsg.style.display = 'none';
171
  klarnaMsg.className = klarnaMsg.className.replace( /(?:^|\s)error(?!\S)/g , '' );
187
  break;
188
  case 'giftcard-remove':
189
  formID = document.getElementById('giftcard-form');
190
+ ajaxUrl = klarnaGiftcardRemove.getAttribute('href');
191
  break;
192
  case 'reward':
193
  formID = document.getElementById('klarna-checkout-reward');
356
  fadeIn(giftcardInput);
357
  }
358
  setTimeout(function() {
359
+ giftcardInput.className = giftcardInput.className.replace(
360
  /(?:^|\s)error(?!\S)/g, '')
361
  }, 6000)
362
  } else {
lib/Klarna/pclasses/mysqlstorage.class.php CHANGED
@@ -117,10 +117,10 @@ class MySQLStorage extends PCStorage
117
  */
118
  public function connect()
119
  {
120
- $this->link = mysql_connect($this->addr, $this->user, $this->passwd);
121
  if ($this->link === false) {
122
  throw new Klarna_DatabaseException(
123
- 'Failed to connect to database! ('.mysql_error().')'
124
  );
125
  }
126
  }
@@ -134,17 +134,18 @@ class MySQLStorage extends PCStorage
134
  */
135
  public function create()
136
  {
137
- if (!mysql_query(
138
- "CREATE DATABASE IF NOT EXISTS `{$this->dbName}`",
139
- $this->link
140
  )
141
  ) {
142
  throw new Klarna_DatabaseException(
143
- 'Failed to create! ('.mysql_error().')'
144
  );
145
  }
146
 
147
- $create = mysql_query(
 
148
  "CREATE TABLE IF NOT EXISTS `{$this->dbName}`.`{$this->dbTable}` (
149
  `eid` int(10) unsigned NOT NULL,
150
  `id` int(10) unsigned NOT NULL,
@@ -158,12 +159,12 @@ class MySQLStorage extends PCStorage
158
  `country` int(11) NOT NULL,
159
  `expire` int(11) NOT NULL,
160
  KEY `id` (`id`)
161
- )", $this->link
162
  );
163
 
164
  if (!$create) {
165
  throw new Klarna_DatabaseException(
166
- 'Table not existing, failed to create! ('.mysql_error().')'
167
  );
168
  }
169
  }
@@ -241,16 +242,16 @@ class MySQLStorage extends PCStorage
241
  {
242
  $this->splitURI($uri);
243
  $this->connect();
244
- $result = mysql_query(
245
- "SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`",
246
- $this->link
247
  );
248
  if ($result === false) {
249
  throw new Klarna_DatabaseException(
250
- 'SELECT query failed! ('.mysql_error().')'
251
  );
252
  }
253
- while ($row = mysql_fetch_assoc($result)) {
254
  $this->addPClass(new KlarnaPClass($row));
255
  }
256
  }
@@ -275,14 +276,16 @@ class MySQLStorage extends PCStorage
275
  foreach ($this->pclasses as $pclasses) {
276
  foreach ($pclasses as $pclass) {
277
  //Remove the pclass if it exists.
278
- mysql_query(
 
279
  "DELETE FROM `{$this->dbName}`.`{$this->dbTable}`
280
  WHERE `id` = '{$pclass->getId()}'
281
  AND `eid` = '{$pclass->getEid()}'"
282
  );
283
 
284
  //Insert it again.
285
- $result = mysql_query(
 
286
  "INSERT INTO `{$this->dbName}`.`{$this->dbTable}`
287
  (`eid`,
288
  `id`,
@@ -307,11 +310,11 @@ class MySQLStorage extends PCStorage
307
  '{$pclass->getStartFee()}',
308
  '{$pclass->getMinAmount()}',
309
  '{$pclass->getCountry()}',
310
- '{$pclass->getExpire()}')", $this->link
311
  );
312
  if ($result === false) {
313
  throw new Klarna_DatabaseException(
314
- 'INSERT INTO query failed! ('.mysql_error().')'
315
  );
316
  }
317
  }
@@ -333,9 +336,9 @@ class MySQLStorage extends PCStorage
333
  unset($this->pclasses);
334
  $this->connect();
335
 
336
- mysql_query(
337
- "DELETE FROM `{$this->dbName}`.`{$this->dbTable}`",
338
- $this->link
339
  );
340
  } catch(Exception $e) {
341
  throw new Klarna_DatabaseException(
117
  */
118
  public function connect()
119
  {
120
+ $this->link = mysqli_connect($this->addr, $this->user, $this->passwd);
121
  if ($this->link === false) {
122
  throw new Klarna_DatabaseException(
123
+ 'Failed to connect to database! ('.mysqli_error($this->link).')'
124
  );
125
  }
126
  }
134
  */
135
  public function create()
136
  {
137
+ if (!mysqli_query(
138
+ $this->link,
139
+ "CREATE DATABASE IF NOT EXISTS `{$this->dbName}`"
140
  )
141
  ) {
142
  throw new Klarna_DatabaseException(
143
+ 'Failed to create! ('.mysqli_error($this->link).')'
144
  );
145
  }
146
 
147
+ $create = mysqli_query(
148
+ $this->link,
149
  "CREATE TABLE IF NOT EXISTS `{$this->dbName}`.`{$this->dbTable}` (
150
  `eid` int(10) unsigned NOT NULL,
151
  `id` int(10) unsigned NOT NULL,
159
  `country` int(11) NOT NULL,
160
  `expire` int(11) NOT NULL,
161
  KEY `id` (`id`)
162
+ )"
163
  );
164
 
165
  if (!$create) {
166
  throw new Klarna_DatabaseException(
167
+ 'Table not existing, failed to create! ('.mysqli_error($this->link).')'
168
  );
169
  }
170
  }
242
  {
243
  $this->splitURI($uri);
244
  $this->connect();
245
+ $result = mysqli_query(
246
+ $this->link,
247
+ "SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`"
248
  );
249
  if ($result === false) {
250
  throw new Klarna_DatabaseException(
251
+ 'SELECT query failed! ('.mysqli_error($this->link).')'
252
  );
253
  }
254
+ while ($row = mysqli_fetch_assoc($result)) {
255
  $this->addPClass(new KlarnaPClass($row));
256
  }
257
  }
276
  foreach ($this->pclasses as $pclasses) {
277
  foreach ($pclasses as $pclass) {
278
  //Remove the pclass if it exists.
279
+ mysqli_query(
280
+ $this->link,
281
  "DELETE FROM `{$this->dbName}`.`{$this->dbTable}`
282
  WHERE `id` = '{$pclass->getId()}'
283
  AND `eid` = '{$pclass->getEid()}'"
284
  );
285
 
286
  //Insert it again.
287
+ $result = mysqli_query(
288
+ $this->link,
289
  "INSERT INTO `{$this->dbName}`.`{$this->dbTable}`
290
  (`eid`,
291
  `id`,
310
  '{$pclass->getStartFee()}',
311
  '{$pclass->getMinAmount()}',
312
  '{$pclass->getCountry()}',
313
+ '{$pclass->getExpire()}')"
314
  );
315
  if ($result === false) {
316
  throw new Klarna_DatabaseException(
317
+ 'INSERT INTO query failed! ('.mysqli_error($this->link).')'
318
  );
319
  }
320
  }
336
  unset($this->pclasses);
337
  $this->connect();
338
 
339
+ mysqli_query(
340
+ $this->link,
341
+ "DELETE FROM `{$this->dbName}`.`{$this->dbTable}`"
342
  );
343
  } catch(Exception $e) {
344
  throw new Klarna_DatabaseException(
lib/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc CHANGED
@@ -866,6 +866,11 @@
866
  */
867
  var $user_agent;
868
 
 
 
 
 
 
869
  /**
870
  * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
871
  * @param string $server the server name / ip address
@@ -1933,6 +1938,11 @@
1933
  var $content_type = 'text/xml';
1934
  var $raw_data = '';
1935
 
 
 
 
 
 
1936
  /**
1937
  * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
1938
  * @param integer $fcode set it to anything but 0 to create an error response
@@ -2087,6 +2097,11 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
2087
  var $debug=0;
2088
  var $content_type = 'text/xml';
2089
 
 
 
 
 
 
2090
  /**
2091
  * @param string $meth the name of the method to invoke
2092
  * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
@@ -2710,6 +2725,11 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
2710
  var $mytype=0;
2711
  var $_php_class=null;
2712
 
 
 
 
 
 
2713
  /**
2714
  * @param mixed $val
2715
  * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed
866
  */
867
  var $user_agent;
868
 
869
+ function __construct($path, $server='', $port='', $method='')
870
+ {
871
+ $this->xmlrpc_client($path, $server, $port, $method);
872
+ }
873
+
874
  /**
875
  * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
876
  * @param string $server the server name / ip address
1938
  var $content_type = 'text/xml';
1939
  var $raw_data = '';
1940
 
1941
+ function __construct($val, $fcode = 0, $fstr = '', $valtyp='')
1942
+ {
1943
+ $this->xmlrpcresp($val, $fcode, $fstr, $valtyp);
1944
+ }
1945
+
1946
  /**
1947
  * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
1948
  * @param integer $fcode set it to anything but 0 to create an error response
2097
  var $debug=0;
2098
  var $content_type = 'text/xml';
2099
 
2100
+ function __construct($meth, $pars=0)
2101
+ {
2102
+ $this->xmlrpcmsg($meth, $pars);
2103
+ }
2104
+
2105
  /**
2106
  * @param string $meth the name of the method to invoke
2107
  * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
2725
  var $mytype=0;
2726
  var $_php_class=null;
2727
 
2728
+ function __construct($val=-1, $type='')
2729
+ {
2730
+ $this->xmlrpcval($val, $type);
2731
+ }
2732
+
2733
  /**
2734
  * @param mixed $val
2735
  * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed
lib/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpcs.inc CHANGED
@@ -494,6 +494,11 @@
494
  */
495
  var $user_data = null;
496
 
 
 
 
 
 
497
  /**
498
  * @param array $dispmap the dispatch map withd efinition of exposed services
499
  * @param boolean $servicenow set to false to prevent the server from runnung upon construction
494
  */
495
  var $user_data = null;
496
 
497
+ function __construct($dispMap = null, $serviceNow = true)
498
+ {
499
+ $this->xmlrpc_server($dispMap, $serviceNow);
500
+ }
501
+
502
  /**
503
  * @param array $dispmap the dispatch map withd efinition of exposed services
504
  * @param boolean $servicenow set to false to prevent the server from runnung upon construction
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>klarnapayments</name>
4
- <version>5.3.55</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Klarna payment module for Klarna Checkout, invoice and part payments. This module works for all countries were Klarna's product offering is applicable. To use this module requires that you have a contract with Klarna.</description>
11
  <notes>This version is not compatible with any Klarna module version of 4.x or earlier.</notes>
12
  <authors><author><name>Klarna</name><user>Klarna</user><email>magento@klarna.com</email></author><author><name>Vaimo</name><user>VAIMO</user><email>info@vaimo.com</email></author></authors>
13
- <date>2016-05-10</date>
14
- <time>19:55:15</time>
15
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="vaimo_klarna.xml" hash="19a196d33bcc2e1eaf4413dcefeb5f04"/></dir><dir name="template"><dir name="vaimo"><dir name="klarna"><dir name="creditmemo"><dir name="totals"><file name="adjustments.phtml" hash="b0299ac0b1ca75b4d143413cc8eb8217"/></dir></dir><dir name="info"><file name="account.phtml" hash="4c51cb3b4aeb54bb009e384d300ece98"/><file name="checkout.phtml" hash="679e88a49ec331cec8df1b8f09e39758"/><dir name="children"><file name="invoicefee.phtml" hash="2b721be479706716f6468c8395455fa5"/><file name="invoices.phtml" hash="ac4e3bd4aea83e9ea3479fc04ed0d5a4"/><file name="notices.phtml" hash="a5053c7829df05fd8afb30d5019b1aca"/><file name="paymentplan.phtml" hash="885c020c05afd4516a42a33a6986f32f"/><file name="reference.phtml" hash="a789d5c8d4253c6ba4d894e2f0465f9c"/><file name="reservation.phtml" hash="d96f36640577e8e053050c24bfb4ec43"/></dir><file name="invoice.phtml" hash="498a1d706ac1da4fc71982f1232de492"/><file name="special.phtml" hash="4c51cb3b4aeb54bb009e384d300ece98"/></dir><dir name="pclass"><file name="list.phtml" hash="5cef6b0093bb5da18dbf1f9fd7316c66"/><file name="update.phtml" hash="ed53d5eb248f8181cd601e7b10cb170f"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="vaimo_klarna.xml" hash="4fda0bc7525f55705ef334c26f10a36d"/></dir><dir name="template"><dir name="vaimo"><dir name="klarna"><dir name="catalog"><dir name="product"><file name="pricewidget.phtml" hash="ade52495b519d3cfd6f53a4285be895f"/></dir></dir><dir name="checkout"><file name="fee.phtml" hash="3a58d7e7278bf9fcae1cdb9d836d4ff3"/><file name="header.phtml" hash="51a7f95f2fcb5f7b02e19b13690631a8"/><file name="top.phtml" hash="9cc1ce32346bd6ed7c16139f3f960a95"/></dir><dir name="form"><file name="account.phtml" hash="7b763a6452a9268b2489885cf7e2bb98"/><dir name="address"><file name="search.phtml" hash="473e03908fdb841f7152ed78671fcef0"/></dir><file name="checkout.phtml" hash="fe86056c73f86d53a73ebda5c5f3547c"/><dir name="children"><file name="addressresult.phtml" hash="4bb8fd4309c9b4012bfeb2d31c90076a"/><file name="checkoutservice.phtml" hash="3ae5ecf2420cb457304ef0b9f4227b9c"/><file name="consent.phtml" hash="a4f446258fa20a453d3566cffc20085d"/><file name="dateofbirth.phtml" hash="e1dbe367ce43029d671dae6f7d3ca956"/><file name="gender.phtml" hash="c8428e9b76db957a866cfc109d7a0c09"/><file name="notifications.phtml" hash="2d91f392c4c2fee89ada3c53719dc47f"/><file name="paymentplan_information.phtml" hash="8f28c418c08df3e664744ef28bc283c3"/><file name="pclass.phtml" hash="848a7e485badbdf11d10628c93906b21"/><file name="personalnumber.phtml" hash="dcea08f692ed978689242ba8309f3cdb"/><file name="phonenumber.phtml" hash="6348b12795e073d8881ab0b74d7df175"/></dir><file name="invoice.phtml" hash="0c1053b8b024035ab023fd39c473752b"/><dir name="paymentplan"><file name="information.phtml" hash="d013f147f38502cb4baf591d56d177d9"/></dir><file name="special.phtml" hash="05ada24ff6c7cb813f498920eddd90bb"/></dir><dir name="info"><file name="account.phtml" hash="a848c9544a5e400bc27e26d050eafa3c"/><file name="checkout.phtml" hash="cbcd2d9379f2afbd450fb925c05aa4ed"/><dir name="children"><file name="invoicefee.phtml" hash="c6b4ccff75e220c5641a8fadd6753131"/><file name="invoices.phtml" hash="892672664fe645193471a26bb052c18b"/><file name="notices.phtml" hash="26571bbd4c152f4f39c5b0281adff251"/><file name="paymentplan.phtml" hash="3a73d918dc733c0888f18e442f9eb64c"/><file name="reference.phtml" hash="60e6eaabc7ff88a7762ce97c45d151e0"/><file name="reservation.phtml" hash="9880ef8208f672d531cc10eef8467856"/></dir><file name="invoice.phtml" hash="cd3514e43dd441b4530b95e408784d84"/><file name="special.phtml" hash="c472684055c8839b8e365b80a5e1ee0c"/></dir><dir name="klarnacheckout"><file name="account-login.phtml" hash="487de8f489b7e65416bf3559e1819abd"/><file name="autofill.phtml" hash="6bdd6c22fd1771106f52876e66d7f4de"/><dir name="cart"><dir name="item"><file name="default.phtml" hash="cb76c84ce20dbd391a1615756f2d72d7"/></dir><file name="totals.phtml" hash="a8496f65d2bd8390cee2bb5c89bad555"/></dir><file name="cart.phtml" hash="9dd4348207c7bab904a92e51da1126ec"/><file name="checkout.phtml" hash="c71826694ac6270f82a05e69a896d66b"/><dir name="customer"><file name="balance.phtml" hash="af890728b26b0808c299ab199bc5f4c0"/></dir><file name="default.phtml" hash="357abf99f4cb926d728c7c5253ea4b1e"/><dir name="discount"><file name="coupon.phtml" hash="0e4c2c52f677212b2071e3acddcc217a"/><file name="giftcardaccount.phtml" hash="8895e32abbc97d84fce366221637a1d9"/></dir><file name="discount.phtml" hash="7ce3289506c3e8abdd4af610e0f7f273"/><file name="header.phtml" hash="d25937ce1facfe47e16e63dff56e337a"/><file name="klarnacheckout.phtml" hash="a51ee31586f4cbeb5bfe0ffe1ca32c84"/><file name="main.phtml" hash="079d3162d46b762574eb2cd4641c14c2"/><file name="msg.phtml" hash="d716a2a466835c99f71bea1742533cc0"/><file name="newsletter.phtml" hash="34e007c7bd516cd37e93cb5bd9f19478"/><file name="othermethod.phtml" hash="f619075a30bf6240753a186636b5c2f4"/><file name="reward.phtml" hash="0e1d0a7d42738662fddd04dab09f5765"/><dir name="shipping_method"><file name="available.phtml" hash="62991e138e2a296fc0aff83ebfae2aea"/></dir><file name="shipping_method.phtml" hash="78afd96ad7c9facd083673c1122e6d42"/><file name="sidebar.phtml" hash="a8c13bf43d0c415f153d198a2bb6fa1f"/><file name="success.phtml" hash="0be1560fb1634864692691618aaea7bc"/></dir><dir name="page"><dir name="html"><file name="logo.phtml" hash="fb2d29e255453128bbdf37218289caf1"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Vaimo_Klarna.xml" hash="fece558fa050794401aca834b1b12fd4"/></dir></target><target name="magelocale"><dir name="da_DK"><file name="Vaimo_Klarna.csv" hash="867abdb2985a30f0dd4c0fc29d55f481"/></dir><dir name="de_AT"><file name="Vaimo_Klarna.csv" hash="f1006c802ab50acd76a8f1b9e060461b"/></dir><dir name="de_DE"><file name="Vaimo_Klarna.csv" hash="9707fefff9e5debda444de8ec7805ba7"/></dir><dir name="fi_FI"><file name="Vaimo_Klarna.csv" hash="8ec8cefda241e48a2302f3461e6f4f53"/></dir><dir name="nb_NO"><file name="Vaimo_Klarna.csv" hash="29fced20f334587c190cbc4ab8a310da"/></dir><dir name="nl_NL"><file name="Vaimo_Klarna.csv" hash="81c5a6c11d1adf5ab0fd114f53d9fcb8"/></dir><dir name="nn_NO"><file name="Vaimo_Klarna.csv" hash="6bbb8c704ed2f19a943fd8dbc6338e58"/></dir><dir name="sv_SE"><file name="Vaimo_Klarna.csv" hash="9c5a37bedb48277445ae0f6b643cb0c3"/></dir></target><target name="mage"><dir name="js"><dir name="vaimo"><dir name="klarna"><file name="klarna.js" hash="9462fee4ca415ee3d11a00d8b85548ec"/><file name="klarnacheckout.js" hash="625a1142a40bb621ad1a6193d38e1036"/><file name="klarnautils.js" hash="a114420988fdd3c1c90a1e08b24e49fe"/></dir></dir></dir></target><target name="magelib"><dir name="Klarna"><file name="CHANGELOG" hash="9808fe4dfd049d5130f7088adc374d72"/><file name="Changelog-Vaimo.txt" hash="b4f3e9df96ec0afcaf81ba1417fd7ebe"/><dir name="Checkout"><file name="BasicConnector.php" hash="8a9d008cda8e0805537b70d1e0e3bcd5"/><file name="ConnectionErrorException.php" hash="352ae3f5bbb18c04f0a9d3ca1be30faf"/><file name="Connector.php" hash="199d9134e8c5188e5b8f958ac1f17029"/><file name="ConnectorException.php" hash="fe4017579c8757798e018fb0755496c0"/><file name="ConnectorInterface.php" hash="0ebfd5610fec6ddce7b7fd0f45f3d1d6"/><file name="Digest.php" hash="d7c2ea4ff1f22c8919685aad7e4e9c8b"/><file name="Exception.php" hash="31a95e8212f01d149265f75e20b31bcb"/><dir name="HTTP"><file name="CURLFactory.php" hash="591493c487797a80fd76f4f80ca598d0"/><file name="CURLHandle.php" hash="2d58ba553ffddafdcc9c80bea0c2c5ee"/><file name="CURLHandleInterface.php" hash="df5e3ddf82deb09164c75249c7235756"/><file name="CURLHeaders.php" hash="2a900efb8591defaf9230368403c975f"/><file name="CURLTransport.php" hash="c35a9910a04007372c2d6673f4657b89"/><file name="Request.php" hash="180f04ffd522b713b4261087a7e60c68"/><file name="Response.php" hash="86993580c2a11b14bab4af6328caa6de"/><file name="Transport.php" hash="4aa96d5086e105d79b0f97593fbe5d9b"/><file name="TransportInterface.php" hash="3d6aab36479741136c9dee1bbcf3914e"/></dir><file name="Order.php" hash="568242a47b838ae9abf8438a4bc7301e"/><file name="ResourceInterface.php" hash="55fc925edc0f69a89f2d79e348152a2c"/><file name="UserAgent.php" hash="ee6a35f67e56391f5bdfa387616e5618"/></dir><file name="Checkout.php" hash="6e16bb237ecfc54f086a0d533a8e69e3"/><file name="CheckoutServiceRequest.php" hash="1167bf796772a24c5cf56586c255715b"/><file name="CheckoutServiceResponse.php" hash="021edd2464930618a0de024ea9bfc9f7"/><file name="Country.php" hash="449272bb9d3c4cf023137ab85266546c"/><file name="CurlHandle.php" hash="d7418f2db8bf726cb2913e10ce9a63ce"/><file name="CurlTransport.php" hash="03599602490c2089d7609c3006fe392c"/><file name="Currency.php" hash="b11ecbc754029f8b1d99d361b7daa2d3"/><file name="Encoding.php" hash="1893ca72010090f41ab5fab9a9a0029b"/><file name="Exceptions.php" hash="a94eb2811f2004c7e87ba5a82bd61d40"/><file name="Flags.php" hash="dcb034831717186be38530f52a39b24e"/><file name="Klarna.php" hash="7179469796b1b63dcd96b692dfa0b1a2"/><file name="Language.php" hash="a89d7e2d756db8ae94b5b2177507c319"/><dir name="checkoutkpm"><file name="checkouthtml.intf.php" hash="f6cc7512fbb13c0446d8492f747cd436"/><file name="threatmetrix.class.php" hash="ec5ceb6742df44623d96ce321c24fba5"/></dir><dir name="examples"><file name="activate.php" hash="3e2dbb97106ee405253330de0aa826d8"/><file name="cancelReservation.php" hash="948a933b769dea6a9684731adb471b8c"/><file name="checkOrderStatus.php" hash="1229fc0c6c96dbd81eec8d8919c4add5"/><file name="checkoutService.php" hash="fbaf5d7764d93fbc1b220e5f90518a90"/><file name="creditInvoice.php" hash="32669c3a1e52e716147ca63f0063c4a2"/><file name="creditPart.php" hash="594631f8358a32de1083ad98417feafe"/><file name="emailInvoice.php" hash="3c0d6ce69e2e33a85ea3f0e2d5c6fc7e"/><file name="fetchPClasses.php" hash="7bf7620a596da1edb52436e4f188827d"/><file name="getAddresses.php" hash="cf5eed9d9b772983f8e41a39b374c6ab"/><file name="hasAccount.php" hash="29670e02a3178df1afccbfb911474a6a"/><file name="helperFunctions.php" hash="3b25b4f51f83e156c33dadc6dcbb2097"/><file name="reserveAmount.php" hash="aa140d9548e31cade6c42a38e78f64df"/><file name="reserveOCR.php" hash="fcadfe8c99debda5a8f935b7fbc1ba4e"/><file name="returnAmount.php" hash="ef600f9a84d62fcce825f66bb1b570e2"/><file name="sendInvoice.php" hash="2e2a53099c64daeb9f06abd81af2a0f5"/><file name="splitReservation.php" hash="ec2d26bae9dae03679f5272b7782a4e1"/><file name="update.php" hash="6e1fcd9f371cc4b12caca37933a51a55"/></dir><file name="klarnaaddr.php" hash="01075b4e2dd3987ef38efaa6b1ced54b"/><file name="klarnacalc.php" hash="2df31b6126716e91eaeea90f7ab2ca87"/><file name="klarnaconfig.php" hash="369278865db177e690b6d7757ca38c07"/><file name="klarnapclass.php" hash="30c5f867b8c8febc944871e75d240e65"/><dir name="pclasses"><file name="jsonstorage.class.php" hash="04f0d90ada9fd12d5f0de6448466f798"/><file name="mysqlstorage.class.php" hash="ad2d075301d730f97c7a895a2ebb7523"/><file name="sqlstorage.class.php" hash="e00df72512eac3998710a4b2f9ea89c8"/><file name="storage.intf.php" hash="032631d1f075d1eff09ccf926ea56417"/><file name="xmlstorage.class.php" hash="a47820de9cdcfb261de0e95fc92a2a64"/></dir><dir name="transport"><dir name="xmlrpc-3.0.0.beta"><dir name="lib"><file name="xmlrpc.inc" hash="5a74ea2a831648febc9b2c8f809b252c"/><file name="xmlrpc_wrappers.inc" hash="5aa00141ead09fc5498d9a3c9fcab888"/><file name="xmlrpcs.inc" hash="158b97bda79333e9b40793d876b6e98f"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="vaimo"><dir name="klarna"><dir name="css"><file name="admin.css" hash="ef4915be839e2039fb037f29c1506d30"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="vaimo"><dir name="klarna"><file name="checkout.css" hash="7d7fe12675f4ba51ad1fd608849f06ce"/><file name="checkout_osc.css" hash="126a8d2869872306ded4aef943db809c"/><file name="global.css" hash="22b6a446e6e874e6a95608f7046eac2a"/><file name="klarnacheckout.css" hash="00c9b9ec2e2458207a7e6a8fe061529a"/><file name="klarnadefault.css" hash="30bff2ef19a5a70b4ee9a458c504870c"/><file name="product.css" hash="ef6a838858ceb0c1ef6364bb089273c0"/><dir name="vendor"><file name="bootstrap-grid.css" hash="093d2cb25f2e4d0bc80233ed70cbcb9a"/><file name="bootstrap-grid.min.css" hash="9087d9a8c2457c96b6c216fea959b298"/><file name="fontawesome.css" hash="76ca4ed8592634fb5c421b4e19c35918"/><file name="fontawesome.min.css" hash="7b7b345da453c034563dd2ac7ca9666b"/><dir name="fonts"><file name="FontAwesome.otf" hash="19231917733e2bcdf257c9be99cdbaf1"/><file name="fontawesome-webfont.eot" hash="7149833697a959306ec3012a8588dcfa"/><file name="fontawesome-webfont.svg" hash="65bcbc899f379216109acd0b6c494618"/><file name="fontawesome-webfont.ttf" hash="c4668ed2440df82d3fd2f8be9d31d07d"/><file name="fontawesome-webfont.woff" hash="d95d6f5d5ab7cfefd09651800b69bd54"/></dir></dir></dir></dir></dir><dir name="images"><dir name="vaimo"><dir name="klarna"><file name="balk_afm3.jpg" hash="8855567960bff35b1e3ba486670b5878"/><file name="icons.png" hash="7f0808d4cf63c3d43637d40a703f30fe"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Vaimo"><dir name="Klarna"><dir name="Block"><dir name="Adminhtml"><dir name="Pclass"><file name="List.php" hash="7c68e3ec74e5cea1b62bb0218d297089"/><file name="Update.php" hash="fd444645b9f78fc4ea65c91ee3fc0044"/></dir><dir name="Sales"><dir name="Creditmemo"><dir name="Create"><file name="Adjustments.php" hash="12074f6aabbe90f14b8d30b7f65da9dc"/></dir><file name="Totals.php" hash="f66e5ee88f95b0b4c2f032b2a4378b5d"/></dir><dir name="Invoice"><file name="Totals.php" hash="bc28f21c484fe2b4ca6d7a06da726fc3"/></dir><dir name="Order"><file name="Totals.php" hash="c80ca5283b0341964c36e70a850faaf6"/></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Pricewidget.php" hash="a77d8ca953136f3fe9797166f8a51e93"/></dir></dir><dir name="Checkout"><file name="Fee.php" hash="1ffae1896b12e6d87fbbd2d3843fef75"/><file name="Top.php" hash="a8f9084322c1f924ef6fb4802908019d"/></dir><dir name="Form"><file name="Abstract.php" hash="da5fa0957ab2b1e3b57ca99a9323fadb"/><file name="Account.php" hash="f6bf008c1af0b93ead5b5a2577b59ea5"/><dir name="Address"><file name="Search.php" hash="439e9f9a5d9480a4356043bb73f9c9c7"/></dir><file name="Checkout.php" hash="a7e6876317a29184f07040b646b84ec7"/><file name="Invoice.php" hash="105a41b84e52b45f26f3c5de2d4bdd4a"/><dir name="Paymentplan"><file name="Information.php" hash="7c66acd887a1e3a165e3cd967d0f3331"/></dir><file name="Special.php" hash="8db5a5f33510cd32d724c6ecd6368aa2"/></dir><dir name="Info"><file name="Abstract.php" hash="b1f368a985cb611c2bb97385a313d6d7"/><file name="Account.php" hash="d302c2fc556e05858464fadd51cd4854"/><file name="Checkout.php" hash="df92291673e6bfe63ac968ad7297cca3"/><file name="Invoice.php" hash="f98adb5521f6c546c462f2e5bde31295"/><file name="Special.php" hash="e07662f39f0ff65505bfd627045c7766"/></dir><dir name="Invoice"><file name="Totals.php" hash="2437d7c7d7499d3ee2fcb7e0426ad64d"/></dir><dir name="Klarnacheckout"><file name="Autofill.php" hash="4fb4d1c806c2224d20a388b62f027e33"/><dir name="Customer"><file name="Balance.php" hash="e35153845d979d91ff79d0558e7b6c0b"/></dir><file name="Discount.php" hash="63bb0c1991030522371eb3b798055c39"/><file name="Ga.php" hash="85c7c0c08945c3470feefd60f905f7a2"/><file name="Klarnacheckout.php" hash="edf4af7c33d250c894087ad7c8a73936"/><file name="Newsletter.php" hash="ce97e11c097b0cd9696919936fa59dc6"/><file name="Othermethod.php" hash="7af2512fb570dc467fd0d240c4963417"/><file name="Reward.php" hash="98d72b6cf65070dcb4cc87a303cd8b54"/><file name="Success.php" hash="be47582d12b9b9362ac119715f3e6ea7"/></dir><dir name="Order"><file name="Totals.php" hash="2e56335ff1b4a1d6752e7336b107bd13"/></dir><dir name="Page"><dir name="Html"><file name="Logo.php" hash="fda8fc32997328feb9c7ebf15c8a51fa"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Position"><dir name="Attribute"><file name="Set.php" hash="b47d1dff880be4e0d22f8f169f180bc3"/></dir></dir><file name="Position.php" hash="469a02a99354ae219f5b744b248c76b8"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AddressController.php" hash="4ae9ea28491b66ca7a69c3bd0646cacb"/><dir name="Adminhtml"><dir name="Klarna"><file name="MassactionController.php" hash="a5679cee64b19d9742753f2b537cdaeb"/><file name="PclassController.php" hash="96836bd2a4ae7b145d9bedbbdf20e4f5"/></dir></dir><dir name="Checkout"><file name="KlarnaController.php" hash="467d6a238cbe4593fd0d31bee3029636"/></dir><file name="LoginController.php" hash="1356e1cb1b8889bb1f8b9bdf624f96ab"/><file name="PaymentplanController.php" hash="fea9d33a5dbd5d4858ef174569dae636"/></dir><dir name="etc"><file name="config.xml" hash="758c59e6c73b01702b1d7c99adf774b0"/><file name="system.xml" hash="77b296f292066eea0c18073db115922d"/></dir><dir name="Helper"><file name="Data.php" hash="931649a11c0c9c6b290196109b62923f"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Admin"><file name="Json.php" hash="e6413eca01dc9e4e6715e518ffa59eae"/></dir></dir></dir></dir></dir><dir name="Api"><file name="Abstract.php" hash="856b33b3edda10b04f560247b8d3ca43"/><file name="Kco.php" hash="431d191a2ca99a6a97c078a900d33eba"/><file name="Rest.php" hash="98a8111a8be139e6d977fdace60c00e5"/><file name="Xmlrpc.php" hash="f95a37b0178102a56a3e3dbe8129258f"/></dir><file name="Api.php" hash="0c9a565b4909373b16c6701af7356186"/><dir name="Creditmemo"><file name="Tax.php" hash="5ea5e807daf26d1501d39708b2fdb4e8"/><file name="Total.php" hash="f6df6603a344038b332c88f5f61c585e"/></dir><file name="Cron.php" hash="2c1725cd81cd50a3c577193a58d178a9"/><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="ad43316939aab5ff1910ebb45ab1f9e4"/></dir><file name="Tax.php" hash="b2203547b3f05d6179e7307d14b55c6d"/><file name="Total.php" hash="c2f4a2207550915e1aaa9868e6759f94"/></dir><dir name="Klarna"><file name="Abstract.php" hash="df64121d6fd494d631acc997b8d66f55"/></dir><file name="Klarna.php" hash="1352e5b163aa33f872c20981710d410d"/><dir name="Klarnacheckout"><file name="Abstract.php" hash="891e47c5367f4d921e6ffea051d1838b"/></dir><file name="Klarnacheckout.php" hash="6c000738b9ae4723711b78520b2425b6"/><file name="Observer.php" hash="d792a487f8c1d4b032a656e79307443a"/><dir name="Payment"><file name="Abstract.php" hash="20a6b0e61de17ddb456983a44cfd2bcc"/><file name="Account.php" hash="95931980dba66fc274f3acfa4df2b91a"/><file name="Checkout.php" hash="1f9a97206d5fa20e46e3174da799b5fa"/><file name="Invoice.php" hash="eef0e5ea5466469942a14d28e8507333"/><file name="Special.php" hash="53754f59a474e32f168220c795b80c2f"/></dir><file name="Pushqueue.php" hash="cb74fc4cd2e34077b8be5f45c49dac28"/><dir name="Quote"><file name="Tax.php" hash="b53f4a52d0f09afc7daeb094d6e30881"/><file name="Total.php" hash="a1442ecba3f2c49a42ff43e006057878"/></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="0a40d43403823a6053d74bd2d2f688e7"/></dir><dir name="Pushqueue"><file name="Collection.php" hash="cdbfe12d3f3d82c60c699e2e4700645b"/></dir><file name="Pushqueue.php" hash="0ccf2419c79a847f8095f9ef8ca349de"/></dir><dir name="Source"><file name="Abstract.php" hash="8d0d746d1cd2e5bc7d11350908a01585"/><file name="Allspecificcountries.php" hash="1a98316e25baeaba307b3be62364e1ca"/><file name="Apiversion.php" hash="a1be9e12b858927cbfa459509fff3647"/><file name="Capture.php" hash="c2d31ebb607202555e9905e439dbe86d"/><file name="Country.php" hash="2444140a6155e42d2e4909ae150037b7"/><file name="Customergroup.php" hash="01c6e41abac6e7105e4d290f53f68733"/><file name="Klarnalayout.php" hash="6c7b9d3a871d8cdb2a11a0cadde83f4a"/><file name="Language.php" hash="ca8bc4334348501a96f109aec5f9a01a"/><file name="Newsletter.php" hash="f1532e5ff4c7e04384e9410cbb0969fa"/><file name="Servermode.php" hash="7acd8c7bb39f640dccef12df69ed7c57"/><file name="Taxclass.php" hash="de1ebcf0027eaff23f676da569034ed7"/><file name="Yesnodefault.php" hash="a296d6a62f1f1858ac093c0d7974cf6a"/></dir><dir name="Tax"><file name="Config.php" hash="7767f6d07f63df09228ab6c496ed0c05"/></dir><dir name="Transport"><file name="Abstract.php" hash="983db79406daa52d7206245dd4140bcc"/></dir></dir><dir name="sql"><dir name="klarna_setup"><file name="mysql4-install-0.1.0.php" hash="d36b51433fd28241386594f39def3080"/><file name="mysql4-upgrade-5.1.6-5.1.7.php" hash="014a7b827a8958a94c57a0229127a427"/><file name="mysql4-upgrade-5.2.5-5.2.6.php" hash="1dd874e1a94730ab976b6187a34e6c77"/><file name="mysql4-upgrade-5.3.24-5.3.25.php" hash="ec5af38cfd42c2b2b16343546a152fd8"/><file name="mysql4-upgrade-5.3.4-5.3.5.php" hash="64ff4fc928b39153a89857169faa7c70"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>klarnapayments</name>
4
+ <version>5.5.1</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
10
  <description>Klarna payment module for Klarna Checkout, invoice and part payments. This module works for all countries were Klarna's product offering is applicable. To use this module requires that you have a contract with Klarna.</description>
11
  <notes>This version is not compatible with any Klarna module version of 4.x or earlier.</notes>
12
  <authors><author><name>Klarna</name><user>Klarna</user><email>magento@klarna.com</email></author><author><name>Vaimo</name><user>VAIMO</user><email>info@vaimo.com</email></author></authors>
13
+ <date>2017-02-16</date>
14
+ <time>02:10:35</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="vaimo_klarna.xml" hash="19a196d33bcc2e1eaf4413dcefeb5f04"/></dir><dir name="template"><dir name="vaimo"><dir name="klarna"><dir name="creditmemo"><dir name="totals"><file name="adjustments.phtml" hash="b0299ac0b1ca75b4d143413cc8eb8217"/></dir></dir><dir name="info"><file name="account.phtml" hash="4c51cb3b4aeb54bb009e384d300ece98"/><file name="checkout.phtml" hash="679e88a49ec331cec8df1b8f09e39758"/><dir name="children"><file name="invoicefee.phtml" hash="2b721be479706716f6468c8395455fa5"/><file name="invoices.phtml" hash="ac4e3bd4aea83e9ea3479fc04ed0d5a4"/><file name="notices.phtml" hash="a5053c7829df05fd8afb30d5019b1aca"/><file name="paymentplan.phtml" hash="885c020c05afd4516a42a33a6986f32f"/><file name="reference.phtml" hash="a789d5c8d4253c6ba4d894e2f0465f9c"/><file name="reservation.phtml" hash="d96f36640577e8e053050c24bfb4ec43"/></dir><file name="invoice.phtml" hash="498a1d706ac1da4fc71982f1232de492"/><file name="special.phtml" hash="4c51cb3b4aeb54bb009e384d300ece98"/></dir><dir name="pclass"><file name="list.phtml" hash="5cef6b0093bb5da18dbf1f9fd7316c66"/><file name="update.phtml" hash="ed53d5eb248f8181cd601e7b10cb170f"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="vaimo_klarna.xml" hash="4fda0bc7525f55705ef334c26f10a36d"/></dir><dir name="template"><dir name="vaimo"><dir name="klarna"><dir name="catalog"><dir name="product"><file name="pricewidget.phtml" hash="ade52495b519d3cfd6f53a4285be895f"/></dir></dir><dir name="checkout"><file name="fee.phtml" hash="3a58d7e7278bf9fcae1cdb9d836d4ff3"/><file name="header.phtml" hash="51a7f95f2fcb5f7b02e19b13690631a8"/><file name="top.phtml" hash="9cc1ce32346bd6ed7c16139f3f960a95"/></dir><dir name="form"><file name="account.phtml" hash="7b763a6452a9268b2489885cf7e2bb98"/><dir name="address"><file name="search.phtml" hash="b9132e082389d1007c2f93fffbfe7c3e"/></dir><file name="checkout.phtml" hash="fe86056c73f86d53a73ebda5c5f3547c"/><dir name="children"><file name="addressresult.phtml" hash="f1b9f6faef2304268dfb5a2ed33cac6d"/><file name="checkoutservice.phtml" hash="bb5630aaa5a24fff401854c5a0e1d561"/><file name="consent.phtml" hash="a4f446258fa20a453d3566cffc20085d"/><file name="dateofbirth.phtml" hash="e1dbe367ce43029d671dae6f7d3ca956"/><file name="gender.phtml" hash="c8428e9b76db957a866cfc109d7a0c09"/><file name="notifications.phtml" hash="2d91f392c4c2fee89ada3c53719dc47f"/><file name="paymentplan_information.phtml" hash="8f28c418c08df3e664744ef28bc283c3"/><file name="pclass.phtml" hash="848a7e485badbdf11d10628c93906b21"/><file name="personalnumber.phtml" hash="dcea08f692ed978689242ba8309f3cdb"/><file name="phonenumber.phtml" hash="6348b12795e073d8881ab0b74d7df175"/></dir><file name="invoice.phtml" hash="3f04b37ccaf9d6626e5a95a9fa847916"/><dir name="paymentplan"><file name="information.phtml" hash="d013f147f38502cb4baf591d56d177d9"/></dir><file name="special.phtml" hash="05ada24ff6c7cb813f498920eddd90bb"/></dir><dir name="info"><file name="account.phtml" hash="a848c9544a5e400bc27e26d050eafa3c"/><file name="checkout.phtml" hash="cbcd2d9379f2afbd450fb925c05aa4ed"/><dir name="children"><file name="invoicefee.phtml" hash="c6b4ccff75e220c5641a8fadd6753131"/><file name="invoices.phtml" hash="892672664fe645193471a26bb052c18b"/><file name="notices.phtml" hash="26571bbd4c152f4f39c5b0281adff251"/><file name="paymentplan.phtml" hash="3a73d918dc733c0888f18e442f9eb64c"/><file name="reference.phtml" hash="60e6eaabc7ff88a7762ce97c45d151e0"/><file name="reservation.phtml" hash="9880ef8208f672d531cc10eef8467856"/></dir><file name="invoice.phtml" hash="cd3514e43dd441b4530b95e408784d84"/><file name="special.phtml" hash="c472684055c8839b8e365b80a5e1ee0c"/></dir><dir name="klarnacheckout"><file name="account-login.phtml" hash="487de8f489b7e65416bf3559e1819abd"/><file name="autofill.phtml" hash="6bdd6c22fd1771106f52876e66d7f4de"/><dir name="cart"><dir name="item"><file name="default.phtml" hash="cb76c84ce20dbd391a1615756f2d72d7"/></dir><file name="totals.phtml" hash="a8496f65d2bd8390cee2bb5c89bad555"/></dir><file name="cart.phtml" hash="9dd4348207c7bab904a92e51da1126ec"/><file name="checkout.phtml" hash="c71826694ac6270f82a05e69a896d66b"/><dir name="customer"><file name="balance.phtml" hash="af890728b26b0808c299ab199bc5f4c0"/></dir><file name="default.phtml" hash="357abf99f4cb926d728c7c5253ea4b1e"/><dir name="discount"><file name="coupon.phtml" hash="0e4c2c52f677212b2071e3acddcc217a"/><file name="giftcardaccount.phtml" hash="899da6ea4aff7ae42be60babe2974aa5"/></dir><file name="discount.phtml" hash="7ce3289506c3e8abdd4af610e0f7f273"/><file name="header.phtml" hash="d25937ce1facfe47e16e63dff56e337a"/><file name="klarnacheckout.phtml" hash="a51ee31586f4cbeb5bfe0ffe1ca32c84"/><file name="main.phtml" hash="079d3162d46b762574eb2cd4641c14c2"/><file name="msg.phtml" hash="d716a2a466835c99f71bea1742533cc0"/><file name="newsletter.phtml" hash="34e007c7bd516cd37e93cb5bd9f19478"/><file name="othermethod.phtml" hash="f619075a30bf6240753a186636b5c2f4"/><file name="reward.phtml" hash="0e1d0a7d42738662fddd04dab09f5765"/><dir name="shipping_method"><file name="available.phtml" hash="62991e138e2a296fc0aff83ebfae2aea"/></dir><file name="shipping_method.phtml" hash="78afd96ad7c9facd083673c1122e6d42"/><file name="sidebar.phtml" hash="a8c13bf43d0c415f153d198a2bb6fa1f"/><file name="success.phtml" hash="0be1560fb1634864692691618aaea7bc"/></dir><dir name="page"><dir name="html"><file name="logo.phtml" hash="fb2d29e255453128bbdf37218289caf1"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Vaimo_Klarna.xml" hash="fece558fa050794401aca834b1b12fd4"/></dir></target><target name="magelocale"><dir name="da_DK"><file name="Vaimo_Klarna.csv" hash="8892c078c159c6a33c37c603151346d6"/></dir><dir name="de_AT"><file name="Vaimo_Klarna.csv" hash="92bdfb1b5ed435ff08ee78aafd24e885"/></dir><dir name="de_DE"><file name="Vaimo_Klarna.csv" hash="3919947ebef89bf752bb1fcdbccf3a3d"/></dir><dir name="fi_FI"><file name="Vaimo_Klarna.csv" hash="81930b28e58c4f79d8687cfed56d3a13"/></dir><dir name="nb_NO"><file name="Vaimo_Klarna.csv" hash="fd6b7ef7614260630ff816784b624e13"/></dir><dir name="nl_NL"><file name="Vaimo_Klarna.csv" hash="d8d99e7d654199272b0c0eb179a3c0df"/></dir><dir name="nn_NO"><file name="Vaimo_Klarna.csv" hash="361a4c85de0fcebd821ecbab22c9c633"/></dir><dir name="sv_SE"><file name="Vaimo_Klarna.csv" hash="71f1563d89cfacdc6f8bf9314939ae42"/></dir></target><target name="mage"><dir name="js"><dir name="vaimo"><dir name="klarna"><file name="klarna.js" hash="9462fee4ca415ee3d11a00d8b85548ec"/><file name="klarnacheckout.js" hash="56b9ee2550cfd1e4f1c741ad7611f70f"/><file name="klarnautils.js" hash="a114420988fdd3c1c90a1e08b24e49fe"/></dir></dir></dir></target><target name="magelib"><dir name="Klarna"><file name="CHANGELOG" hash="9808fe4dfd049d5130f7088adc374d72"/><file name="Changelog-Vaimo.txt" hash="b4f3e9df96ec0afcaf81ba1417fd7ebe"/><dir name="Checkout"><file name="BasicConnector.php" hash="8a9d008cda8e0805537b70d1e0e3bcd5"/><file name="ConnectionErrorException.php" hash="352ae3f5bbb18c04f0a9d3ca1be30faf"/><file name="Connector.php" hash="199d9134e8c5188e5b8f958ac1f17029"/><file name="ConnectorException.php" hash="fe4017579c8757798e018fb0755496c0"/><file name="ConnectorInterface.php" hash="0ebfd5610fec6ddce7b7fd0f45f3d1d6"/><file name="Digest.php" hash="d7c2ea4ff1f22c8919685aad7e4e9c8b"/><file name="Exception.php" hash="31a95e8212f01d149265f75e20b31bcb"/><dir name="HTTP"><file name="CURLFactory.php" hash="591493c487797a80fd76f4f80ca598d0"/><file name="CURLHandle.php" hash="2d58ba553ffddafdcc9c80bea0c2c5ee"/><file name="CURLHandleInterface.php" hash="df5e3ddf82deb09164c75249c7235756"/><file name="CURLHeaders.php" hash="2a900efb8591defaf9230368403c975f"/><file name="CURLTransport.php" hash="c35a9910a04007372c2d6673f4657b89"/><file name="Request.php" hash="180f04ffd522b713b4261087a7e60c68"/><file name="Response.php" hash="86993580c2a11b14bab4af6328caa6de"/><file name="Transport.php" hash="4aa96d5086e105d79b0f97593fbe5d9b"/><file name="TransportInterface.php" hash="3d6aab36479741136c9dee1bbcf3914e"/></dir><file name="Order.php" hash="568242a47b838ae9abf8438a4bc7301e"/><file name="ResourceInterface.php" hash="55fc925edc0f69a89f2d79e348152a2c"/><file name="UserAgent.php" hash="ee6a35f67e56391f5bdfa387616e5618"/></dir><file name="Checkout.php" hash="6e16bb237ecfc54f086a0d533a8e69e3"/><file name="CheckoutServiceRequest.php" hash="1167bf796772a24c5cf56586c255715b"/><file name="CheckoutServiceResponse.php" hash="021edd2464930618a0de024ea9bfc9f7"/><file name="Country.php" hash="449272bb9d3c4cf023137ab85266546c"/><file name="CurlHandle.php" hash="d7418f2db8bf726cb2913e10ce9a63ce"/><file name="CurlTransport.php" hash="03599602490c2089d7609c3006fe392c"/><file name="Currency.php" hash="b11ecbc754029f8b1d99d361b7daa2d3"/><file name="Encoding.php" hash="1893ca72010090f41ab5fab9a9a0029b"/><file name="Exceptions.php" hash="a94eb2811f2004c7e87ba5a82bd61d40"/><file name="Flags.php" hash="dcb034831717186be38530f52a39b24e"/><file name="Klarna.php" hash="7179469796b1b63dcd96b692dfa0b1a2"/><file name="Language.php" hash="a89d7e2d756db8ae94b5b2177507c319"/><dir name="checkoutkpm"><file name="checkouthtml.intf.php" hash="f6cc7512fbb13c0446d8492f747cd436"/><file name="threatmetrix.class.php" hash="ec5ceb6742df44623d96ce321c24fba5"/></dir><dir name="examples"><file name="activate.php" hash="3e2dbb97106ee405253330de0aa826d8"/><file name="cancelReservation.php" hash="948a933b769dea6a9684731adb471b8c"/><file name="checkOrderStatus.php" hash="1229fc0c6c96dbd81eec8d8919c4add5"/><file name="checkoutService.php" hash="fbaf5d7764d93fbc1b220e5f90518a90"/><file name="creditInvoice.php" hash="32669c3a1e52e716147ca63f0063c4a2"/><file name="creditPart.php" hash="594631f8358a32de1083ad98417feafe"/><file name="emailInvoice.php" hash="3c0d6ce69e2e33a85ea3f0e2d5c6fc7e"/><file name="fetchPClasses.php" hash="7bf7620a596da1edb52436e4f188827d"/><file name="getAddresses.php" hash="cf5eed9d9b772983f8e41a39b374c6ab"/><file name="hasAccount.php" hash="29670e02a3178df1afccbfb911474a6a"/><file name="helperFunctions.php" hash="3b25b4f51f83e156c33dadc6dcbb2097"/><file name="reserveAmount.php" hash="aa140d9548e31cade6c42a38e78f64df"/><file name="reserveOCR.php" hash="fcadfe8c99debda5a8f935b7fbc1ba4e"/><file name="returnAmount.php" hash="ef600f9a84d62fcce825f66bb1b570e2"/><file name="sendInvoice.php" hash="2e2a53099c64daeb9f06abd81af2a0f5"/><file name="splitReservation.php" hash="ec2d26bae9dae03679f5272b7782a4e1"/><file name="update.php" hash="6e1fcd9f371cc4b12caca37933a51a55"/></dir><file name="klarnaaddr.php" hash="01075b4e2dd3987ef38efaa6b1ced54b"/><file name="klarnacalc.php" hash="2df31b6126716e91eaeea90f7ab2ca87"/><file name="klarnaconfig.php" hash="369278865db177e690b6d7757ca38c07"/><file name="klarnapclass.php" hash="30c5f867b8c8febc944871e75d240e65"/><dir name="pclasses"><file name="jsonstorage.class.php" hash="04f0d90ada9fd12d5f0de6448466f798"/><file name="mysqlstorage.class.php" hash="5200e7cf2edb32dd36c93fe7764338df"/><file name="sqlstorage.class.php" hash="e00df72512eac3998710a4b2f9ea89c8"/><file name="storage.intf.php" hash="032631d1f075d1eff09ccf926ea56417"/><file name="xmlstorage.class.php" hash="a47820de9cdcfb261de0e95fc92a2a64"/></dir><dir name="transport"><dir name="xmlrpc-3.0.0.beta"><dir name="lib"><file name="xmlrpc.inc" hash="aee3522be844abe7cfd7ad75b17361fc"/><file name="xmlrpc_wrappers.inc" hash="5aa00141ead09fc5498d9a3c9fcab888"/><file name="xmlrpcs.inc" hash="978cc4d87b64ee9dd1d81988b2d507dd"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="vaimo"><dir name="klarna"><dir name="css"><file name="admin.css" hash="ef4915be839e2039fb037f29c1506d30"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="vaimo"><dir name="klarna"><file name="checkout.css" hash="d064b6d34c5201e858ddcd243cb6887f"/><file name="checkout_osc.css" hash="f8cc8a005076d7e54fb3267575fbb63a"/><file name="global.css" hash="22b6a446e6e874e6a95608f7046eac2a"/><file name="klarnacheckout.css" hash="c6aabaf54717727b361b72db5d0a1ee1"/><file name="klarnadefault.css" hash="30bff2ef19a5a70b4ee9a458c504870c"/><file name="product.css" hash="ef6a838858ceb0c1ef6364bb089273c0"/><dir name="vendor"><file name="bootstrap-grid.css" hash="093d2cb25f2e4d0bc80233ed70cbcb9a"/><file name="bootstrap-grid.min.css" hash="9087d9a8c2457c96b6c216fea959b298"/><file name="fontawesome.css" hash="76ca4ed8592634fb5c421b4e19c35918"/><file name="fontawesome.min.css" hash="7b7b345da453c034563dd2ac7ca9666b"/><dir name="fonts"><file name="FontAwesome.otf" hash="19231917733e2bcdf257c9be99cdbaf1"/><file name="fontawesome-webfont.eot" hash="7149833697a959306ec3012a8588dcfa"/><file name="fontawesome-webfont.svg" hash="65bcbc899f379216109acd0b6c494618"/><file name="fontawesome-webfont.ttf" hash="c4668ed2440df82d3fd2f8be9d31d07d"/><file name="fontawesome-webfont.woff" hash="d95d6f5d5ab7cfefd09651800b69bd54"/></dir></dir></dir></dir></dir><dir name="images"><dir name="vaimo"><dir name="klarna"><file name="balk_afm3.jpg" hash="8855567960bff35b1e3ba486670b5878"/><file name="icons.png" hash="7f0808d4cf63c3d43637d40a703f30fe"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Vaimo"><dir name="Klarna"><dir name="Block"><dir name="Adminhtml"><dir name="Pclass"><file name="List.php" hash="7c68e3ec74e5cea1b62bb0218d297089"/><file name="Update.php" hash="fd444645b9f78fc4ea65c91ee3fc0044"/></dir><dir name="Sales"><dir name="Creditmemo"><dir name="Create"><file name="Adjustments.php" hash="12074f6aabbe90f14b8d30b7f65da9dc"/></dir><file name="Totals.php" hash="f66e5ee88f95b0b4c2f032b2a4378b5d"/></dir><dir name="Invoice"><file name="Totals.php" hash="bc28f21c484fe2b4ca6d7a06da726fc3"/></dir><dir name="Order"><file name="Totals.php" hash="c80ca5283b0341964c36e70a850faaf6"/></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Pricewidget.php" hash="a77d8ca953136f3fe9797166f8a51e93"/></dir></dir><dir name="Checkout"><file name="Fee.php" hash="1ffae1896b12e6d87fbbd2d3843fef75"/><file name="Top.php" hash="a8f9084322c1f924ef6fb4802908019d"/></dir><dir name="Form"><file name="Abstract.php" hash="46debd83a53c232715f35a98e24c56a0"/><file name="Account.php" hash="f6bf008c1af0b93ead5b5a2577b59ea5"/><dir name="Address"><file name="Search.php" hash="439e9f9a5d9480a4356043bb73f9c9c7"/></dir><file name="Checkout.php" hash="a7e6876317a29184f07040b646b84ec7"/><file name="Invoice.php" hash="105a41b84e52b45f26f3c5de2d4bdd4a"/><dir name="Paymentplan"><file name="Information.php" hash="7c66acd887a1e3a165e3cd967d0f3331"/></dir><file name="Special.php" hash="8db5a5f33510cd32d724c6ecd6368aa2"/></dir><dir name="Info"><file name="Abstract.php" hash="b1f368a985cb611c2bb97385a313d6d7"/><file name="Account.php" hash="d302c2fc556e05858464fadd51cd4854"/><file name="Checkout.php" hash="df92291673e6bfe63ac968ad7297cca3"/><file name="Invoice.php" hash="f98adb5521f6c546c462f2e5bde31295"/><file name="Special.php" hash="e07662f39f0ff65505bfd627045c7766"/></dir><dir name="Invoice"><file name="Totals.php" hash="2437d7c7d7499d3ee2fcb7e0426ad64d"/></dir><dir name="Klarnacheckout"><file name="Autofill.php" hash="4fb4d1c806c2224d20a388b62f027e33"/><dir name="Customer"><file name="Balance.php" hash="e35153845d979d91ff79d0558e7b6c0b"/></dir><file name="Discount.php" hash="63bb0c1991030522371eb3b798055c39"/><file name="Ga.php" hash="85c7c0c08945c3470feefd60f905f7a2"/><file name="Klarnacheckout.php" hash="c50851a2e17865965ec5596a2256f9bd"/><file name="Newsletter.php" hash="ce97e11c097b0cd9696919936fa59dc6"/><file name="Othermethod.php" hash="7af2512fb570dc467fd0d240c4963417"/><file name="Reward.php" hash="98d72b6cf65070dcb4cc87a303cd8b54"/><file name="Success.php" hash="be47582d12b9b9362ac119715f3e6ea7"/></dir><dir name="Order"><file name="Totals.php" hash="2e56335ff1b4a1d6752e7336b107bd13"/></dir><dir name="Page"><dir name="Html"><file name="Logo.php" hash="fda8fc32997328feb9c7ebf15c8a51fa"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Position"><dir name="Attribute"><file name="Set.php" hash="b47d1dff880be4e0d22f8f169f180bc3"/></dir></dir><file name="Position.php" hash="469a02a99354ae219f5b744b248c76b8"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AddressController.php" hash="4ae9ea28491b66ca7a69c3bd0646cacb"/><dir name="Adminhtml"><dir name="Klarna"><file name="MassactionController.php" hash="a5679cee64b19d9742753f2b537cdaeb"/><file name="PclassController.php" hash="96836bd2a4ae7b145d9bedbbdf20e4f5"/></dir></dir><dir name="Checkout"><file name="KlarnaController.php" hash="b1f529a651d239301fa2b392fa99af10"/></dir><file name="LoginController.php" hash="1356e1cb1b8889bb1f8b9bdf624f96ab"/><file name="PaymentplanController.php" hash="fea9d33a5dbd5d4858ef174569dae636"/></dir><dir name="etc"><file name="config.xml" hash="f4db0c872cbe9acb04437d22fdb1f858"/><file name="system.xml" hash="c9ffa5b830c928e713540665de35325e"/></dir><dir name="Helper"><file name="Data.php" hash="3e18d9c736f382f0ccc4fb6757277836"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Admin"><file name="Json.php" hash="e6413eca01dc9e4e6715e518ffa59eae"/></dir></dir></dir></dir></dir><dir name="Api"><file name="Abstract.php" hash="f3a7010a8e8c097fcecd067178be51be"/><file name="Kco.php" hash="c4eadb79c763b6135050a24e34c8c691"/><file name="Rest.php" hash="92f0c141ffe2014d7b7ecdfb0add5025"/><file name="Xmlrpc.php" hash="f95a37b0178102a56a3e3dbe8129258f"/></dir><file name="Api.php" hash="0c9a565b4909373b16c6701af7356186"/><dir name="Creditmemo"><file name="Tax.php" hash="3628f49e4a06db4dd2cfa5d81fd07688"/><file name="Total.php" hash="44822705c32c2ddff7f5245208133519"/></dir><file name="Cron.php" hash="8c1d9bbadc37ce2bc1495fa749e510e3"/><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="ad43316939aab5ff1910ebb45ab1f9e4"/></dir><file name="Tax.php" hash="b2203547b3f05d6179e7307d14b55c6d"/><file name="Total.php" hash="c2f4a2207550915e1aaa9868e6759f94"/></dir><dir name="Klarna"><file name="Abstract.php" hash="fcac69b043df1dc7a5f55a80fcb93265"/></dir><file name="Klarna.php" hash="3714c86ad12f3ee8ad0e41e6061e46a4"/><dir name="Klarnacheckout"><file name="Abstract.php" hash="891e47c5367f4d921e6ffea051d1838b"/><file name="History.php" hash="8c4943f1ae3ecd8a2f23dd308594b1f6"/><file name="Semaphore.php" hash="1df3f2372fa2e4b437669aaeeb8c95e5"/></dir><file name="Klarnacheckout.php" hash="6f516d0435b35ac17772acb15a6bd0ad"/><dir name="Log"><file name="Data.php" hash="e4e53784e70ec7c29777a68550ce249b"/></dir><file name="Log.php" hash="e1a01c1e9aab1487152086c57e235f47"/><file name="Observer.php" hash="5ac8975589cec6bc5e5d1203de9283ed"/><dir name="Payment"><file name="Abstract.php" hash="a44d2829994df0080e922190ad5e97e3"/><file name="Account.php" hash="95931980dba66fc274f3acfa4df2b91a"/><file name="Checkout.php" hash="1f9a97206d5fa20e46e3174da799b5fa"/><file name="Invoice.php" hash="eef0e5ea5466469942a14d28e8507333"/><file name="Special.php" hash="53754f59a474e32f168220c795b80c2f"/></dir><dir name="Quote"><file name="Tax.php" hash="b53f4a52d0f09afc7daeb094d6e30881"/><file name="Total.php" hash="a1442ecba3f2c49a42ff43e006057878"/></dir><dir name="Resource"><dir name="Klarnacheckout"><dir name="History"><file name="Collection.php" hash="bbd6399a27335aab9edf456999d51691"/></dir><file name="History.php" hash="4059ed5fbbec9a9e7ac50bb9e60e5f72"/><dir name="Semaphore"><file name="Collection.php" hash="bb0341b3b4508d300e6920726b55655c"/></dir><file name="Semaphore.php" hash="d0a01ef884d864850a0d501f5feecf4b"/></dir><dir name="Log"><file name="Collection.php" hash="3aa8bea27c4c61a9b273842bc0748a74"/><dir name="Data"><file name="Collection.php" hash="d8bdbf981206cd44d671ce7c29a644e5"/></dir><file name="Data.php" hash="798bbb97e107deb9199ca69d12aef918"/></dir><file name="Log.php" hash="80300469b2f89a158c7d663517e4ad4d"/><dir name="Mysql4"><file name="Setup.php" hash="0a40d43403823a6053d74bd2d2f688e7"/></dir></dir><dir name="Source"><file name="Abstract.php" hash="8d0d746d1cd2e5bc7d11350908a01585"/><file name="Allspecificcountries.php" hash="1a98316e25baeaba307b3be62364e1ca"/><file name="Apiversion.php" hash="a1be9e12b858927cbfa459509fff3647"/><file name="Capture.php" hash="c2d31ebb607202555e9905e439dbe86d"/><file name="Country.php" hash="2444140a6155e42d2e4909ae150037b7"/><file name="Customergroup.php" hash="01c6e41abac6e7105e4d290f53f68733"/><file name="Klarnalayout.php" hash="6c7b9d3a871d8cdb2a11a0cadde83f4a"/><file name="Language.php" hash="ca8bc4334348501a96f109aec5f9a01a"/><file name="Loglevel.php" hash="1fe0e08cc4dc2b25038b6c570e20bab0"/><file name="Newsletter.php" hash="f1532e5ff4c7e04384e9410cbb0969fa"/><file name="Servermode.php" hash="7acd8c7bb39f640dccef12df69ed7c57"/><file name="Taxclass.php" hash="de1ebcf0027eaff23f676da569034ed7"/><file name="Yesnodefault.php" hash="a296d6a62f1f1858ac093c0d7974cf6a"/></dir><dir name="Tax"><file name="Config.php" hash="7767f6d07f63df09228ab6c496ed0c05"/></dir><dir name="Transport"><file name="Abstract.php" hash="4b680a6e804ba3deb526bf30dc08866c"/></dir></dir><dir name="sql"><dir name="klarna_setup"><file name="mysql4-install-0.1.0.php" hash="d36b51433fd28241386594f39def3080"/><file name="mysql4-upgrade-5.1.6-5.1.7.php" hash="014a7b827a8958a94c57a0229127a427"/><file name="mysql4-upgrade-5.2.5-5.2.6.php" hash="1dd874e1a94730ab976b6187a34e6c77"/><file name="mysql4-upgrade-5.3.24-5.3.25.php" hash="ec5af38cfd42c2b2b16343546a152fd8"/><file name="mysql4-upgrade-5.3.4-5.3.5.php" hash="e65757e3d0992ae300ec0b4499575c06"/><file name="mysql4-upgrade-5.3.63-5.3.64.php" hash="48eee43569fd2296e09a0e2bbba9c14e"/><file name="mysql4-upgrade-5.3.64-5.3.65.php" hash="3d78c74547f6d1644986e2ea275dde16"/><file name="mysql4-upgrade-5.4.10-5.4.11.php" hash="e5a123584e25684aa0c84a841e20a940"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
18
  </package>
skin/frontend/base/default/css/vaimo/klarna/checkout.css CHANGED
@@ -18,21 +18,25 @@
18
  .sp-methods .form-list li.klarna_notification {
19
  margin-top: 20px;
20
  padding: 10px 10px 10px 31px;
21
- background: #ededed;
 
 
 
 
22
  }
23
 
24
  .klarna_notification:before {
25
  content: "";
26
  display: inline-block;
27
  vertical-align: top;
28
- margin: 0 5px 0 -21px;
29
  height: 16px;
30
  width: 16px;
31
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IllvdXJfSWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjExLjUgMTEuNSAyMCAyMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAxMS41IDExLjUgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMzEuNWMtNS41LDAtMTAtNC41LTEwLTEwYzAtNS41LDQuNS0xMCwxMC0xMHMxMCw0LjUsMTAsMTBDMzEuNSwyNywyNywzMS41LDIxLjUsMzEuNXogTTIxLjUsMTIuNA0KCQljLTUsMC05LjEsNC4xLTkuMSw5LjFzNC4xLDkuMSw5LjEsOS4xczkuMS00LjEsOS4xLTkuMUMzMC42LDE2LjUsMjYuNiwxMi40LDIxLjUsMTIuNHoiLz4NCjwvZz4NCjxwYXRoIGQ9Ik0yMS41LDI1LjJjMC42LDAsMS4xLDAuNSwxLjEsMS4xYzAsMC42LTAuNSwxLjEtMS4xLDEuMWMtMC42LDAtMS4xLTAuNS0xLjEtMS4xQzIwLjQsMjUuNywyMC45LDI1LjIsMjEuNSwyNS4yeiIvPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMjMuNmMtMC42LDAtMS4xLTAuNS0xLjEtMS4xdi01LjdjMC0wLjYsMC41LTEuMSwxLjEtMS4xYzAuNiwwLDEuMSwwLjUsMS4xLDEuMXY1LjdDMjIuNiwyMy4xLDIyLjEsMjMuNiwyMS41LDIzLjZ6Ig0KCQkvPg0KPC9nPg0KPC9zdmc+DQo=);
32
  background-size: 16px;
33
  }
34
-
35
- .input_combo {
36
  margin-top: 20px;
37
  }
38
 
@@ -43,13 +47,64 @@ ul#vaimo_klarna_invoice_input_fields {
43
  ul#payment_form_vaimo_klarna_invoice,
44
  ul#payment_form_vaimo_klarna_account,
45
  ul#payment_form_vaimo_klarna_special {
46
- margin-top: 5px;
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
- .payment_plan_wrapper {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  margin-top: 5px;
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  .sp-methods .form-list li.payment_plan_wrapper {
54
  float: left;
55
  }
@@ -57,21 +112,26 @@ ul#payment_form_vaimo_klarna_special {
57
  .sp-methods .form-list li.payment_plan_info_wrapper {
58
  float: left;
59
  padding: 10px;
60
- border: 1px solid #B6B6B6;
61
  }
62
 
63
- .payment_plan_details dt {
64
  float: left;
65
  clear: both;
66
  margin: 0;
67
  padding: 0 0 3px 0;
68
  width: 50%;
69
- font-weight: normal;
 
 
 
 
70
  }
71
 
72
  .payment_plan_details dt:last-of-type {
73
- width: 100%;
74
  padding: 0;
 
75
  }
76
 
77
  .payment_plan_details dd {
@@ -92,13 +152,13 @@ ul#payment_form_vaimo_klarna_special {
92
  width: 405px;
93
  }
94
 
95
- #vaimo_klarna_account_pclasses input {
96
- margin-right: 3px;
97
  }
98
 
99
 
100
- #vaimo_klarna_account_update_address_button,
101
- #vaimo_klarna_invoice_update_address_button,
102
  #vaimo_klarna_special_update_address_button {
103
  margin: 0 0 0 15px;
104
  background: #2c8ed8;
@@ -108,27 +168,30 @@ ul#payment_form_vaimo_klarna_special {
108
  border-radius: 12px;
109
  cursor: pointer;
110
  }
111
- #vaimo_klarna_account_update_address_button:hover,
112
- #vaimo_klarna_invoice_update_address_button:hover,
113
  #vaimo_klarna_special_update_address_button:hover {
114
  background: #006AA1;
115
  -webkit-transition: all 0.1s ease-in;
116
  transition: all 0.1s ease-in;
117
  }
118
- #vaimo_klarna_account_pno, #vaimo_klarna_account_phonenumber,
 
119
  .klarna-input-box input[type="text"] {
120
  width: 158px;
121
  border: 1px solid #eee;
122
  padding: 7px;
123
- text-align: center;
124
  color: #666;
125
  }
 
 
 
126
 
127
- .klarna_dob input[type="text"] {
128
- width: 40px !important; padding: 7px; text-align: center; border: 1px solid #eee;
129
  }
130
 
131
- .input_combo label {
132
  font-size: 0.9em; margin-left:10px;
133
  }
134
 
@@ -141,19 +204,19 @@ ul#payment_form_vaimo_klarna_special {
141
  margin: 0px 3px 0px 5px;
142
  }
143
 
144
- .gender-input-box input:first-child {
145
  margin-left: 0px;
146
  }
147
 
148
- .gender-input-box label,
149
- .gender-input-box label {
150
  min-width: inherit;
151
  }
152
 
153
  /*
154
  * When adding the logotype in front of the title, in checkout.
155
- *
156
-
157
  #checkout-step-payment .sp-methods label[for=p_method_vaimo_klarna_account],
158
  #checkout-step-payment .sp-methods label[for=p_method_vaimo_klarna_invoice],
159
  #checkout-step-payment .sp-methods label[for=p_method_vaimo_klarna_special] {
@@ -186,12 +249,19 @@ label[for=vaimo_klarna_invoice_consent],
186
  label[for=vaimo_klarna_account_consent],
187
  label[for=vaimo_klarna_special_consent] {
188
  display: inline-block;
189
- max-width: 550px;
190
  margin-left: 5px;
191
  margin-top: -2px;
 
192
  max-width: 550px;
193
  }
194
 
 
 
 
 
 
 
 
195
  .klarna-input-box address {
196
  display: inline-block;
197
  }
18
  .sp-methods .form-list li.klarna_notification {
19
  margin-top: 20px;
20
  padding: 10px 10px 10px 31px;
21
+ background-color: #ededed;
22
+ }
23
+
24
+ .sp-methods .form-list li.klarna_notification li.error {
25
+ background-color: #ff0000;
26
  }
27
 
28
  .klarna_notification:before {
29
  content: "";
30
  display: inline-block;
31
  vertical-align: top;
32
+ margin: 2px 5px 0 -21px;
33
  height: 16px;
34
  width: 16px;
35
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IllvdXJfSWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjExLjUgMTEuNSAyMCAyMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAxMS41IDExLjUgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMzEuNWMtNS41LDAtMTAtNC41LTEwLTEwYzAtNS41LDQuNS0xMCwxMC0xMHMxMCw0LjUsMTAsMTBDMzEuNSwyNywyNywzMS41LDIxLjUsMzEuNXogTTIxLjUsMTIuNA0KCQljLTUsMC05LjEsNC4xLTkuMSw5LjFzNC4xLDkuMSw5LjEsOS4xczkuMS00LjEsOS4xLTkuMUMzMC42LDE2LjUsMjYuNiwxMi40LDIxLjUsMTIuNHoiLz4NCjwvZz4NCjxwYXRoIGQ9Ik0yMS41LDI1LjJjMC42LDAsMS4xLDAuNSwxLjEsMS4xYzAsMC42LTAuNSwxLjEtMS4xLDEuMWMtMC42LDAtMS4xLTAuNS0xLjEtMS4xQzIwLjQsMjUuNywyMC45LDI1LjIsMjEuNSwyNS4yeiIvPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMjMuNmMtMC42LDAtMS4xLTAuNS0xLjEtMS4xdi01LjdjMC0wLjYsMC41LTEuMSwxLjEtMS4xYzAuNiwwLDEuMSwwLjUsMS4xLDEuMXY1LjdDMjIuNiwyMy4xLDIyLjEsMjMuNiwyMS41LDIzLjZ6Ig0KCQkvPg0KPC9nPg0KPC9zdmc+DQo=);
36
  background-size: 16px;
37
  }
38
+
39
+ .input_combo {
40
  margin-top: 20px;
41
  }
42
 
47
  ul#payment_form_vaimo_klarna_invoice,
48
  ul#payment_form_vaimo_klarna_account,
49
  ul#payment_form_vaimo_klarna_special {
50
+ margin-top: 15px;
51
+ }
52
+
53
+ ul#payment_form_vaimo_klarna_invoice {
54
+ position: relative;
55
+ }
56
+
57
+ ul#payment_form_vaimo_klarna_account {
58
+ position: relative;
59
+ }
60
+
61
+ ul#payment_form_vaimo_klarna_special {
62
+ position: relative;
63
  }
64
 
65
+ ul#payment_form_vaimo_klarna_account > li:first-child {
66
+ margin-bottom: 15px;
67
+ }
68
+
69
+ ul#payment_form_vaimo_klarna_invoice > li.klarna_readme {
70
+ position: absolute;
71
+ top: 18px;
72
+ right: 10px;
73
+ }
74
+
75
+ ul#payment_form_vaimo_klarna_account > li.klarna_readme {
76
+ position: absolute;
77
+ top: 18px;
78
+ right: 10px;
79
+ }
80
+
81
+ ul#payment_form_vaimo_klarna_special > li.klarna_readme {
82
+ position: absolute;
83
+ top: 18px;
84
+ right: 10px;
85
+ }
86
+
87
+ ul#payment_form_vaimo_klarna_account .payment_plan_wrapper {
88
  margin-top: 5px;
89
  }
90
 
91
+ ul#payment_form_vaimo_klarna_account .payment_plan_wrapper {
92
+ margin-left: 20px;
93
+ }
94
+
95
+ ul#payment_form_vaimo_klarna_account .payment_plan_wrapper .payment_plan label {
96
+ margin-left: -20px;
97
+ }
98
+
99
+ ul#payment_form_vaimo_klarna_account > li.klarna_input_wrapper {
100
+ border-top: 1px solid #ededed;
101
+ padding-top: 15px;
102
+ }
103
+
104
+ ul#payment_form_vaimo_klarna_account .klarna-input-box > li {
105
+ margin: 0 0 10px;
106
+ }
107
+
108
  .sp-methods .form-list li.payment_plan_wrapper {
109
  float: left;
110
  }
112
  .sp-methods .form-list li.payment_plan_info_wrapper {
113
  float: left;
114
  padding: 10px;
115
+ background: #ededed;
116
  }
117
 
118
+ .payment_plan_info_wrapper .payment_plan_details dt {
119
  float: left;
120
  clear: both;
121
  margin: 0;
122
  padding: 0 0 3px 0;
123
  width: 50%;
124
+ font-weight: bold;
125
+ }
126
+
127
+ .payment_plan_info_wrapper .payment_plan_details dt:first-child {
128
+ margin-bottom: 0;
129
  }
130
 
131
  .payment_plan_details dt:last-of-type {
132
+ font-weight: normal;
133
  padding: 0;
134
+ width: 100%;
135
  }
136
 
137
  .payment_plan_details dd {
152
  width: 405px;
153
  }
154
 
155
+ #vaimo_klarna_account_pclasses input {
156
+ margin-right: 3px;
157
  }
158
 
159
 
160
+ #vaimo_klarna_account_update_address_button,
161
+ #vaimo_klarna_invoice_update_address_button,
162
  #vaimo_klarna_special_update_address_button {
163
  margin: 0 0 0 15px;
164
  background: #2c8ed8;
168
  border-radius: 12px;
169
  cursor: pointer;
170
  }
171
+ #vaimo_klarna_account_update_address_button:hover,
172
+ #vaimo_klarna_invoice_update_address_button:hover,
173
  #vaimo_klarna_special_update_address_button:hover {
174
  background: #006AA1;
175
  -webkit-transition: all 0.1s ease-in;
176
  transition: all 0.1s ease-in;
177
  }
178
+ #vaimo_klarna_account_pno,
179
+ #vaimo_klarna_account_phonenumber,
180
  .klarna-input-box input[type="text"] {
181
  width: 158px;
182
  border: 1px solid #eee;
183
  padding: 7px;
 
184
  color: #666;
185
  }
186
+ #vaimo_klarna_account_pno {
187
+ text-align: center;
188
+ }
189
 
190
+ .klarna_dob input[type="text"] {
191
+ width: 60px !important; padding: 7px; text-align: center; border: 1px solid #eee;
192
  }
193
 
194
+ .input_combo label {
195
  font-size: 0.9em; margin-left:10px;
196
  }
197
 
204
  margin: 0px 3px 0px 5px;
205
  }
206
 
207
+ .gender-input-box input:first-child {
208
  margin-left: 0px;
209
  }
210
 
211
+ .gender-input-box label,
212
+ .gender-input-box label {
213
  min-width: inherit;
214
  }
215
 
216
  /*
217
  * When adding the logotype in front of the title, in checkout.
218
+ *
219
+
220
  #checkout-step-payment .sp-methods label[for=p_method_vaimo_klarna_account],
221
  #checkout-step-payment .sp-methods label[for=p_method_vaimo_klarna_invoice],
222
  #checkout-step-payment .sp-methods label[for=p_method_vaimo_klarna_special] {
249
  label[for=vaimo_klarna_account_consent],
250
  label[for=vaimo_klarna_special_consent] {
251
  display: inline-block;
 
252
  margin-left: 5px;
253
  margin-top: -2px;
254
+ width: calc(100% - 30px);
255
  max-width: 550px;
256
  }
257
 
258
+ .sp-methods label[for=vaimo_klarna_invoice_consent] a,
259
+ .sp-methods label[for=vaimo_klarna_account_consent] a,
260
+ .sp-methods label[for=vaimo_klarna_special_consent] a {
261
+ float: none;
262
+ margin-left: 0;
263
+ }
264
+
265
  .klarna-input-box address {
266
  display: inline-block;
267
  }
skin/frontend/base/default/css/vaimo/klarna/checkout_osc.css CHANGED
@@ -21,6 +21,10 @@
21
  background-color: #ededed;
22
  }
23
 
 
 
 
 
24
  .klarna_notification{
25
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IllvdXJfSWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjExLjUgMTEuNSAyMCAyMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAxMS41IDExLjUgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMzEuNWMtNS41LDAtMTAtNC41LTEwLTEwYzAtNS41LDQuNS0xMCwxMC0xMHMxMCw0LjUsMTAsMTBDMzEuNSwyNywyNywzMS41LDIxLjUsMzEuNXogTTIxLjUsMTIuNA0KCQljLTUsMC05LjEsNC4xLTkuMSw5LjFzNC4xLDkuMSw5LjEsOS4xczkuMS00LjEsOS4xLTkuMUMzMC42LDE2LjUsMjYuNiwxMi40LDIxLjUsMTIuNHoiLz4NCjwvZz4NCjxwYXRoIGQ9Ik0yMS41LDI1LjJjMC42LDAsMS4xLDAuNSwxLjEsMS4xYzAsMC42LTAuNSwxLjEtMS4xLDEuMWMtMC42LDAtMS4xLTAuNS0xLjEtMS4xQzIwLjQsMjUuNywyMC45LDI1LjIsMjEuNSwyNS4yeiIvPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMjMuNmMtMC42LDAtMS4xLTAuNS0xLjEtMS4xdi01LjdjMC0wLjYsMC41LTEuMSwxLjEtMS4xYzAuNiwwLDEuMSwwLjUsMS4xLDEuMXY1LjdDMjIuNiwyMy4xLDIyLjEsMjMuNiwyMS41LDIzLjZ6Ig0KCQkvPg0KPC9nPg0KPC9zdmc+DQo=);
26
  background-size: 16px;
@@ -39,13 +43,44 @@ ul#vaimo_klarna_invoice_input_fields {
39
  ul#payment_form_vaimo_klarna_invoice,
40
  ul#payment_form_vaimo_klarna_account,
41
  ul#payment_form_vaimo_klarna_special {
42
- margin-top: 5px;
 
 
 
 
 
 
 
 
43
  }
44
 
45
- .payment_plan_wrapper {
 
 
 
 
 
 
46
  margin-top: 5px;
47
  }
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  .payment-method .form-list li.payment_plan_wrapper {
50
  float: left;
51
  }
@@ -59,15 +94,25 @@ ul#payment_form_vaimo_klarna_special {
59
  border: 1px solid #B6B6B6;
60
  }
61
 
62
- .payment_plan_details dt {
63
  float: left;
64
  clear: both;
65
- margin: 0px 10px 3px 0px;
66
  min-width: 100px;
67
  font-weight: normal;
68
  font-size: 11px;
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
71
  .payment_plan_details dd {
72
  float: right;
73
  font-weight: normal;
@@ -117,9 +162,10 @@ ul.payment_plan li {
117
  -webkit-transition: all 0.1s ease-in;
118
  transition: all 0.1s ease-in;
119
  }
120
- #vaimo_klarna_account_pno, #vaimo_klarna_account_phonenumber,
 
121
  .klarna-input-box input[type="text"] {
122
- width: 100px;
123
  border: 1px solid #eee;
124
  padding: 7px;
125
  text-align: center;
@@ -127,7 +173,7 @@ ul.payment_plan li {
127
  }
128
 
129
  .klarna_dob input[type="text"] {
130
- width: 40px !important; padding: 7px; text-align: center; border: 1px solid #eee;
131
  }
132
 
133
  .input_combo label {
@@ -166,6 +212,10 @@ ul.payment_plan li {
166
  margin-right: 5px;
167
  }
168
 
 
 
 
 
169
  #klarna_invoice_readme,
170
  #klarna_account_readme,
171
  #klarna_special_readme {
@@ -184,9 +234,17 @@ label[for=vaimo_klarna_special_consent] {
184
  display: inline-block;
185
  margin-left: 5px;
186
  margin-top: -2px;
 
187
  max-width: 200px;
188
  }
189
 
 
 
 
 
 
 
 
190
  .klarna-input-box address {
191
  display: inline-block;
192
  }
21
  background-color: #ededed;
22
  }
23
 
24
+ .payment-methods .form-list li.klarna_notification li.error {
25
+ background-color: #ff0000;
26
+ }
27
+
28
  .klarna_notification{
29
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IllvdXJfSWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjExLjUgMTEuNSAyMCAyMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAxMS41IDExLjUgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMzEuNWMtNS41LDAtMTAtNC41LTEwLTEwYzAtNS41LDQuNS0xMCwxMC0xMHMxMCw0LjUsMTAsMTBDMzEuNSwyNywyNywzMS41LDIxLjUsMzEuNXogTTIxLjUsMTIuNA0KCQljLTUsMC05LjEsNC4xLTkuMSw5LjFzNC4xLDkuMSw5LjEsOS4xczkuMS00LjEsOS4xLTkuMUMzMC42LDE2LjUsMjYuNiwxMi40LDIxLjUsMTIuNHoiLz4NCjwvZz4NCjxwYXRoIGQ9Ik0yMS41LDI1LjJjMC42LDAsMS4xLDAuNSwxLjEsMS4xYzAsMC42LTAuNSwxLjEtMS4xLDEuMWMtMC42LDAtMS4xLTAuNS0xLjEtMS4xQzIwLjQsMjUuNywyMC45LDI1LjIsMjEuNSwyNS4yeiIvPg0KPGc+DQoJPHBhdGggZD0iTTIxLjUsMjMuNmMtMC42LDAtMS4xLTAuNS0xLjEtMS4xdi01LjdjMC0wLjYsMC41LTEuMSwxLjEtMS4xYzAuNiwwLDEuMSwwLjUsMS4xLDEuMXY1LjdDMjIuNiwyMy4xLDIyLjEsMjMuNiwyMS41LDIzLjZ6Ig0KCQkvPg0KPC9nPg0KPC9zdmc+DQo=);
30
  background-size: 16px;
43
  ul#payment_form_vaimo_klarna_invoice,
44
  ul#payment_form_vaimo_klarna_account,
45
  ul#payment_form_vaimo_klarna_special {
46
+ margin-top: 15px;
47
+ }
48
+
49
+ ul#payment_form_vaimo_klarna_account {
50
+ position: relative;
51
+ }
52
+
53
+ ul#payment_form_vaimo_klarna_account > li:first-child {
54
+ margin-bottom: 15px;
55
  }
56
 
57
+ ul#payment_form_vaimo_klarna_account > li.klarna_readme {
58
+ position: absolute;
59
+ top: 18px;
60
+ right: 10px;
61
+ }
62
+
63
+ ul#payment_form_vaimo_klarna_account .payment_plan_wrapper {
64
  margin-top: 5px;
65
  }
66
 
67
+ ul#payment_form_vaimo_klarna_account .payment_plan_wrapper {
68
+ margin-left: 20px;
69
+ }
70
+
71
+ ul#payment_form_vaimo_klarna_account .payment_plan_wrapper .payment_plan label {
72
+ margin-left: -20px;
73
+ }
74
+
75
+ ul#payment_form_vaimo_klarna_account > li.klarna_input_wrapper {
76
+ border-top: 1px solid #ededed;
77
+ padding-top: 15px;
78
+ }
79
+
80
+ ul#payment_form_vaimo_klarna_account .klarna-input-box > li {
81
+ margin: 0 0 10px;
82
+ }
83
+
84
  .payment-method .form-list li.payment_plan_wrapper {
85
  float: left;
86
  }
94
  border: 1px solid #B6B6B6;
95
  }
96
 
97
+ .payment_plan_info_wrapper .payment_plan_details dt {
98
  float: left;
99
  clear: both;
100
+ padding: 0 0 3px 0;
101
  min-width: 100px;
102
  font-weight: normal;
103
  font-size: 11px;
104
  }
105
 
106
+ .payment_plan_info_wrapper .payment_plan_details dt:first-child {
107
+ margin-bottom: 0;
108
+ }
109
+
110
+ .payment_plan_details dt:last-of-type {
111
+ font-weight: normal;
112
+ padding: 0;
113
+ width: 100%;
114
+ }
115
+
116
  .payment_plan_details dd {
117
  float: right;
118
  font-weight: normal;
162
  -webkit-transition: all 0.1s ease-in;
163
  transition: all 0.1s ease-in;
164
  }
165
+ #vaimo_klarna_account_pno,
166
+ #vaimo_klarna_account_phonenumber,
167
  .klarna-input-box input[type="text"] {
168
+ width: 140px;
169
  border: 1px solid #eee;
170
  padding: 7px;
171
  text-align: center;
173
  }
174
 
175
  .klarna_dob input[type="text"] {
176
+ width: 60px !important; padding: 7px; text-align: center; border: 1px solid #eee;
177
  }
178
 
179
  .input_combo label {
212
  margin-right: 5px;
213
  }
214
 
215
+ .payment-methods .payment_plan_details dd {
216
+ padding: 0 0 0 0;
217
+ }
218
+
219
  #klarna_invoice_readme,
220
  #klarna_account_readme,
221
  #klarna_special_readme {
234
  display: inline-block;
235
  margin-left: 5px;
236
  margin-top: -2px;
237
+ width: calc(100% - 30px);
238
  max-width: 200px;
239
  }
240
 
241
+ .sp-methods label[for=vaimo_klarna_invoice_consent] a,
242
+ .sp-methods label[for=vaimo_klarna_account_consent] a,
243
+ .sp-methods label[for=vaimo_klarna_special_consent] a {
244
+ float: none;
245
+ margin-left: 0;
246
+ }
247
+
248
  .klarna-input-box address {
249
  display: inline-block;
250
  }
skin/frontend/base/default/css/vaimo/klarna/klarnacheckout.css CHANGED
@@ -141,7 +141,7 @@
141
  }
142
 
143
  .klarna_block a:hover,
144
- .klarna_block a:active, {
145
  color: #3eb728;
146
  }
147
 
141
  }
142
 
143
  .klarna_block a:hover,
144
+ .klarna_block a:active {
145
  color: #3eb728;
146
  }
147