klarnapayments - Version 5.2.2

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.2.2
Comparing to
See all releases


Code changes from version 5.2.0 to 5.2.2

Files changed (81) hide show
  1. app/code/community/Vaimo/Klarna/Block/Catalog/Product/Pricewidget.php +17 -9
  2. app/code/community/Vaimo/Klarna/Block/Form/Abstract.php +34 -0
  3. app/code/community/Vaimo/Klarna/Block/Klarnacheckout/Discount.php +10 -7
  4. app/code/community/Vaimo/Klarna/Block/System/Config/Form/Field/Position.php +54 -0
  5. app/code/community/Vaimo/Klarna/Block/System/Config/Form/Field/Position/Attribute/Set.php +78 -0
  6. app/code/community/Vaimo/Klarna/Helper/Data.php +30 -7
  7. app/code/community/Vaimo/Klarna/Model/Api/Abstract.php +21 -0
  8. app/code/community/Vaimo/Klarna/Model/Api/Kco.php +2 -0
  9. app/code/community/Vaimo/Klarna/Model/Api/Rest.php +1 -0
  10. app/code/community/Vaimo/Klarna/Model/Api/Xmlrpc.php +37 -2
  11. app/code/community/Vaimo/Klarna/Model/Klarna.php +72 -3
  12. app/code/community/Vaimo/Klarna/Model/Klarna/Abstract.php +1 -1
  13. app/code/community/Vaimo/Klarna/Model/Observer.php +17 -7
  14. app/code/community/Vaimo/Klarna/Model/Payment/Abstract.php +17 -1
  15. app/code/community/Vaimo/Klarna/Model/Transport/Abstract.php +19 -5
  16. app/code/community/Vaimo/Klarna/controllers/Checkout/KlarnaController.php +1 -0
  17. app/code/community/Vaimo/Klarna/etc/config.xml +21 -13
  18. app/code/community/Vaimo/Klarna/etc/system.xml +18 -0
  19. app/design/frontend/base/default/template/vaimo/klarna/form/account.phtml +34 -9
  20. app/design/frontend/base/default/template/vaimo/klarna/form/children/checkoutservice.phtml +81 -0
  21. app/design/frontend/base/default/template/vaimo/klarna/form/invoice.phtml +32 -8
  22. app/design/frontend/base/default/template/vaimo/klarna/form/special.phtml +34 -9
  23. js/vaimo/klarna/klarna.js +9 -0
  24. lib/Klarna/CHANGELOG +99 -226
  25. lib/Klarna/Changelog-Vaimo.txt +6 -0
  26. lib/Klarna/CheckoutServiceRequest.php +106 -0
  27. lib/Klarna/CheckoutServiceResponse.php +91 -0
  28. lib/Klarna/Country.php +2 -2
  29. lib/Klarna/CurlHandle.php +108 -0
  30. lib/Klarna/CurlTransport.php +94 -0
  31. lib/Klarna/Currency.php +2 -2
  32. lib/Klarna/Encoding.php +2 -2
  33. lib/Klarna/Exceptions.php +32 -32
  34. lib/Klarna/Flags.php +2 -2
  35. lib/Klarna/Klarna.php +116 -237
  36. lib/Klarna/Language.php +2 -2
  37. lib/Klarna/checkoutkpm/checkouthtml.intf.php +2 -2
  38. lib/Klarna/checkoutkpm/threatmetrix.class.php +2 -2
  39. lib/Klarna/examples/activate.php +13 -41
  40. lib/Klarna/examples/activateInvoice.php +0 -53
  41. lib/Klarna/examples/activatePart.php +0 -67
  42. lib/Klarna/examples/activateReservation.php +0 -240
  43. lib/Klarna/examples/addTransaction.php +0 -159
  44. lib/Klarna/examples/calc_monthly_cost.php +0 -59
  45. lib/Klarna/examples/cancelReservation.php +10 -33
  46. lib/Klarna/examples/changeReservation.php +0 -60
  47. lib/Klarna/examples/checkOrderStatus.php +11 -41
  48. lib/Klarna/examples/checkoutService.php +47 -0
  49. lib/Klarna/examples/creditInvoice.php +10 -37
  50. lib/Klarna/examples/creditPart.php +10 -41
  51. lib/Klarna/examples/deleteInvoice.php +0 -49
  52. lib/Klarna/examples/emailInvoice.php +9 -33
  53. lib/Klarna/examples/fetchPClasses.php +10 -30
  54. lib/Klarna/examples/getAddresses.php +10 -63
  55. lib/Klarna/examples/getPClasses.php +0 -63
  56. lib/Klarna/examples/hasAccount.php +33 -0
  57. lib/Klarna/examples/helperFunctions.php +102 -0
  58. lib/Klarna/examples/invoiceAddress.php +0 -80
  59. lib/Klarna/examples/invoiceAmount.php +0 -56
  60. lib/Klarna/examples/invoicePartAmount.php +0 -70
  61. lib/Klarna/examples/reserveAmount.php +29 -127
  62. lib/Klarna/examples/reserveOCR.php +10 -37
  63. lib/Klarna/examples/returnAmount.php +9 -34
  64. lib/Klarna/examples/sendInvoice.php +9 -35
  65. lib/Klarna/examples/splitReservation.php +14 -42
  66. lib/Klarna/examples/update.php +13 -93
  67. lib/Klarna/examples/updateChargeAmount.php +0 -60
  68. lib/Klarna/examples/updateGoodsQty.php +0 -61
  69. lib/Klarna/examples/updateOrderNo.php +0 -59
  70. lib/Klarna/klarnaaddr.php +2 -2
  71. lib/Klarna/klarnacalc.php +2 -2
  72. lib/Klarna/klarnaconfig.php +2 -4
  73. lib/Klarna/klarnapclass.php +2 -2
  74. lib/Klarna/pclasses/jsonstorage.class.php +2 -2
  75. lib/Klarna/pclasses/mysqlstorage.class.php +16 -5
  76. lib/Klarna/pclasses/sqlstorage.class.php +39 -24
  77. lib/Klarna/pclasses/storage.intf.php +2 -2
  78. lib/Klarna/pclasses/xmlstorage.class.php +2 -2
  79. package.xml +4 -4
  80. skin/frontend/base/default/css/vaimo/klarna/checkout.css +9 -7
  81. skin/frontend/base/default/css/vaimo/klarna/checkout_osc.css +1 -1
app/code/community/Vaimo/Klarna/Block/Catalog/Product/Pricewidget.php CHANGED
@@ -58,17 +58,25 @@ class Vaimo_Klarna_Block_Catalog_Product_Pricewidget extends Mage_Core_Block_Tem
58
  public function getWidgetParameters()
59
  {
60
  $activef = true;
61
- $klarna = Mage::getModel('klarna/klarna');
62
- $klarna->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
63
- if ($klarna->getConfigData('disable_product_widget')) {
64
- $activef = false;
65
- }
66
- $klarna->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT);
67
- if ($klarna->getConfigData('disable_product_widget')) {
68
- $activef = false;
 
 
 
 
 
 
 
 
 
69
  }
70
  if ($activef) {
71
- $klarnaSetup = $klarna->getKlarnaSetup();
72
  if ($klarnaSetup) {
73
  if($klarnaSetup->getCountryCode() != 'NL' && $klarnaSetup->getCountryCode() != 'AT') {
74
  return $klarnaSetup;
58
  public function getWidgetParameters()
59
  {
60
  $activef = true;
61
+ $klarnaSetup = NULL;
62
+ $klarnacheckout = Mage::getModel('klarna/klarnacheckout');
63
+ $klarnacheckout->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
64
+ if ($klarnacheckout->getKlarnaCheckoutEnabled()) {
65
+ if ($klarnacheckout->getConfigData('disable_product_widget')) {
66
+ $activef = false;
67
+ } else {
68
+ $klarnaSetup = $klarnacheckout->getKlarnaSetup();
69
+ }
70
+ } else {
71
+ $klarna = Mage::getModel('klarna/klarna');
72
+ $klarna->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT);
73
+ if ($klarna->getConfigData('disable_product_widget')) {
74
+ $activef = false;
75
+ } else {
76
+ $klarnaSetup = $klarna->getKlarnaSetup();
77
+ }
78
  }
79
  if ($activef) {
 
80
  if ($klarnaSetup) {
81
  if($klarnaSetup->getCountryCode() != 'NL' && $klarnaSetup->getCountryCode() != 'AT') {
82
  return $klarnaSetup;
app/code/community/Vaimo/Klarna/Block/Form/Abstract.php CHANGED
@@ -73,6 +73,23 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
73
  return $res;
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  public function needAddressSearch()
77
  {
78
  try {
@@ -252,6 +269,12 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
252
  return $this->toHtml();
253
  }
254
 
 
 
 
 
 
 
255
  /**
256
  * Return ajax url for address search
257
  *
@@ -279,6 +302,17 @@ class Vaimo_Klarna_Block_Form_Abstract extends Mage_Payment_Block_Form
279
  $klarna->setQuote($this->getQuote(), $method);
280
  return $klarna->getKlarnaLogotype($width, Vaimo_Klarna_Helper_Data::KLARNA_LOGOTYPE_POSITION_CHECKOUT);
281
  }
 
 
 
 
 
 
 
 
 
 
 
282
 
283
  public function getKlarnaSetup()
284
  {
73
  return $res;
74
  }
75
 
76
+ public function getCheckoutService()
77
+ {
78
+ try {
79
+ $method = $this->getMethod()->getCode();
80
+ $klarna = Mage::getModel('klarna/klarna');
81
+ $klarna->setQuote($this->getQuote(), $method);
82
+ $res = $klarna->getCheckoutService($method);
83
+ } catch (Mage_Core_Exception $e) {
84
+ if ($klarna) $klarna->logKlarnaException($e);
85
+ $res = NULL;
86
+ }
87
+ if ($res==NULL) {
88
+ $res = array(false); // On purpouse!
89
+ }
90
+ return $res;
91
+ }
92
+
93
  public function needAddressSearch()
94
  {
95
  try {
269
  return $this->toHtml();
270
  }
271
 
272
+ public function getCheckoutServiceHtml()
273
+ {
274
+ $this->setTemplate('vaimo/klarna/form/children/checkoutservice.phtml');
275
+ return $this->toHtml();
276
+ }
277
+
278
  /**
279
  * Return ajax url for address search
280
  *
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 = '';
309
+ if (isset($serviceMethod['logo'])) {
310
+ foreach ($serviceMethod['logo'] as $logo) {
311
+ $res .= '<img src="' . $logo . '?width=' . $width . '"/>';
312
+ }
313
+ }
314
+ return $res;
315
+ }
316
 
317
  public function getKlarnaSetup()
318
  {
app/code/community/Vaimo/Klarna/Block/Klarnacheckout/Discount.php CHANGED
@@ -28,15 +28,18 @@ class Vaimo_Klarna_Block_Klarnacheckout_Discount extends Mage_Core_Block_Templat
28
  public function _beforeToHtml()
29
  {
30
  parent::_beforeToHtml();
31
- if (class_exists('Enterprise_GiftCard_Model_Giftcard', true)) {
 
32
  /** @var Mage_Core_Block_Template $giftCardAccountBlock */
33
- $giftCardAccountBlock = $this->getLayout()->createBlock(
34
- 'enterprise_giftcardaccount/checkout_cart_giftcardaccount', 'checkout.cart.giftcardaccount'
35
- );
36
- if ($giftCardAccountBlock) {
37
- $giftCardAccountBlock->setTemplate('vaimo/klarna/klarnacheckout/discount/giftcardaccount.phtml');
38
- $this->setChild('giftcards', $giftCardAccountBlock);
 
39
  }
 
40
  }
41
  return $this;
42
  }
28
  public function _beforeToHtml()
29
  {
30
  parent::_beforeToHtml();
31
+ try {
32
+ if (class_exists('Enterprise_GiftCard_Model_Giftcard', true)) {
33
  /** @var Mage_Core_Block_Template $giftCardAccountBlock */
34
+ $giftCardAccountBlock = $this->getLayout()->createBlock(
35
+ 'enterprise_giftcardaccount/checkout_cart_giftcardaccount', 'checkout.cart.giftcardaccount'
36
+ );
37
+ if ($giftCardAccountBlock) {
38
+ $giftCardAccountBlock->setTemplate('vaimo/klarna/klarnacheckout/discount/giftcardaccount.phtml');
39
+ $this->setChild('giftcards', $giftCardAccountBlock);
40
+ }
41
  }
42
+ } catch (Exception $e) {
43
  }
44
  return $this;
45
  }
app/code/community/Vaimo/Klarna/Block/System/Config/Form/Field/Position.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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-2014 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Block_System_Config_Form_Field_Position extends Mage_Core_Block_Html_Select
27
+ {
28
+ public function getOptions()
29
+ {
30
+ if (!$this->_options) {
31
+ $this->_options = array(
32
+ array(
33
+ 'label' => Mage::helper('klarna')->__('GUI - Options'),
34
+ 'value' => Vaimo_Klarna_Helper_Data::KLARNA_EXTRA_VARIABLES_GUI_OPTIONS
35
+ ),
36
+ array(
37
+ 'label' => Mage::helper('klarna')->__('GUI - Layout'),
38
+ 'value' => Vaimo_Klarna_Helper_Data::KLARNA_EXTRA_VARIABLES_GUI_LAYOUT
39
+ ),
40
+ array(
41
+ 'label' => Mage::helper('klarna')->__('Options'),
42
+ 'value' => Vaimo_Klarna_Helper_Data::KLARNA_EXTRA_VARIABLES_OPTIONS
43
+ ),
44
+ );
45
+ }
46
+
47
+ return $this->_options;
48
+ }
49
+
50
+ public function getName()
51
+ {
52
+ return $this->getData('name') ? $this->getData('name') : $this->getInputName();
53
+ }
54
+ }
app/code/community/Vaimo/Klarna/Block/System/Config/Form/Field/Position/Attribute/Set.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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-2014 Vaimo AB
24
+ */
25
+
26
+ class Vaimo_Klarna_Block_System_Config_Form_Field_Position_Attribute_Set extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
27
+ {
28
+ protected $_positionRenderer;
29
+
30
+ protected function _prepareToRender()
31
+ {
32
+ $this->addColumn('position', array(
33
+ 'label' => Mage::helper('klarna')->__('Position'),
34
+ 'renderer' => $this->_getPositionRenderer(),
35
+ ));
36
+
37
+ $this->addColumn('key', array(
38
+ 'label' => Mage::helper('klarna')->__('Key'),
39
+ 'style' => 'width:80px',
40
+ ));
41
+
42
+ $this->addColumn('value', array(
43
+ 'label' => Mage::helper('klarna')->__('Value'),
44
+ 'style' => 'width:80px',
45
+
46
+ ));
47
+
48
+ $this->_addAfter = false;
49
+ $this->_addButtonLabel = Mage::helper('klarna')->__('Add Value');
50
+ }
51
+
52
+ protected function _getPositionRenderer()
53
+ {
54
+ if (!$this->_positionRenderer) {
55
+ $this->_positionRenderer = $this->getLayout()->createBlock(
56
+ 'klarna/system_config_form_field_position', '',
57
+ array('is_render_to_js_template' => true)
58
+ );
59
+ $this->_positionRenderer->setExtraParams('style="width:150px"');
60
+ }
61
+
62
+ return $this->_positionRenderer;
63
+ }
64
+
65
+ protected function _prepareArrayRow(Varien_Object $row)
66
+ {
67
+ // Setting select/option data, so that the correct options would be selected after load
68
+ foreach ($row->getData() as $key => $value) {
69
+ if (!empty($this->_columns[$key]['renderer'])) {
70
+ $renderer = $this->_columns[$key]['renderer'];
71
+ if ($renderer instanceof Mage_Core_Block_Html_Select) {
72
+ $hash = $renderer->calcOptionHash($value);
73
+ $row->setData('option_extra_attr_' . $hash, 'selected');
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
app/code/community/Vaimo/Klarna/Helper/Data.php CHANGED
@@ -30,13 +30,14 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
30
  const KLARNA_METHOD_SPECIAL = 'vaimo_klarna_special';
31
  const KLARNA_METHOD_CHECKOUT = 'vaimo_klarna_checkout';
32
 
33
- const KLARNA_API_CALL_RESERVE = 'reserve';
34
- const KLARNA_API_CALL_CAPTURE = 'capture';
35
- const KLARNA_API_CALL_REFUND = 'refund';
36
- const KLARNA_API_CALL_CANCEL = 'cancel';
37
- const KLARNA_API_CALL_CHECKSTATUS = 'check_status';
38
- const KLARNA_API_CALL_ADDRESSES = 'addresses';
39
- const KLARNA_API_CALL_PCLASSES = 'pclasses';
 
40
 
41
  const KLARNA_API_CALL_KCODISPLAY_ORDER = 'kco_display_order';
42
  const KLARNA_API_CALL_KCOCREATE_ORDER = 'kco_create_order';
@@ -113,6 +114,11 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
113
  const KLARNA_DISPATCH_REFUNDED = 'vaimo_paymentmethod_order_refunded';
114
  const KLARNA_DISPATCH_CANCELED = 'vaimo_paymentmethod_order_canceled';
115
 
 
 
 
 
 
116
  protected $_supportedMethods = array(
117
  Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE,
118
  Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT,
@@ -274,6 +280,23 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
274
  return $res;
275
  }
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  /*
278
  * Last minute change. We were showing logotype instead of title, but the implementation was not
279
  * as good as we wanted, so we reverted it and will make it a setting. This function will be the
30
  const KLARNA_METHOD_SPECIAL = 'vaimo_klarna_special';
31
  const KLARNA_METHOD_CHECKOUT = 'vaimo_klarna_checkout';
32
 
33
+ const KLARNA_API_CALL_RESERVE = 'reserve';
34
+ const KLARNA_API_CALL_CAPTURE = 'capture';
35
+ const KLARNA_API_CALL_REFUND = 'refund';
36
+ const KLARNA_API_CALL_CANCEL = 'cancel';
37
+ const KLARNA_API_CALL_CHECKSTATUS = 'check_status';
38
+ const KLARNA_API_CALL_ADDRESSES = 'addresses';
39
+ const KLARNA_API_CALL_PCLASSES = 'pclasses';
40
+ const KLARNA_API_CALL_CHECKOUTSERVICES = 'checkout_services';
41
 
42
  const KLARNA_API_CALL_KCODISPLAY_ORDER = 'kco_display_order';
43
  const KLARNA_API_CALL_KCOCREATE_ORDER = 'kco_create_order';
114
  const KLARNA_DISPATCH_REFUNDED = 'vaimo_paymentmethod_order_refunded';
115
  const KLARNA_DISPATCH_CANCELED = 'vaimo_paymentmethod_order_canceled';
116
 
117
+ const KLARNA_EXTRA_VARIABLES_GUI_OPTIONS = 0;
118
+ const KLARNA_EXTRA_VARIABLES_GUI_LAYOUT = 1;
119
+ const KLARNA_EXTRA_VARIABLES_OPTIONS = 2;
120
+
121
+
122
  protected $_supportedMethods = array(
123
  Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE,
124
  Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT,
280
  return $res;
281
  }
282
 
283
+ /**
284
+ * Check if Vaimo_QuickCheckout is activated or not
285
+ *
286
+ * @return bool
287
+ */
288
+ public function isQuickCheckout($store = null)
289
+ {
290
+ $res = false;
291
+ try {
292
+ if (class_exists('Icommerce_QuickCheckout_Helper_Data', true)) {
293
+ $res = true;
294
+ }
295
+ } catch (Exception $e) {
296
+ }
297
+ return $res;
298
+ }
299
+
300
  /*
301
  * Last minute change. We were showing logotype instead of title, but the implementation was not
302
  * as good as we wanted, so we reverted it and will make it a setting. This function will be the
app/code/community/Vaimo/Klarna/Model/Api/Abstract.php CHANGED
@@ -59,4 +59,25 @@ abstract class Vaimo_Klarna_Model_Api_Abstract extends Varien_Object
59
  return false;
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
59
  return false;
60
  }
61
 
62
+ protected function _addUserDefinedVariables($create)
63
+ {
64
+ return;
65
+ $extras = unserialize($this->_getTransport()->getConfigData("extra_parameters"));
66
+ if (is_array($extras)) {
67
+ foreach ($extras as $extra) {
68
+ if (!$extra['key'] || !$extra['value']) continue;
69
+ switch ($extra['position']) {
70
+ case Vaimo_Klarna_Helper_Data::KLARNA_EXTRA_VARIABLES_GUI_OPTIONS:
71
+ $create['gui']['options'][$extra['key']] = $extra['value'];
72
+ break;
73
+ case Vaimo_Klarna_Helper_Data::KLARNA_EXTRA_VARIABLES_GUI_LAYOUT:
74
+ $create['gui']['layout'][$extra['key']] = $extra['value'];
75
+ break;
76
+ case Vaimo_Klarna_Helper_Data::KLARNA_EXTRA_VARIABLES_OPTIONS:
77
+ $create['options'][$extra['key']] = $extra['value'];
78
+ break;
79
+ }
80
+ }
81
+ }
82
+ }
83
  }
app/code/community/Vaimo/Klarna/Model/Api/Kco.php CHANGED
@@ -237,6 +237,8 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
237
  $create['options']['packstation_enabled'] = true;
238
  }
239
 
 
 
240
  $pushUrl = Mage::getUrl('checkout/klarna/push?klarna_order={checkout.order.uri}', array('_nosid' => true));
241
  if (substr($pushUrl, -1, 1) == '/') {
242
  $pushUrl = substr($pushUrl, 0, strlen($pushUrl) - 1);
237
  $create['options']['packstation_enabled'] = true;
238
  }
239
 
240
+ $this->_addUserDefinedVariables($create);
241
+
242
  $pushUrl = Mage::getUrl('checkout/klarna/push?klarna_order={checkout.order.uri}', array('_nosid' => true));
243
  if (substr($pushUrl, -1, 1) == '/') {
244
  $pushUrl = substr($pushUrl, 0, strlen($pushUrl) - 1);
app/code/community/Vaimo/Klarna/Model/Api/Rest.php CHANGED
@@ -264,6 +264,7 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
264
  $create['options']['packstation_enabled'] = true;
265
  }
266
 
 
267
 
268
  if ($data = $this->_getBillingAddressData()) {
269
  $create['billing_address'] = $data;
264
  $create['options']['packstation_enabled'] = true;
265
  }
266
 
267
+ $this->_addUserDefinedVariables($create);
268
 
269
  if ($data = $this->_getBillingAddressData()) {
270
  $create['billing_address'] = $data;
app/code/community/Vaimo/Klarna/Model/Api/Xmlrpc.php CHANGED
@@ -32,6 +32,8 @@ class Vaimo_Klarna_Model_Api_Xmlrpc extends Vaimo_Klarna_Model_Api_Abstract
32
  {
33
  protected $_klarnaApi = NULL;
34
 
 
 
35
  public function __construct($klarnaApi = null)
36
  {
37
  parent::__construct();
@@ -528,6 +530,9 @@ class Vaimo_Klarna_Model_Api_Xmlrpc extends Vaimo_Klarna_Model_Api_Abstract
528
  true, // ssl
529
  true // candice
530
  );
 
 
 
531
 
532
  if (method_exists('Mage', 'getEdition')) {
533
  $magentoEdition = Mage::getEdition();
@@ -562,7 +567,13 @@ class Vaimo_Klarna_Model_Api_Xmlrpc extends Vaimo_Klarna_Model_Api_Abstract
562
  );
563
 
564
  } catch (KlarnaException $e) {
565
- $this->_getTransport()->logKlarnaApi('Response Error Code = ' . $e->getCode());
 
 
 
 
 
 
566
  $this->_getTransport()->logKlarnaException($e);
567
  Mage::throwException(Mage::helper('klarna')->decode($e->getMessage()));
568
  }
@@ -832,6 +843,30 @@ class Vaimo_Klarna_Model_Api_Xmlrpc extends Vaimo_Klarna_Model_Api_Abstract
832
  return $res;
833
  }
834
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
835
  /**
836
  * Create a KlarnaAddr from a Magento address
837
  *
@@ -877,7 +912,7 @@ class Vaimo_Klarna_Model_Api_Xmlrpc extends Vaimo_Klarna_Model_Api_Abstract
877
  );
878
 
879
  $company = $address->getCompany();
880
- if (strlen($company) > 0 && $this->isCompanyAllowed()) {
881
  $klarnaAddr->setCompanyName(Mage::helper('klarna')->encode($company));
882
  $klarnaAddr->isCompany = true;
883
  } else {
32
  {
33
  protected $_klarnaApi = NULL;
34
 
35
+ protected $_checkoutServiceResult = NULL;
36
+
37
  public function __construct($klarnaApi = null)
38
  {
39
  parent::__construct();
530
  true, // ssl
531
  true // candice
532
  );
533
+ if ($mode==Klarna::BETA) {
534
+ $this->_klarnaApi->setConfigVariable('checkout_service_uri', 'https://api-test.klarna.com/touchpoint/checkout/');
535
+ }
536
 
537
  if (method_exists('Mage', 'getEdition')) {
538
  $magentoEdition = Mage::getEdition();
567
  );
568
 
569
  } catch (KlarnaException $e) {
570
+ $msg = 'Response Error Code = ' . $e->getCode();
571
+ switch ($e->getCode()) {
572
+ case '9118':
573
+ $msg .= ' Please check country, language and currency combination. They must match.';
574
+ break;
575
+ }
576
+ $this->_getTransport()->logKlarnaApi($msg);
577
  $this->_getTransport()->logKlarnaException($e);
578
  Mage::throwException(Mage::helper('klarna')->decode($e->getMessage()));
579
  }
843
  return $res;
844
  }
845
 
846
+ public function getCheckoutService($amount, $currency)
847
+ {
848
+ try {
849
+ $res = NULL;
850
+ if (!$this->_checkoutServiceResult) {
851
+ $this->_checkoutServiceResult = $this->_klarnaApi->checkoutService($amount, $currency, $this->_klarnaSetup->getLocaleCode(), $this->_klarnaSetup->getCountryCode());
852
+ if ($this->_checkoutServiceResult) {
853
+ if ($this->_checkoutServiceResult->getStatus()==200) {
854
+ $this->_getTransport()->logDebugInfo('checkoutService amount',array('amount' => $amount));
855
+ $this->_getTransport()->logDebugInfo('checkoutService',$this->_checkoutServiceResult->getData());
856
+ }
857
+ }
858
+ }
859
+ if ($this->_checkoutServiceResult) {
860
+ if ($this->_checkoutServiceResult->getStatus()==200) {
861
+ $res = $this->_checkoutServiceResult->getData();
862
+ }
863
+ }
864
+ } catch (KlarnaException $e) {
865
+ $res = NULL;
866
+ }
867
+ return $res;
868
+ }
869
+
870
  /**
871
  * Create a KlarnaAddr from a Magento address
872
  *
912
  );
913
 
914
  $company = $address->getCompany();
915
+ if (strlen($company) > 0 && $this->_getTransport()->isCompanyAllowed()) {
916
  $klarnaAddr->setCompanyName(Mage::helper('klarna')->encode($company));
917
  $klarnaAddr->isCompany = true;
918
  } else {
app/code/community/Vaimo/Klarna/Model/Klarna.php CHANGED
@@ -266,7 +266,7 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
266
  * in this function. Authorize will attempt to use the value and give an error message, which means
267
  * it will be checked and reported anyway
268
  */
269
- if (!$this->_getHelper()->isOneStepCheckout()) {
270
  Mage::throwException($this->_getHelper()->__(
271
  'Unknown address, please specify correct personal id in the payment selection and press Fetch again, or use another payment method'
272
  )
@@ -284,7 +284,7 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
284
  /*
285
  * No error message here if using OneStepCheckout
286
  */
287
- if (!$this->_getHelper()->isOneStepCheckout()) {
288
  Mage::throwException($this->_getHelper()->__(
289
  'Unknown address, please specify correct personal id in the payment selection and press Fetch again, or use another payment method'
290
  )
@@ -346,7 +346,7 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
346
  }
347
  return NULL;
348
  }
349
-
350
  /*
351
  *
352
  *
@@ -443,9 +443,78 @@ class Vaimo_Klarna_Model_Klarna extends Vaimo_Klarna_Model_Klarna_Abstract
443
  return $res;
444
  }
445
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  public function setPaymentPlan()
447
  {
448
  $id = $this->getPostValues(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_PAYMENT_PLAN);
 
449
  $method = $this->getPostValues('method');
450
  if ($id) {
451
  $pclassArray = $this->_getSpecificPClass($id);
266
  * in this function. Authorize will attempt to use the value and give an error message, which means
267
  * it will be checked and reported anyway
268
  */
269
+ if (!$this->_getHelper()->isOneStepCheckout() && !$this->_getHelper()->isQuickCheckout()) {
270
  Mage::throwException($this->_getHelper()->__(
271
  'Unknown address, please specify correct personal id in the payment selection and press Fetch again, or use another payment method'
272
  )
284
  /*
285
  * No error message here if using OneStepCheckout
286
  */
287
+ if (!$this->_getHelper()->isOneStepCheckout() && !$this->_getHelper()->isQuickCheckout()) {
288
  Mage::throwException($this->_getHelper()->__(
289
  'Unknown address, please specify correct personal id in the payment selection and press Fetch again, or use another payment method'
290
  )
346
  }
347
  return NULL;
348
  }
349
+
350
  /*
351
  *
352
  *
443
  return $res;
444
  }
445
 
446
+ /**
447
+ *
448
+ *
449
+ */
450
+ public function getCheckoutService($method = NULL)
451
+ {
452
+ try {
453
+ $res = NULL;
454
+ $this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_CHECKOUTSERVICES);
455
+ $amount = $this->getQuote()->getGrandTotal();
456
+ $currency = $this->_getCurrencyCode();
457
+ $data = $this->getApi()->getCheckoutService($amount, $currency);
458
+ if (!isset($data['payment_methods'])) {
459
+ return NULL;
460
+ }
461
+ $paymentMethods = $data['payment_methods'];
462
+ // If method is set, filter out the ones that doesn't belong
463
+ $paymentMethodsFiltered = array();
464
+ if ($method) {
465
+ foreach ($paymentMethods as $paymentMethod) {
466
+ if (isset($paymentMethod['group'])) {
467
+ if (isset($paymentMethod['group']['code'])) {
468
+ $paymentMethod['vaimo_klarna_method'] = $method;
469
+ switch ($method) {
470
+ case Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE:
471
+ if ($paymentMethod['group']['code']=='invoice' && sizeof($paymentMethod['details'])==0) {
472
+ $paymentMethodsFiltered[] = $paymentMethod;
473
+ }
474
+ break;
475
+ case Vaimo_Klarna_Helper_Data::KLARNA_METHOD_ACCOUNT:
476
+ if ($paymentMethod['group']['code']=='part_payment') {
477
+ $paymentMethodsFiltered[] = $paymentMethod;
478
+ }
479
+ break;
480
+ case Vaimo_Klarna_Helper_Data::KLARNA_METHOD_SPECIAL:
481
+ if ($paymentMethod['group']['code']=='invoice' && sizeof($paymentMethod['details'])>0) {
482
+ $paymentMethodsFiltered[] = $paymentMethod;
483
+ }
484
+ break;
485
+ }
486
+ }
487
+ }
488
+ }
489
+ } else {
490
+ $paymentMethodsFiltered = $paymentMethods;
491
+ }
492
+
493
+ // If no method specified, restructure the array, to place all methods under each Vaimo payment method
494
+ // Currently, all calls to this function contains a defined method
495
+ if ($method) {
496
+ $paymentMethodsFilteredGroupd = $paymentMethodsFiltered;
497
+ } else {
498
+ $paymentMethodsFilteredGroupd = array();
499
+ foreach ($paymentMethodsFiltered as $filtered) {
500
+ if (isset($filtered['vaimo_klarna_method'])) {
501
+ $paymentMethodsFilteredGroupd[$filtered['vaimo_klarna_method']][] = $filtered;
502
+ }
503
+ }
504
+ }
505
+ if (sizeof($paymentMethodsFilteredGroupd)>0) {
506
+ $res = $paymentMethodsFilteredGroupd;
507
+ }
508
+ } catch (Mage_Core_Exception $e) {
509
+ $res = NULL;
510
+ }
511
+ return $res;
512
+ }
513
+
514
  public function setPaymentPlan()
515
  {
516
  $id = $this->getPostValues(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_PAYMENT_PLAN);
517
+ // @todo read from checkoutService to find new details for Sweden and Norway and store them
518
  $method = $this->getPostValues('method');
519
  if ($id) {
520
  $pclassArray = $this->_getSpecificPClass($id);
app/code/community/Vaimo/Klarna/Model/Klarna/Abstract.php CHANGED
@@ -607,7 +607,7 @@ abstract class Vaimo_Klarna_Model_Klarna_Abstract extends Vaimo_Klarna_Model_Tra
607
  */
608
  protected function _addDiscount($taxRate)
609
  {
610
- if ($this->getOrder()->getDiscountAmount() <= 0) {
611
  return;
612
  }
613
  // Instead of calculating discount from order etc, we now simply use the amounts we are adding to goods list
607
  */
608
  protected function _addDiscount($taxRate)
609
  {
610
+ if ($this->getOrder()->getDiscountAmount() >= 0) {
611
  return;
612
  }
613
  // Instead of calculating discount from order etc, we now simply use the amounts we are adding to goods list
app/code/community/Vaimo/Klarna/Model/Observer.php CHANGED
@@ -26,6 +26,14 @@
26
 
27
  class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
28
  {
 
 
 
 
 
 
 
 
29
  /*
30
  * Klarna requires the invoice details, lines etc, to perform capture
31
  * It's not known in the capture event, so I pick it up here
@@ -90,17 +98,19 @@ class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
90
  }
91
  }
92
 
93
-
94
- // KLARNA CHECKOUT FROM HERE
95
-
96
- /**
97
- * @return Mage_Checkout_Model_Session
98
  */
99
- protected function _getSession()
100
  {
101
- return Mage::getSingleton('checkout/session');
102
  }
103
 
 
 
 
104
  public function customerAddressFormat(Varien_Event_Observer $observer)
105
  {
106
  $type = $observer->getEvent()->getType();
26
 
27
  class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
28
  {
29
+ /**
30
+ * @return Mage_Checkout_Model_Session
31
+ */
32
+ protected function _getSession()
33
+ {
34
+ return Mage::getSingleton('checkout/session');
35
+ }
36
+
37
  /*
38
  * Klarna requires the invoice details, lines etc, to perform capture
39
  * It's not known in the capture event, so I pick it up here
98
  }
99
  }
100
 
101
+ /*
102
+ * If customer used other payment methods to checkout, it should default back to Klarna Checkout, if used
103
+ *
104
+ * @param Varien_Event_Observer $observer
 
105
  */
106
+ public function resetCheckoutCookie($observer)
107
  {
108
+ $this->_getSession()->setUseOtherMethods(false);
109
  }
110
 
111
+
112
+ // KLARNA CHECKOUT FROM HERE
113
+
114
  public function customerAddressFormat(Varien_Event_Observer $observer)
115
  {
116
  $type = $observer->getEvent()->getType();
app/code/community/Vaimo/Klarna/Model/Payment/Abstract.php CHANGED
@@ -127,7 +127,23 @@ class Vaimo_Klarna_Model_Payment_Abstract extends Mage_Payment_Model_Method_Abst
127
  if ($this->_getHelper()->showTitleAsTextOnly()) {
128
  $klarna = $this->_getKlarnaModel();
129
  $klarna->setQuote($this->getQuote(), $this->_code);
130
- return $klarna->getMethodTitleWithFee($this->_getHelper()->getVaimoKlarnaFeeInclVat($this->getQuote(), false));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  } else {
132
  return '';
133
  }
127
  if ($this->_getHelper()->showTitleAsTextOnly()) {
128
  $klarna = $this->_getKlarnaModel();
129
  $klarna->setQuote($this->getQuote(), $this->_code);
130
+ $presetTitle = NULL;
131
+ $serviceMethods = $klarna->getCheckoutService($this->_code);
132
+ if ($serviceMethods) {
133
+ foreach ($serviceMethods as $serviceMethod) {
134
+ if (isset($serviceMethod['group'])) {
135
+ if (isset($serviceMethod['group']['title']) && isset($serviceMethod['title'])) {
136
+ $presetTitle = $serviceMethod['group']['title'];
137
+ if ($serviceMethod['vaimo_klarna_method']==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE ||
138
+ $serviceMethod['vaimo_klarna_method']==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_SPECIAL) {
139
+ $presetTitle .= ' ' . $serviceMethod['title'];
140
+ }
141
+ break;
142
+ }
143
+ }
144
+ }
145
+ }
146
+ return $klarna->getMethodTitleWithFee($this->_getHelper()->getVaimoKlarnaFeeInclVat($this->getQuote(), false), $presetTitle);
147
  } else {
148
  return '';
149
  }
app/code/community/Vaimo/Klarna/Model/Transport/Abstract.php CHANGED
@@ -168,7 +168,7 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
168
  $this->_languageCode = $this->getConfigData('klarna_language');
169
  } else {
170
  $localeCode = $this->_getConfigDataCall(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $this->_getStoreId() );
171
- $this->_languageCode = $this->_getLocaleCode($localeCode);
172
  }
173
  if (!in_array($this->_languageCode, $this->_supportedLanguages)) {
174
  $this->_languageCode = 'en';
@@ -239,7 +239,7 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
239
  *
240
  * @return string
241
  */
242
- protected function _getLocaleCode($localeCode)
243
  {
244
  $res = NULL;
245
  $preg_result = preg_match("/([a-z]+)_[A-Z]+/", $localeCode, $collection);
@@ -800,6 +800,16 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
800
  return $this->_languageCode;
801
  }
802
 
 
 
 
 
 
 
 
 
 
 
803
  /**
804
  * Returns this class currency code
805
  *
@@ -937,9 +947,13 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
937
  *
938
  * @return string
939
  */
940
- public function getMethodTitleWithFee($fee = NULL)
941
  {
942
- $res = $this->_getHelper()->__($this->getConfigData('title'));
 
 
 
 
943
  if ($this->getQuote() && $this->getMethod()==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE) {
944
  if ($fee) {
945
  $res .= ' (' . $this->_formatPrice($fee) . ')';
@@ -972,7 +986,7 @@ abstract class Vaimo_Klarna_Model_Transport_Abstract extends Varien_Object
972
  'shared_secret' => $this->getConfigData("shared_secret"),
973
  'country_code' => $this->_getCountryCode(),
974
  'language_code' => $this->_getLanguageCode(),
975
- 'locale_code' => $this->_getLanguageCode() . "_" . $this->_getCountryCode(),
976
  'currency_code' => $this->_getCurrencyCode(),
977
  'terms_url' => $this->getConfigData("terms_url"),
978
  'host' => $this->getConfigData("host"),
168
  $this->_languageCode = $this->getConfigData('klarna_language');
169
  } else {
170
  $localeCode = $this->_getConfigDataCall(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $this->_getStoreId() );
171
+ $this->_languageCode = $this->_getLocaleLanguageCode($localeCode);
172
  }
173
  if (!in_array($this->_languageCode, $this->_supportedLanguages)) {
174
  $this->_languageCode = 'en';
239
  *
240
  * @return string
241
  */
242
+ protected function _getLocaleLanguageCode($localeCode)
243
  {
244
  $res = NULL;
245
  $preg_result = preg_match("/([a-z]+)_[A-Z]+/", $localeCode, $collection);
800
  return $this->_languageCode;
801
  }
802
 
803
+ /**
804
+ * Returns this locale string
805
+ *
806
+ * @return string
807
+ */
808
+ protected function _getLocale()
809
+ {
810
+ return $this->_getLanguageCode() . "_" . $this->_getCountryCode();
811
+ }
812
+
813
  /**
814
  * Returns this class currency code
815
  *
947
  *
948
  * @return string
949
  */
950
+ public function getMethodTitleWithFee($fee = NULL, $presetTitle = NULL)
951
  {
952
+ if ($presetTitle) {
953
+ $res = $presetTitle;
954
+ } else {
955
+ $res = $this->_getHelper()->__($this->getConfigData('title'));
956
+ }
957
  if ($this->getQuote() && $this->getMethod()==Vaimo_Klarna_Helper_Data::KLARNA_METHOD_INVOICE) {
958
  if ($fee) {
959
  $res .= ' (' . $this->_formatPrice($fee) . ')';
986
  'shared_secret' => $this->getConfigData("shared_secret"),
987
  'country_code' => $this->_getCountryCode(),
988
  'language_code' => $this->_getLanguageCode(),
989
+ 'locale_code' => $this->_getLocale(),
990
  'currency_code' => $this->_getCurrencyCode(),
991
  'terms_url' => $this->getConfigData("terms_url"),
992
  'host' => $this->getConfigData("host"),
app/code/community/Vaimo/Klarna/controllers/Checkout/KlarnaController.php CHANGED
@@ -301,6 +301,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
301
  $this->renderLayout();
302
 
303
  $this->_getSession()->setKlarnaCheckoutId('');
 
304
  $klarna->logKlarnaApi('successAction displayed success');
305
  } catch (Exception $e) {
306
  $klarna->logKlarnaException($e);
301
  $this->renderLayout();
302
 
303
  $this->_getSession()->setKlarnaCheckoutId('');
304
+ $this->_getSession()->setUseOtherMethods(false);
305
  $klarna->logKlarnaApi('successAction displayed success');
306
  } catch (Exception $e) {
307
  $klarna->logKlarnaException($e);
app/code/community/Vaimo/Klarna/etc/config.xml CHANGED
@@ -25,7 +25,7 @@
25
  --><config>
26
  <modules>
27
  <Vaimo_Klarna>
28
- <version>5.2.0</version>
29
  <name>Vaimo Klarna Module</name>
30
  <depends>
31
  <Mage_Payment/>
@@ -85,10 +85,10 @@
85
  <events>
86
  <customer_address_format>
87
  <observers>
88
- <klarna_address_format>
89
  <class>klarna/observer</class>
90
  <method>customerAddressFormat</method>
91
- </klarna_address_format>
92
  </observers>
93
  </customer_address_format>
94
  </events>
@@ -192,35 +192,43 @@
192
  <events>
193
  <sales_quote_payment_import_data_before>
194
  <observers>
195
- <klarna_clean_additional_information>
196
  <class>klarna/observer</class>
197
  <method>cleanAdditionalInformation</method>
198
- </klarna_clean_additional_information>
199
  </observers>
200
  </sales_quote_payment_import_data_before>
201
  <sales_quote_save_before>
202
  <observers>
203
- <klarna_clean_pno_from_quote>
204
  <class>klarna/observer</class>
205
  <method>cleanPnoFromQuote</method>
206
- </klarna_clean_pno_from_quote>
207
  </observers>
208
  </sales_quote_save_before>
 
 
 
 
 
 
 
 
209
 
210
  <controller_action_predispatch_checkout_onepage_index>
211
  <observers>
212
- <klarna_check_launch_klarnacheckout>
213
  <class>klarna/observer</class>
214
  <method>checkLaunchKlarnaCheckout</method>
215
- </klarna_check_launch_klarnacheckout>
216
  </observers>
217
  </controller_action_predispatch_checkout_onepage_index>
218
  <controller_action_predispatch_onestepcheckout>
219
  <observers>
220
- <klarna_check_launch_klarnacheckout>
221
  <class>klarna/observer</class>
222
  <method>checkLaunchKlarnaCheckout</method>
223
- </klarna_check_launch_klarnacheckout>
224
  </observers>
225
  </controller_action_predispatch_onestepcheckout>
226
  </events>
@@ -246,10 +254,10 @@
246
  <events>
247
  <sales_order_payment_capture>
248
  <observers>
249
- <klarna_pre_payment_capture>
250
  <class>klarna/observer</class>
251
  <method>prePaymentCapture</method>
252
- </klarna_pre_payment_capture>
253
  </observers>
254
  </sales_order_payment_capture>
255
  </events>
25
  --><config>
26
  <modules>
27
  <Vaimo_Klarna>
28
+ <version>5.2.2</version>
29
  <name>Vaimo Klarna Module</name>
30
  <depends>
31
  <Mage_Payment/>
85
  <events>
86
  <customer_address_format>
87
  <observers>
88
+ <klarna>
89
  <class>klarna/observer</class>
90
  <method>customerAddressFormat</method>
91
+ </klarna>
92
  </observers>
93
  </customer_address_format>
94
  </events>
192
  <events>
193
  <sales_quote_payment_import_data_before>
194
  <observers>
195
+ <klarna>
196
  <class>klarna/observer</class>
197
  <method>cleanAdditionalInformation</method>
198
+ </klarna>
199
  </observers>
200
  </sales_quote_payment_import_data_before>
201
  <sales_quote_save_before>
202
  <observers>
203
+ <klarna>
204
  <class>klarna/observer</class>
205
  <method>cleanPnoFromQuote</method>
206
+ </klarna>
207
  </observers>
208
  </sales_quote_save_before>
209
+ <sales_order_save_after>
210
+ <observers>
211
+ <klarna>
212
+ <class>klarna/observer</class>
213
+ <method>resetCheckoutCookie</method>
214
+ </klarna>
215
+ </observers>
216
+ </sales_order_save_after>
217
 
218
  <controller_action_predispatch_checkout_onepage_index>
219
  <observers>
220
+ <klarna>
221
  <class>klarna/observer</class>
222
  <method>checkLaunchKlarnaCheckout</method>
223
+ </klarna>
224
  </observers>
225
  </controller_action_predispatch_checkout_onepage_index>
226
  <controller_action_predispatch_onestepcheckout>
227
  <observers>
228
+ <klarna>
229
  <class>klarna/observer</class>
230
  <method>checkLaunchKlarnaCheckout</method>
231
+ </klarna>
232
  </observers>
233
  </controller_action_predispatch_onestepcheckout>
234
  </events>
254
  <events>
255
  <sales_order_payment_capture>
256
  <observers>
257
+ <klarna>
258
  <class>klarna/observer</class>
259
  <method>prePaymentCapture</method>
260
+ </klarna>
261
  </observers>
262
  </sales_order_payment_capture>
263
  </events>
app/code/community/Vaimo/Klarna/etc/system.xml CHANGED
@@ -781,6 +781,24 @@
781
  <show_in_store>1</show_in_store>
782
  <comment>If you do not belong to a selected customer group, standard Magento checkout will be used. None selected, means enabled for all</comment>
783
  </allow_customer_group>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
784
  </fields>
785
  </vaimo_klarna_checkout>
786
  </groups>
781
  <show_in_store>1</show_in_store>
782
  <comment>If you do not belong to a selected customer group, standard Magento checkout will be used. None selected, means enabled for all</comment>
783
  </allow_customer_group>
784
+ <!--
785
+ <user_defined_parameters translate="label">
786
+ <label>Extra user defined parameters sent to Klarna</label>
787
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
788
+ <sort_order>900</sort_order>
789
+ <show_in_default>1</show_in_default>
790
+ <show_in_website>1</show_in_website>
791
+ <show_in_store>1</show_in_store>
792
+ </user_defined_parameters>
793
+ <extra_parameters>
794
+ <frontend_model>klarna/system_config_form_field_position_attribute_set</frontend_model>
795
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
796
+ <sort_order>910</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
+ </extra_parameters>
801
+ -->
802
  </fields>
803
  </vaimo_klarna_checkout>
804
  </groups>
app/design/frontend/base/default/template/vaimo/klarna/form/account.phtml CHANGED
@@ -24,6 +24,8 @@
24
  */
25
 
26
  $klarnaSetup = $this->getKlarnaSetup();
 
 
27
 
28
  ?>
29
 
@@ -35,23 +37,46 @@ $klarnaSetup = $this->getKlarnaSetup();
35
 
36
  <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" class="form-list" style="display: none;">
37
 
38
- <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
39
- <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
40
- <?php echo '<img src="' . $this->getKlarnaLogotype(90) . '" />'; ?>
 
 
 
 
 
 
 
 
 
 
41
  <?php else: ?>
42
- <li>
43
- <?php echo '<img src="' . $this->getKlarnaLogotype(125) . '" />'; ?>
44
- </li>
 
 
 
 
 
 
45
  <?php endif; ?>
46
- <?php endif; ?>
47
 
48
  <li class="klarna_readme">
49
  <span id="klarna_account_readme"></span>
50
  </li>
51
 
52
- <?php echo $this->getPClassHtml(); ?>
 
 
 
 
53
 
54
- <?php echo $this->getPaymentplanInformationHtml(); ?>
 
 
 
55
 
56
  <li class="klarna_input_wrapper">
57
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
24
  */
25
 
26
  $klarnaSetup = $this->getKlarnaSetup();
27
+ $serviceMethods = $this->getCheckoutService();
28
+ $_showServiceMethods = false;
29
 
30
  ?>
31
 
37
 
38
  <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" class="form-list" style="display: none;">
39
 
40
+ <?php foreach ($serviceMethods as $serviceMethod): ?>
41
+ <?php if ($serviceMethod): ?>
42
+ <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
43
+ <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
44
+ <?php echo $this->useServiceLogotypes($serviceMethod, 90); ?>
45
+ <?php else: ?>
46
+ <li>
47
+ <?php echo $this->useServiceLogotypes($serviceMethod, 125); ?>
48
+ </li>
49
+ <?php endif; ?>
50
+ <?php endif; ?>
51
+ <?php $_showServiceMethods = true; ?>
52
+ <?php break; ?>
53
  <?php else: ?>
54
+ <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
55
+ <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
56
+ <?php echo '<img src="' . $this->getKlarnaLogotype(90) . '" />'; ?>
57
+ <?php else: ?>
58
+ <li>
59
+ <?php echo '<img src="' . $this->getKlarnaLogotype(125) . '" />'; ?>
60
+ </li>
61
+ <?php endif; ?>
62
+ <?php endif; ?>
63
  <?php endif; ?>
64
+ <?php endforeach; ?>
65
 
66
  <li class="klarna_readme">
67
  <span id="klarna_account_readme"></span>
68
  </li>
69
 
70
+ <?php if ($_showServiceMethods): ?>
71
+
72
+ <?php echo $this->getCheckoutServiceHtml(); ?>
73
+
74
+ <?php else: ?>
75
 
76
+ <?php echo $this->getPClassHtml(); ?>
77
+ <?php echo $this->getPaymentplanInformationHtml(); ?>
78
+
79
+ <?php endif; ?>
80
 
81
  <li class="klarna_input_wrapper">
82
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
app/design/frontend/base/default/template/vaimo/klarna/form/children/checkoutservice.phtml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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-2014 Vaimo AB
24
+ */
25
+
26
+ $serviceMethods = $this->getCheckoutService();
27
+ $_firstf = true;
28
+ $_typeString = ' type="radio" ';
29
+ ?>
30
+
31
+
32
+ <li class="payment_plan_wrapper">
33
+ <ul id="<?php echo $this->getMethodCode(); ?>_pclasses" class="payment_plan">
34
+ <?php foreach ($serviceMethods as $serviceMethod): ?>
35
+ <li>
36
+ <label for="pclass_<?php echo $serviceMethod['pclass_id']?>">
37
+
38
+ <?php if ($_firstf) :?>
39
+ <?php $checkedstr = 'checked="checked"'; ?>
40
+ <?php else: ?>
41
+ <?php $checkedstr = ''; ?>
42
+ <?php endif; ?>
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']; ?>
49
+ <?php endif; ?>
50
+
51
+ </label>
52
+ </li>
53
+
54
+ <?php if (sizeof($serviceMethod['details'])>0): ?>
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>
74
+ </div>
75
+ </li>
76
+ <?php endif; ?>
77
+ <?php $_firstf = false; ?>
78
+ <?php endforeach; ?>
79
+ </ul>
80
+ </li>
81
+
app/design/frontend/base/default/template/vaimo/klarna/form/invoice.phtml CHANGED
@@ -25,6 +25,8 @@
25
 
26
  $klarnaSetup = $this->getKlarnaSetup();
27
  $invoiceFee = $this->getKlarnaInvoiceFeeInfo();
 
 
28
 
29
  ?>
30
 
@@ -36,21 +38,43 @@ $invoiceFee = $this->getKlarnaInvoiceFeeInfo();
36
 
37
  <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" class="form-list" style="display: none;">
38
 
39
- <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
40
- <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
41
- <?php echo '<img src="' . $this->getKlarnaLogotype(90) . '" />'; ?>
 
 
 
 
 
 
 
 
 
 
42
  <?php else: ?>
43
- <li>
44
- <?php echo '<img src="' . $this->getKlarnaLogotype(125) . '" />'; ?>
45
- </li>
 
 
 
 
 
 
46
  <?php endif; ?>
47
- <?php endif; ?>
48
 
49
  <li class="klarna_readme">
50
  <span id="klarna_invoice_readme"></span>
51
  </li>
52
 
53
- <li>
 
 
 
 
 
 
54
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
55
 
56
  <?php echo $this->getNotificationsHtml(); ?>
25
 
26
  $klarnaSetup = $this->getKlarnaSetup();
27
  $invoiceFee = $this->getKlarnaInvoiceFeeInfo();
28
+ $serviceMethods = $this->getCheckoutService();
29
+ $_showServiceMethods = false;
30
 
31
  ?>
32
 
38
 
39
  <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" class="form-list" style="display: none;">
40
 
41
+ <?php foreach ($serviceMethods as $serviceMethod): ?>
42
+ <?php if ($serviceMethod): ?>
43
+ <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
44
+ <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
45
+ <?php echo $this->useServiceLogotypes($serviceMethod, 90); ?>
46
+ <?php else: ?>
47
+ <li>
48
+ <?php echo $this->useServiceLogotypes($serviceMethod, 125); ?>
49
+ </li>
50
+ <?php endif; ?>
51
+ <?php endif; ?>
52
+ <?php $_showServiceMethods = true; ?>
53
+ <?php break; ?>
54
  <?php else: ?>
55
+ <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
56
+ <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
57
+ <?php echo '<img src="' . $this->getKlarnaLogotype(90) . '" />'; ?>
58
+ <?php else: ?>
59
+ <li>
60
+ <?php echo '<img src="' . $this->getKlarnaLogotype(125) . '" />'; ?>
61
+ </li>
62
+ <?php endif; ?>
63
+ <?php endif; ?>
64
  <?php endif; ?>
65
+ <?php endforeach; ?>
66
 
67
  <li class="klarna_readme">
68
  <span id="klarna_invoice_readme"></span>
69
  </li>
70
 
71
+ <?php if ($_showServiceMethods): ?>
72
+
73
+ <?php echo $this->getCheckoutServiceHtml(); ?>
74
+
75
+ <?php endif; ?>
76
+
77
+ <li class="klarna_input_wrapper">
78
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
79
 
80
  <?php echo $this->getNotificationsHtml(); ?>
app/design/frontend/base/default/template/vaimo/klarna/form/special.phtml CHANGED
@@ -24,6 +24,8 @@
24
  */
25
 
26
  $klarnaSetup = $this->getKlarnaSetup();
 
 
27
 
28
  ?>
29
 
@@ -35,23 +37,46 @@ $klarnaSetup = $this->getKlarnaSetup();
35
 
36
  <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" class="form-list" style="display: none;">
37
 
38
- <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
39
- <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
40
- <?php echo '<img src="' . $this->getKlarnaLogotype(90) . '" />'; ?>
 
 
 
 
 
 
 
 
 
 
41
  <?php else: ?>
42
- <li>
43
- <?php echo '<img src="' . $this->getKlarnaLogotype(125) . '" />'; ?>
44
- </li>
 
 
 
 
 
 
45
  <?php endif; ?>
46
- <?php endif; ?>
47
 
48
  <li class="klarna_readme">
49
  <span id="klarna_special_readme"></span>
50
  </li>
51
 
52
- <?php echo $this->getPClassHtml(); ?>
 
 
 
 
53
 
54
- <?php echo $this->getPaymentplanInformationHtml(); ?>
 
 
 
55
 
56
  <li class="klarna_input_wrapper">
57
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
24
  */
25
 
26
  $klarnaSetup = $this->getKlarnaSetup();
27
+ $serviceMethods = $this->getCheckoutService();
28
+ $_showServiceMethods = false;
29
 
30
  ?>
31
 
37
 
38
  <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" class="form-list" style="display: none;">
39
 
40
+ <?php foreach ($serviceMethods as $serviceMethod): ?>
41
+ <?php if ($serviceMethod): ?>
42
+ <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
43
+ <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
44
+ <?php echo $this->useServiceLogotypes($serviceMethod, 90); ?>
45
+ <?php else: ?>
46
+ <li>
47
+ <?php echo $this->useServiceLogotypes($serviceMethod, 125); ?>
48
+ </li>
49
+ <?php endif; ?>
50
+ <?php endif; ?>
51
+ <?php $_showServiceMethods = true; ?>
52
+ <?php break; ?>
53
  <?php else: ?>
54
+ <?php if (Mage::helper('klarna')->showTitleAsTextOnly()): ?>
55
+ <?php if (Mage::helper('klarna')->isOneStepCheckout()): ?>
56
+ <?php echo '<img src="' . $this->getKlarnaLogotype(90) . '" />'; ?>
57
+ <?php else: ?>
58
+ <li>
59
+ <?php echo '<img src="' . $this->getKlarnaLogotype(125) . '" />'; ?>
60
+ </li>
61
+ <?php endif; ?>
62
+ <?php endif; ?>
63
  <?php endif; ?>
64
+ <?php endforeach; ?>
65
 
66
  <li class="klarna_readme">
67
  <span id="klarna_special_readme"></span>
68
  </li>
69
 
70
+ <?php if ($_showServiceMethods): ?>
71
+
72
+ <?php echo $this->getCheckoutServiceHtml(); ?>
73
+
74
+ <?php else: ?>
75
 
76
+ <?php echo $this->getPClassHtml(); ?>
77
+ <?php echo $this->getPaymentplanInformationHtml(); ?>
78
+
79
+ <?php endif; ?>
80
 
81
  <li class="klarna_input_wrapper">
82
  <ul id="<?php echo $this->getMethodCode(); ?>_input_fields" class="klarna-input-box">
js/vaimo/klarna/klarna.js CHANGED
@@ -303,4 +303,13 @@ function insertKlarnaSpecialElements(merchant, locale) {
303
 
304
  function klarnaCheckoutGo(url) {
305
  window.location.assign(url);
 
 
 
 
 
 
 
 
 
306
  }
303
 
304
  function klarnaCheckoutGo(url) {
305
  window.location.assign(url);
306
+ }
307
+
308
+ function toggleInformationBoxes(id) {
309
+ var innerDivs = document.querySelectorAll('.payment_plan_info_wrapper');
310
+ for(var i=0; i<innerDivs.length; i++)
311
+ {
312
+ Element.hide(innerDivs[i].id);
313
+ }
314
+ Element.show('infobox_pclass_' + id);
315
  }
lib/Klarna/CHANGELOG CHANGED
@@ -1,226 +1,99 @@
1
- =====================
2
- Klarna PHP API
3
- =====================
4
-
5
- v2.3.4
6
- ---------------
7
- Date: 2013-05-03
8
-
9
- Joakim L. <support@klarna.com>
10
- Klarna.php
11
- Update beta address to payment.testdrive.klarna.com
12
-
13
- v2.3.3
14
- ---------------
15
- Date: 2013-03-28
16
-
17
- Rickard D. <support@klarna.com>
18
- Klarna.php (reserveAmount) :
19
- No longer remove falsy values from the digest string.
20
-
21
- v2.3.2
22
- ---------------
23
- Date: 2013-03-25
24
-
25
- Rickard D. <support@klarna.com>
26
- Klarna.php (reserveAmount) :
27
- Allow reserveAmount calls with an amount of 0.
28
-
29
- v2.3.1
30
- ---------------
31
- Date: 2012-12-07
32
-
33
- Christer G. <support@klarna.com>
34
- Klarna.php (getClientIP) :
35
- Refactored to be more readable.
36
-
37
- Rickard D. <support@klarna.com>
38
- Klarna.php (setConfig) :
39
- Configuration may now be an array, aswell as a and
40
- ArrayAccess.
41
-
42
- Majid G. <support@klarna.com>
43
- Klarna.php (update) :
44
- Removed rno validation from the library
45
-
46
- v2.3.0
47
- ---------------
48
- Date: 2012-09-17
49
-
50
- Rickard D. <support@klarna.com>
51
- Klarna.php (activateReservation) :
52
- Change to allow NULL to be sent in as PNO when activating a
53
- reservation. Any other value than null will still trigger a
54
- verification that a string longer than 0 characters is sent
55
- as PNO.
56
-
57
- Klarna.php (activate) : new function
58
- New function to activate a reservation using minimal information.
59
- Optional information for the activate call should be set using
60
- setActivateInformation.
61
- To partially activate a reservation, use Klarna::addArtNo() function
62
- (replaces splitReservation).
63
-
64
- Klarna.php (update) : new function
65
- New function to update a reservation using minimal information.
66
- Use setAddress to update address, addArticle to update an article in
67
- the goodslist and setEstoreInfo to update order id:s.
68
-
69
- Klarna.php (checkCountryCurrency) : removed function
70
- As this function does not scale and does not belong in a library it has
71
- been removed.
72
-
73
- Country.php () :
74
- Added all available country constants.
75
-
76
- Language.php () :
77
- Added all available language constants.
78
-
79
- Klarna.php (getLanguageForCountry) : deprecated
80
- (getCurrencyForCountry) : deprecated
81
- Country.php (checkLanguage) : deprecated
82
- (checkCurrency) : deprecated
83
- (getLanguage) : deprecated
84
- (getCurrency) : deprecated
85
- Deprecated functions that will not scale and will not be compatible for
86
- any potential future markets.
87
-
88
- Klarna.php (init, setCountry) :
89
- Removed the automatic setting of currency and language when setting
90
- the country. This functionality does not scale and was not consistent
91
- depending on how you set the country.
92
-
93
- Majid G. <support@klarna.com>
94
- Klarna.php (addTransaction) :
95
- Removing the link comment for PRE_PAY flag
96
-
97
- Flags.php (KlarnaFlags) :
98
- Adding deprecated comment for Flag 8 (PRE_PAY)
99
-
100
-
101
- v2.2.1
102
- ----------------
103
- Date: 2011-05-18
104
-
105
- David K. <support@klarna.com>
106
- Klarna.php (summarizeGoodsList)
107
- New method that can be used to get a aggregated price for the entire
108
- goodslist
109
-
110
- Klarna.php (reserveAmount)
111
- Replace the simple goodslist summary that did not take taxes and
112
- discounts into consideration with a call to summarizeGoodsList
113
-
114
- v2.2.0
115
- ----------------
116
- Date: 2012-05-14
117
-
118
- Rickard D. <support@klarna.com>
119
- Klarna.php (assembleAddress) :
120
- Only validate that the proper object type is sent in to Klarna, no longer
121
- performs any validation of the content of the fields.
122
-
123
- klarnaaddr.php () :
124
- Removed validation of field contets. Now possible to set all fields to
125
- empty strings if you wan.
126
-
127
- Klarna.php (addTransaction, reserveAmount, activateReservation) :
128
- If $gender is sent in as an empty string, treat it as null.
129
-
130
- klarnacalc.php (calc_apr) :
131
- Removed the ability to send in a FIXED or SPECIAL pclass to
132
- KlarnaCalc->calc_apr. If this function is called with a FIXED or SPECIAL
133
- pclass it will now throw an exception instead of causing a fatal error.
134
-
135
- Klarna.php (getAllPClasses) : added
136
- storage.intf.php (getAllPClasses) : added
137
- Added possibility to get all stored pclasses, regardless of eid or type.
138
-
139
- Klarna.php (setPCStorage) :
140
- Added possibility to set a PCStorage on the Klarna object.
141
-
142
- Klarna.php (getPCStorage) : made public (was protected)
143
- Added possibility to get the configured PCStorage object from the Klarna
144
- object.
145
-
146
- Country.php (getLanguageForCountry, getCurrencyForCountry) : added
147
- Added possibility to get the language or currency for a specific country.
148
-
149
- All Files () :
150
- Updated code to follow the PEAR standard.
151
-
152
- Refactored several classes into their own files.
153
- All refactored classes were previosly declared inside the Klarna.php
154
- file. The new files are now instead included in the Klarna.php file,
155
- so no functionality has changed in that regard.
156
- KlarnaCountry => Country.php
157
- KlarnaCurrency => Currency.php
158
- KlarnaEncoding => Encoding.php
159
- KlarnaException => Exceptions.php
160
- KlarnaFlags => Flags.php
161
- KlarnaLanguage => Language.php
162
-
163
-
164
- Made almost all exceptions thrown more specific and meaningful than just
165
- KlarnaException, although they still extend KlarnaException so old
166
- try-catch blocks will still work.
167
-
168
- v2.1.3
169
- ----------------
170
- Date: 2011-09-26
171
-
172
- * Fixed a minor conversion issue.
173
-
174
- v2.1.2
175
- ----------------
176
- Date: 2011-09-12
177
-
178
- * Improved the MySQL and SQL storage modules
179
-
180
- Added so you can pass an associative array to pcURI with the database info
181
-
182
- Added support for dashes in the normal regexp handling
183
-
184
- Fixed a rounding bug which requires a DROP TABLE and re-update of all PClasses
185
-
186
- * Fixed a minor issue regarding the debug and xmlrpcDebug settings
187
-
188
- * Added support for the ISO 3166-1 alpha-3 country codes
189
-
190
-
191
- v2.1.1
192
- ----------------
193
- Date: 2011-09-06
194
-
195
- * Corrected a few issues in the phpDoc comments
196
-
197
- * Improved fetchPClasses, it is now possible to specify only country (as code or constant)
198
-
199
- * Changed the MySQL PClass storage's clear functionality to use DELETE FROM instead of DROP TABLE,
200
- this is to prevent possible permission issues in the database
201
-
202
- * Various improvements and bug fixes
203
-
204
- v2.1.0
205
- ----------------
206
- Date: 2011-08-19
207
-
208
- * Added support for stronger cryptographic hashes
209
-
210
- The default is now SHA-512 instead of MD5
211
-
212
- * Experimental generic database storage using PDO
213
-
214
- * Added work arounds for issues with the XML-RPC library
215
-
216
- * Bug fix and additional sanity checks in getCheapestPClass
217
-
218
- * Debug mode uses FirePHP if available
219
-
220
- v2.0.0
221
- ----------------
222
- Date: 2011-07-01
223
-
224
- * Initial release of 2.0 API
225
-
226
- * A complete rewrite using object oriented practices
1
+ ## v3.2.0 - 2014-11-11
2
+ - **NEW MINT-1894** Add setter for client IP - *Christer.G*
3
+
4
+ ## v3.1.2 - 2014-11-06
5
+ - **FIX MINT-1930** Fix notice and warnings in PHP 5.3 & 5.4 - *Christer.G*
6
+
7
+ ## v3.1.1 - 2014-08-22
8
+ - **NEW MINT-1664** Reformat changelog - *Christer.G*
9
+
10
+ ## v3.1.0 - 2014-08-22
11
+ - **NEW MINT-1716** PHP library support for Checkout Service - *Christer.G*
12
+
13
+ ## v3.0.0 - 2014-06-10
14
+ - **NEW MINT-1682** Remove functions updateNotes & reserveOcrEmail - *Christer.G*
15
+
16
+ ## v2.6.0 - 2014-05-15
17
+ - **NEW MINT-1528** Remove Candice - *Christer.G*
18
+
19
+ ## v2.5.0 - 2014-02-13
20
+ - **NEW MINT-1139** Code examples structure and comments - *Joakim.L*
21
+ - **FIX MINT-1238** Support read only databases - *Christer.G*
22
+
23
+ ## v2.4.2 - 2013-07-02
24
+ - **NEW MINT-816** Update lowest_monthly_payment_for_account - *Rickard.D*
25
+
26
+ ## v2.4.1 - 2013-06-05
27
+ - **FIX MINT-751** Update call filters out falsy values for digest - *Christer.G*
28
+
29
+ ## v2.4.0 - 2013-05-08
30
+ - **NEW MINT-674** Add goods list to credit calls for restocking fees - *Rickard.D*
31
+
32
+ ## v2.3.4 - 2013-05-03
33
+ - **NEW MINT-672** Change BETA host from beta-test to testdrive - *Joakim.L*
34
+
35
+ ## v2.3.3 - 2013-03-28
36
+ - **FIX MINT-661** Creating reservation with amount 0 gets a error 9114 - *Rickard.D*
37
+
38
+ ## v2.3.2 - 2013-03-25
39
+ - **FIX MINT-636** Remove restrictions on creating reservation with amount 0 - *Rickard.D*
40
+
41
+ ## v2.3.1 - 2012-12-07
42
+ - **FIX MINT-91** Use "HTTP_X_FORWARDED_FOR" if it exists - *Christer.G*
43
+ - **FIX MINT-97** Update function uses internal validation in PHP - *Majid.G*
44
+ - **NEW MINT-28** Prepare the example files for the API reference guide - *Rickard.D*
45
+
46
+ ## v2.3.0 - 2012-09-12
47
+ - **FIX MSDEV-3177** Returns error code 9114 when send empty value to SetActivateInfo - *David.K*
48
+ - **NEW MSDEV-3137** Support custom url in config - *Rickard.D*
49
+ - **NEW MSDEV-2932** Adding support for Austria - *Christer.G*
50
+ - **NEW MSDEV-2660** Add description in return_amount to PHP - *Majid.G*
51
+ - **NEW MSEDV-2396** Preparing for Austria - *Rickard.D*
52
+ - **NEW MSDEV-2600** Add partial activation to activate - *Rickard.D*
53
+ - **NEW MSDEV-2399** Add update call - *Rickard.D*
54
+ - **NEW MSDEV-2352** Add country / currency / language constants and remove validation - *Rickard.D*
55
+ - **FIX MSDEV-2516** Amount -1 / ignoring VAT - *David.K*
56
+ - **NEW MSDEV-2400** Add activate call - *Rickard.D*
57
+ - **NEW MSDEV-2481** Make it possible to send an empty pno string in activate_reservation - *Rickard.D*
58
+
59
+ ## v2.2.2 - 2012-04-09
60
+ - **NEW MSDEV-2403** Remove ILT specifics - *Rickard.D*
61
+ - **NEW MSDEV-2400** Add activate call - *Rickard.D*
62
+ - **NEW MSDEV-2027** Clean example files - *Rickard.D*
63
+ - **NEW MSDEV-2321** If no gender is selected for DE/NL, send in NULL - *Rickard.D*
64
+ - **NEW MSDEV-807** Custom pclass storage - *Rickard.D*
65
+ - **NEW MSDEV-1766** Minimise address validation in php library - *Rickard.D*
66
+ - **NEW MSDEV-2136** PEAR-ify php-api - *Rickard.D*
67
+ - **FIX MSDEV-2006** Update activatePart example - *Rickard.D*
68
+ - **FIX MSDEV-2074** Update splitReservation example - *Rickard.D*
69
+ - **NEW MSDEV-1879** Update examples - *David.K*
70
+ - **NEW MSDEV-2065** Remove update_email - *Rickard.D*
71
+ - **NEW MSDEV-2130** Set client-ip to 0.0.0.0 in activateReservation - *Rickard.D*
72
+ - **NEW MSDEV-2164** Remove Calc APR from Fixed and Special pclasses - *Rickard.D*
73
+ - **FIX MSDEV-1728** fetchPClasses interrupted when no country is defined - *David.K*
74
+ - **FIX MSDEV-561** Validation of input is rejecting calls to KO when it shouldn't - *David.K*
75
+ - **NEW MSDEV-1718** Change Candice URL - *David.K*
76
+ - **NEW MSDEV-1683** Add ILT method - *David.K*
77
+
78
+
79
+ ## v2.1.3 - 2011-10-24
80
+ - **FIX MSDEV-1490** KlarnaPClass setMinAmount converts to int, when it should be float - *Joakim.L*
81
+
82
+ ## v2.1.2 - 2011-09-13
83
+ - **NEW MSDEV-1321** Support for 3 letter country code in getCountryForCode - *Joakim.L*
84
+ - **FIX MSDEV-1302** Add backticks to create database statement - *Joakim.L*
85
+ - **FIX MSDEV-1312** Using xmlrpcDebug or debug in e.g. JSON disregards value and sets it to true if the field exists - *Joakim.L*
86
+ - **FIX MSDEV-1305** Datatype is wrong for interest rate for MySQL storage - *Joakim.L*
87
+ - **NEW MSDEV-1004** Make localisation methods accessible from static - *David.K*
88
+
89
+ ## v2.1.1 - 2011-09-06
90
+ - **NEW MSDEV-1188** Add language constant for English - *David.K*
91
+ - **FIX MSDEV-1142** Fix copy/paste related dirty code - *Joakim.L*
92
+
93
+ ## v2.1.0 - 2011-08-25
94
+ - **NEW MSDEV-981** Update api for module release - *David.K*
95
+ - **NEW MSDEV-767** Implement the SHA-2 functionality - *Joakim.L*
96
+ - **NEW MSDEV-758** Add ILT method to the API - *Joakim.L*
97
+
98
+ ## v2.0.0 - 2011-07-01
99
+ - Initial release of 2.0 API
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/Changelog-Vaimo.txt CHANGED
@@ -1,3 +1,4 @@
 
1
 
2
  setVersion
3
  Function setVersion in Klarna.php changed from protected to public, to be able to set that variable, without having to inherit the class
@@ -16,4 +17,9 @@ Klarna_Checkout_BasicConnector - __construct
16
  Klarna_Checkout_BasicConnector - userAgent
17
  Added parameter to library so I could send in module and application version in the userAgent
18
 
 
 
19
 
 
 
 
1
+ Functional changes to Klarnas standard Library
2
 
3
  setVersion
4
  Function setVersion in Klarna.php changed from protected to public, to be able to set that variable, without having to inherit the class
17
  Klarna_Checkout_BasicConnector - userAgent
18
  Added parameter to library so I could send in module and application version in the userAgent
19
 
20
+ setConfigVariable
21
+ Added function setConfigVariable to Klarna.php, to set test URL for checkoutService API
22
 
23
+
24
+ 2014-12-16
25
+ Updated library to v3.2.0
lib/Klarna/CheckoutServiceRequest.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File containing the class to perform a checkout service call
4
+ *
5
+ * PHP version 5.3
6
+ *
7
+ * @category Payment
8
+ * @package KlarnaAPI
9
+ * @author MINT <ms.modules@klarna.com>
10
+ * @copyright 2014 Klarna AB
11
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
+ */
14
+
15
+ /**
16
+ * CheckoutService
17
+ *
18
+ * @category Payment
19
+ * @package KlarnaAPI
20
+ * @author MINT <ms.modules@klarna.com>
21
+ * @copyright 2014 Klarna AB
22
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
+ * @link https://developers.klarna.com/
24
+ */
25
+ class CheckoutServiceRequest
26
+ {
27
+ /**
28
+ * @var ArrayAccess
29
+ */
30
+ protected $config;
31
+
32
+ /**
33
+ * @var array
34
+ */
35
+ protected $params;
36
+
37
+ /**
38
+ * @var string
39
+ */
40
+ protected $uri = 'https://api.klarna.com/touchpoint/checkout/';
41
+
42
+ /**
43
+ * @var string
44
+ */
45
+ protected $accept = 'application/vnd.klarna.touchpoint-checkout.payment-methods-v1+json';
46
+
47
+ /**
48
+ * Constructor
49
+ *
50
+ * @param ArrayAccess $config Configuration
51
+ * @param array $params Parameters used to build query.
52
+ */
53
+ public function __construct($config, $params)
54
+ {
55
+ $this->config = $config;
56
+ $this->params = array_filter($params);
57
+
58
+ if (isset($config['checkout_service_uri'])) {
59
+ $this->uri = $config['checkout_service_uri'];
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Create a checkout service response
65
+ *
66
+ * @param int $code HTTP status code
67
+ * @param string $body HTTP body
68
+ *
69
+ * @return CheckoutServiceResponse Checkout service response
70
+ */
71
+ public function createResponse($code, $body)
72
+ {
73
+ return new CheckoutServiceResponse($this, $code, $body);
74
+ }
75
+
76
+ /**
77
+ * Get the url associated to this request
78
+ *
79
+ * @return string URL with query
80
+ */
81
+ public function getURL()
82
+ {
83
+ return $this->uri . '?'. http_build_query($this->params);
84
+ }
85
+
86
+ /**
87
+ * Get the headers associated to this request
88
+ *
89
+ * @return array Array of headers strings
90
+ */
91
+ public function getHeaders()
92
+ {
93
+ $digest = Klarna::digest(
94
+ Klarna::colon(
95
+ $this->config['eid'],
96
+ $this->params['currency'],
97
+ $this->config['secret']
98
+ )
99
+ );
100
+
101
+ return array(
102
+ "Accept: {$this->accept}",
103
+ "Authorization: xmlrpc-4.2 {$digest}"
104
+ );
105
+ }
106
+ }
lib/Klarna/CheckoutServiceResponse.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File containing the CheckoutServiceResponse class.
4
+ *
5
+ * PHP version 5.3
6
+ *
7
+ * @category Payment
8
+ * @package KlarnaAPI
9
+ * @author MINT <ms.modules@klarna.com>
10
+ * @copyright 2014 Klarna AB
11
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
+ */
14
+
15
+ /**
16
+ * CheckoutServiceResponse
17
+ *
18
+ * @category Payment
19
+ * @package KlarnaAPI
20
+ * @author MINT <ms.modules@klarna.com>
21
+ * @copyright 2014 Klarna AB
22
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
+ * @link https://developers.klarna.com/
24
+ */
25
+ class CheckoutServiceResponse
26
+ {
27
+ /**
28
+ * @var CheckoutServiceRequest
29
+ */
30
+ protected $request;
31
+
32
+ /**
33
+ * @var int
34
+ */
35
+ protected $status;
36
+
37
+ /**
38
+ * @var array
39
+ */
40
+ protected $data;
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ * @param CheckoutServiceRequest $request The original request
46
+ * @param int $status HTTP status code
47
+ * @param string $data JSON string
48
+ */
49
+ public function __construct($request, $status, $data)
50
+ {
51
+ $this->request = $request;
52
+ $this->status = $status;
53
+ $data = json_decode($data, true);
54
+
55
+ if ($data === null) {
56
+ throw new InvalidArgumentException('data must be a valid JSON string');
57
+ }
58
+
59
+ $this->data = $data;
60
+ }
61
+
62
+ /**
63
+ * Get the original request
64
+ *
65
+ * @return CheckoutServiceRequest The original request
66
+ */
67
+ public function getRequest()
68
+ {
69
+ return $this->request;
70
+ }
71
+
72
+ /**
73
+ * Get the response status code
74
+ *
75
+ * @return int Status code
76
+ */
77
+ public function getStatus()
78
+ {
79
+ return $this->status;
80
+ }
81
+
82
+ /**
83
+ * Get the response data
84
+ *
85
+ * @return array Response data
86
+ */
87
+ public function getData()
88
+ {
89
+ return $this->data;
90
+ }
91
+ }
lib/Klarna/Country.php CHANGED
@@ -10,7 +10,7 @@
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
- * @link http://integration.klarna.com/
14
  */
15
 
16
  /**
@@ -21,7 +21,7 @@
21
  * @author MS Dev <ms.modules@klarna.com>
22
  * @copyright 2012 Klarna AB (http://klarna.com)
23
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
24
- * @link http://integration.klarna.com/
25
  */
26
  class KlarnaCountry
27
  {
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
+ * @link https://developers.klarna.com/
14
  */
15
 
16
  /**
21
  * @author MS Dev <ms.modules@klarna.com>
22
  * @copyright 2012 Klarna AB (http://klarna.com)
23
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
24
+ * @link https://developers.klarna.com/
25
  */
26
  class KlarnaCountry
27
  {
lib/Klarna/CurlHandle.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File containing the CurlHandle class.
4
+ *
5
+ * PHP version 5.3
6
+ *
7
+ * @category Payment
8
+ * @package KlarnaAPI
9
+ * @author MINT <ms.modules@klarna.com>
10
+ * @copyright 2014 Klarna AB
11
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
+ */
14
+
15
+ /**
16
+ * CurlHandle
17
+ *
18
+ * @category Payment
19
+ * @package KlarnaAPI
20
+ * @author MINT <ms.modules@klarna.com>
21
+ * @copyright 2014 Klarna AB
22
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
+ * @link https://developers.klarna.com/
24
+ */
25
+ class CurlHandle
26
+ {
27
+ /**
28
+ * @var cURL
29
+ */
30
+ protected $handle;
31
+
32
+ /**
33
+ * Constructor
34
+ *
35
+ * @throws RuntimeException if cURL extension is not loaded
36
+ */
37
+ public function __construct()
38
+ {
39
+ if (!extension_loaded('curl')) {
40
+ throw new RuntimeException(
41
+ 'cURL extension is requred.'
42
+ );
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Initialize the handle
48
+ *
49
+ * @return void
50
+ */
51
+ public function init()
52
+ {
53
+ $this->handle = curl_init();
54
+ }
55
+
56
+ /**
57
+ * Set a cURL option
58
+ *
59
+ * @param int $name CURLOPT_* constant
60
+ * @param mixed $value Option value
61
+ *
62
+ * @return void
63
+ */
64
+ public function setOption($name, $value)
65
+ {
66
+ curl_setopt($this->handle, $name, $value);
67
+ }
68
+
69
+ /**
70
+ * Execute cURL handle
71
+ *
72
+ * @return void
73
+ */
74
+ public function execute()
75
+ {
76
+ return curl_exec($this->handle);
77
+ }
78
+
79
+ /**
80
+ * Get cURL info
81
+ *
82
+ * @return array|false Array with info or false if error occurred
83
+ */
84
+ public function getInfo()
85
+ {
86
+ return curl_getinfo($this->handle);
87
+ }
88
+
89
+ /**
90
+ * Get cURL error
91
+ *
92
+ * @return string|false Error message or false if no error occurred
93
+ */
94
+ public function getError()
95
+ {
96
+ return curl_error($this->handle);
97
+ }
98
+
99
+ /**
100
+ * Close the cURL handle
101
+ *
102
+ * @return void
103
+ */
104
+ public function close()
105
+ {
106
+ curl_close($this->handle);
107
+ }
108
+ }
lib/Klarna/CurlTransport.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File containing the CurlTransport class.
4
+ *
5
+ * PHP version 5.3
6
+ *
7
+ * @category Payment
8
+ * @package KlarnaAPI
9
+ * @author MINT <ms.modules@klarna.com>
10
+ * @copyright 2014 Klarna AB
11
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
+ */
14
+
15
+ /**
16
+ * CurlTransport
17
+ *
18
+ * @category Payment
19
+ * @package KlarnaAPI
20
+ * @author MINT <ms.modules@klarna.com>
21
+ * @copyright 2014 Klarna AB
22
+ * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
+ * @link https://developers.klarna.com/
24
+ */
25
+ class CurlTransport
26
+ {
27
+ /**
28
+ * @var CurlHandle
29
+ */
30
+ protected $handle;
31
+
32
+ /**
33
+ * Constructor
34
+ *
35
+ * @param CurlHandle $handle Curl handle to use
36
+ * @param int $timeout Time-out in seconds
37
+ */
38
+ public function __construct($handle, $timeout)
39
+ {
40
+ $this->handle = $handle;
41
+ $this->timeout = $timeout;
42
+ }
43
+
44
+ /**
45
+ * Get time-out seconds
46
+ *
47
+ * @return int Time-out seconds
48
+ */
49
+ public function getTimeout()
50
+ {
51
+ return $this->timeout;
52
+ }
53
+
54
+ /**
55
+ * Send a request object
56
+ *
57
+ * @param object $request The request to send
58
+ *
59
+ * @throws KlarnaException For e.g. a timeout
60
+ *
61
+ * @return object A response to the request sent
62
+ */
63
+ public function send($request)
64
+ {
65
+ $this->handle->init();
66
+
67
+ $this->handle->setOption(CURLOPT_URL, $request->getURL());
68
+ $this->handle->setOption(CURLOPT_HTTPHEADER, $request->getHeaders());
69
+ $this->handle->setOption(CURLOPT_RETURNTRANSFER, true);
70
+ $this->handle->setOption(CURLOPT_CONNECTTIMEOUT, $this->getTimeout());
71
+ $this->handle->setOption(CURLOPT_TIMEOUT, $this->getTimeout());
72
+ $this->handle->setOption(CURLOPT_SSL_VERIFYHOST, 2);
73
+ $this->handle->setOption(CURLOPT_SSL_VERIFYPEER, true);
74
+
75
+ $data = $this->handle->execute();
76
+ $info = $this->handle->getInfo();
77
+ $error = $this->handle->getError();
78
+
79
+ $this->handle->close();
80
+
81
+ /*
82
+ * A failure occurred if:
83
+ * payload is false (e.g. HTTP timeout?).
84
+ * info is false, then it has no HTTP status code.
85
+ */
86
+ if (strlen($error) > 0) {
87
+ throw new KlarnaException(
88
+ "Connection failed with error: {$error}"
89
+ );
90
+ }
91
+
92
+ return $request->createResponse(intval($info['http_code']), $data);
93
+ }
94
+ }
lib/Klarna/Currency.php CHANGED
@@ -10,7 +10,7 @@
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
- * @link http://integration.klarna.com/
14
  */
15
 
16
  /**
@@ -21,7 +21,7 @@
21
  * @author MS Dev <ms.modules@klarna.com>
22
  * @copyright 2012 Klarna AB (http://klarna.com)
23
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
24
- * @link http://integration.klarna.com/
25
  */
26
  class KlarnaCurrency
27
  {
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
+ * @link https://developers.klarna.com/
14
  */
15
 
16
  /**
21
  * @author MS Dev <ms.modules@klarna.com>
22
  * @copyright 2012 Klarna AB (http://klarna.com)
23
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
24
+ * @link https://developers.klarna.com/
25
  */
26
  class KlarnaCurrency
27
  {
lib/Klarna/Encoding.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  require_once 'Exceptions.php';
@@ -22,7 +22,7 @@ require_once 'Exceptions.php';
22
  * @author MS Dev <ms.modules@klarna.com>
23
  * @copyright 2012 Klarna AB (http://klarna.com)
24
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
25
- * @link http://integration.klarna.com/
26
  */
27
  class KlarnaEncoding
28
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  require_once 'Exceptions.php';
22
  * @author MS Dev <ms.modules@klarna.com>
23
  * @copyright 2012 Klarna AB (http://klarna.com)
24
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
25
+ * @link https://developers.klarna.com/
26
  */
27
  class KlarnaEncoding
28
  {
lib/Klarna/Exceptions.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  require_once 'Country.php';
@@ -23,7 +23,7 @@ require_once 'Country.php';
23
  * @author MS Dev <ms.modules@klarna.com>
24
  * @copyright 2012 Klarna AB (http://klarna.com)
25
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
26
- * @link http://integration.klarna.com/
27
  */
28
  class KlarnaException extends Exception
29
  {
@@ -46,7 +46,7 @@ class KlarnaException extends Exception
46
  * @author MS Dev <ms.modules@klarna.com>
47
  * @copyright 2012 Klarna AB (http://klarna.com)
48
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
49
- * @link http://integration.klarna.com/
50
  */
51
  class Klarna_InvalidConfigurationException extends KlarnaException
52
  {
@@ -69,7 +69,7 @@ class Klarna_InvalidConfigurationException extends KlarnaException
69
  * @author MS Dev <ms.modules@klarna.com>
70
  * @copyright 2012 Klarna AB (http://klarna.com)
71
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
72
- * @link http://integration.klarna.com/
73
  */
74
  class Klarna_IncompleteConfigurationException extends KlarnaException
75
  {
@@ -90,7 +90,7 @@ class Klarna_IncompleteConfigurationException extends KlarnaException
90
  * @author MS Dev <ms.modules@klarna.com>
91
  * @copyright 2012 Klarna AB (http://klarna.com)
92
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
93
- * @link http://integration.klarna.com/
94
  */
95
  class Klarna_InvalidKlarnaAddrException extends KlarnaException
96
  {
@@ -114,7 +114,7 @@ class Klarna_InvalidKlarnaAddrException extends KlarnaException
114
  * @author MS Dev <ms.modules@klarna.com>
115
  * @copyright 2012 Klarna AB (http://klarna.com)
116
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
117
- * @link http://integration.klarna.com/
118
  */
119
  class Klarna_MissingAddressException extends KlarnaException
120
  {
@@ -135,7 +135,7 @@ class Klarna_MissingAddressException extends KlarnaException
135
  * @author MS Dev <ms.modules@klarna.com>
136
  * @copyright 2012 Klarna AB (http://klarna.com)
137
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
138
- * @link http://integration.klarna.com/
139
  */
140
  class Klarna_ConfigFieldMissingException extends KlarnaException
141
  {
@@ -159,7 +159,7 @@ class Klarna_ConfigFieldMissingException extends KlarnaException
159
  * @author MS Dev <ms.modules@klarna.com>
160
  * @copyright 2012 Klarna AB (http://klarna.com)
161
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
162
- * @link http://integration.klarna.com/
163
  */
164
  class Klarna_UnknownEncodingException extends KlarnaException
165
  {
@@ -184,7 +184,7 @@ class Klarna_UnknownEncodingException extends KlarnaException
184
  * @author MS Dev <ms.modules@klarna.com>
185
  * @copyright 2012 Klarna AB (http://klarna.com)
186
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
187
- * @link http://integration.klarna.com/
188
  */
189
  class Klarna_UnknownAddressTypeException extends KlarnaException
190
  {
@@ -207,7 +207,7 @@ class Klarna_UnknownAddressTypeException extends KlarnaException
207
  * @author MS Dev <ms.modules@klarna.com>
208
  * @copyright 2012 Klarna AB (http://klarna.com)
209
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
210
- * @link http://integration.klarna.com/
211
  */
212
  class Klarna_MissingCountryException extends KlarnaException
213
  {
@@ -228,7 +228,7 @@ class Klarna_MissingCountryException extends KlarnaException
228
  * @author MS Dev <ms.modules@klarna.com>
229
  * @copyright 2012 Klarna AB (http://klarna.com)
230
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
231
- * @link http://integration.klarna.com/
232
  */
233
  class Klarna_UnknownCountryException extends KlarnaException
234
  {
@@ -251,7 +251,7 @@ class Klarna_UnknownCountryException extends KlarnaException
251
  * @author MS Dev <ms.modules@klarna.com>
252
  * @copyright 2012 Klarna AB (http://klarna.com)
253
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
254
- * @link http://integration.klarna.com/
255
  */
256
  class Klarna_UnknownLanguageException extends KlarnaException
257
  {
@@ -274,7 +274,7 @@ class Klarna_UnknownLanguageException extends KlarnaException
274
  * @author MS Dev <ms.modules@klarna.com>
275
  * @copyright 2012 Klarna AB (http://klarna.com)
276
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
277
- * @link http://integration.klarna.com/
278
  */
279
  class Klarna_UnknownCurrencyException extends KlarnaException
280
  {
@@ -297,7 +297,7 @@ class Klarna_UnknownCurrencyException extends KlarnaException
297
  * @author MS Dev <ms.modules@klarna.com>
298
  * @copyright 2012 Klarna AB (http://klarna.com)
299
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
300
- * @link http://integration.klarna.com/
301
  */
302
  class Klarna_ArgumentNotSetException extends KlarnaException
303
  {
@@ -320,7 +320,7 @@ class Klarna_ArgumentNotSetException extends KlarnaException
320
  * @author MS Dev <ms.modules@klarna.com>
321
  * @copyright 2012 Klarna AB (http://klarna.com)
322
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
323
- * @link http://integration.klarna.com/
324
  */
325
  class Klarna_CountryCurrencyMismatchException extends KlarnaException
326
  {
@@ -349,7 +349,7 @@ class Klarna_CountryCurrencyMismatchException extends KlarnaException
349
  * @author MS Dev <ms.modules@klarna.com>
350
  * @copyright 2012 Klarna AB (http://klarna.com)
351
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
352
- * @link http://integration.klarna.com/
353
  */
354
  class Klarna_CountryLanguageMismatchException extends KlarnaException
355
  {
@@ -378,7 +378,7 @@ class Klarna_CountryLanguageMismatchException extends KlarnaException
378
  * @author MS Dev <ms.modules@klarna.com>
379
  * @copyright 2012 Klarna AB (http://klarna.com)
380
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
381
- * @link http://integration.klarna.com/
382
  */
383
  class Klarna_ShippingCountryException extends KlarnaException
384
  {
@@ -401,7 +401,7 @@ class Klarna_ShippingCountryException extends KlarnaException
401
  * @author MS Dev <ms.modules@klarna.com>
402
  * @copyright 2012 Klarna AB (http://klarna.com)
403
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
404
- * @link http://integration.klarna.com/
405
  */
406
  class Klarna_MissingGoodslistException extends KlarnaException
407
  {
@@ -422,7 +422,7 @@ class Klarna_MissingGoodslistException extends KlarnaException
422
  * @author MS Dev <ms.modules@klarna.com>
423
  * @copyright 2012 Klarna AB (http://klarna.com)
424
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
425
- * @link http://integration.klarna.com/
426
  */
427
  class Klarna_InvalidPriceException extends KlarnaException
428
  {
@@ -449,7 +449,7 @@ class Klarna_InvalidPriceException extends KlarnaException
449
  * @author MS Dev <ms.modules@klarna.com>
450
  * @copyright 2012 Klarna AB (http://klarna.com)
451
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
452
- * @link http://integration.klarna.com/
453
  */
454
  class Klarna_PCStorageInvalidException extends KlarnaException
455
  {
@@ -476,7 +476,7 @@ class Klarna_PCStorageInvalidException extends KlarnaException
476
  * @author MS Dev <ms.modules@klarna.com>
477
  * @copyright 2012 Klarna AB (http://klarna.com)
478
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
479
- * @link http://integration.klarna.com/
480
  */
481
  class Klarna_InvalidTypeException extends KlarnaException
482
  {
@@ -503,7 +503,7 @@ class Klarna_InvalidTypeException extends KlarnaException
503
  * @author MS Dev <ms.modules@klarna.com>
504
  * @copyright 2012 Klarna AB (http://klarna.com)
505
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
506
- * @link http://integration.klarna.com/
507
  */
508
  class Klarna_InvalidPNOException extends KlarnaException
509
  {
@@ -525,7 +525,7 @@ class Klarna_InvalidPNOException extends KlarnaException
525
  * @author MS Dev <ms.modules@klarna.com>
526
  * @copyright 2012 Klarna AB (http://klarna.com)
527
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
528
- * @link http://integration.klarna.com/
529
  */
530
  class Klarna_InvalidEmailException extends KlarnaException
531
  {
@@ -546,7 +546,7 @@ class Klarna_InvalidEmailException extends KlarnaException
546
  * @author MS Dev <ms.modules@klarna.com>
547
  * @copyright 2012 Klarna AB (http://klarna.com)
548
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
549
- * @link http://integration.klarna.com/
550
  */
551
  class Klarna_UnsupportedMarketException extends KlarnaException
552
  {
@@ -574,7 +574,7 @@ class Klarna_UnsupportedMarketException extends KlarnaException
574
  * @author MS Dev <ms.modules@klarna.com>
575
  * @copyright 2012 Klarna AB (http://klarna.com)
576
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
577
- * @link http://integration.klarna.com/
578
  */
579
  class Klarna_InvalidLocaleException extends KlarnaException
580
  {
@@ -598,7 +598,7 @@ class Klarna_InvalidLocaleException extends KlarnaException
598
  * @author MS Dev <ms.modules@klarna.com>
599
  * @copyright 2012 Klarna AB (http://klarna.com)
600
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
601
- * @link http://integration.klarna.com/
602
  */
603
  class Klarna_AddressFieldMissingException extends KlarnaException
604
  {
@@ -621,7 +621,7 @@ class Klarna_AddressFieldMissingException extends KlarnaException
621
  * @author MS Dev <ms.modules@klarna.com>
622
  * @copyright 2012 Klarna AB (http://klarna.com)
623
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
624
- * @link http://integration.klarna.com/
625
  */
626
  class Klarna_FileNotWritableException extends KlarnaException
627
  {
@@ -644,7 +644,7 @@ class Klarna_FileNotWritableException extends KlarnaException
644
  * @author MS Dev <ms.modules@klarna.com>
645
  * @copyright 2012 Klarna AB (http://klarna.com)
646
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
647
- * @link http://integration.klarna.com/
648
  */
649
  class Klarna_FileNotReadableException extends KlarnaException
650
  {
@@ -667,7 +667,7 @@ class Klarna_FileNotReadableException extends KlarnaException
667
  * @author MS Dev <ms.modules@klarna.com>
668
  * @copyright 2012 Klarna AB (http://klarna.com)
669
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
670
- * @link http://integration.klarna.com/
671
  */
672
  class Klarna_FileNotFoundException extends KlarnaException
673
  {
@@ -690,7 +690,7 @@ class Klarna_FileNotFoundException extends KlarnaException
690
  * @author MS Dev <ms.modules@klarna.com>
691
  * @copyright 2012 Klarna AB (http://klarna.com)
692
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
693
- * @link http://integration.klarna.com/
694
  */
695
 
696
  class Klarna_DatabaseException extends KlarnaException
@@ -705,7 +705,7 @@ class Klarna_DatabaseException extends KlarnaException
705
  * @author MS Dev <ms.modules@klarna.com>
706
  * @copyright 2012 Klarna AB (http://klarna.com)
707
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
708
- * @link http://integration.klarna.com/
709
  */
710
  class Klarna_PClassException extends KlarnaException
711
  {
@@ -719,7 +719,7 @@ class Klarna_PClassException extends KlarnaException
719
  * @author MS Dev <ms.modules@klarna.com>
720
  * @copyright 2012 Klarna AB (http://klarna.com)
721
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
722
- * @link http://integration.klarna.com/
723
  */
724
  class Klarna_XMLParseException extends KlarnaException
725
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  require_once 'Country.php';
23
  * @author MS Dev <ms.modules@klarna.com>
24
  * @copyright 2012 Klarna AB (http://klarna.com)
25
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
26
+ * @link https://developers.klarna.com/
27
  */
28
  class KlarnaException extends Exception
29
  {
46
  * @author MS Dev <ms.modules@klarna.com>
47
  * @copyright 2012 Klarna AB (http://klarna.com)
48
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
49
+ * @link https://developers.klarna.com/
50
  */
51
  class Klarna_InvalidConfigurationException extends KlarnaException
52
  {
69
  * @author MS Dev <ms.modules@klarna.com>
70
  * @copyright 2012 Klarna AB (http://klarna.com)
71
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
72
+ * @link https://developers.klarna.com/
73
  */
74
  class Klarna_IncompleteConfigurationException extends KlarnaException
75
  {
90
  * @author MS Dev <ms.modules@klarna.com>
91
  * @copyright 2012 Klarna AB (http://klarna.com)
92
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
93
+ * @link https://developers.klarna.com/
94
  */
95
  class Klarna_InvalidKlarnaAddrException extends KlarnaException
96
  {
114
  * @author MS Dev <ms.modules@klarna.com>
115
  * @copyright 2012 Klarna AB (http://klarna.com)
116
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
117
+ * @link https://developers.klarna.com/
118
  */
119
  class Klarna_MissingAddressException extends KlarnaException
120
  {
135
  * @author MS Dev <ms.modules@klarna.com>
136
  * @copyright 2012 Klarna AB (http://klarna.com)
137
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
138
+ * @link https://developers.klarna.com/
139
  */
140
  class Klarna_ConfigFieldMissingException extends KlarnaException
141
  {
159
  * @author MS Dev <ms.modules@klarna.com>
160
  * @copyright 2012 Klarna AB (http://klarna.com)
161
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
162
+ * @link https://developers.klarna.com/
163
  */
164
  class Klarna_UnknownEncodingException extends KlarnaException
165
  {
184
  * @author MS Dev <ms.modules@klarna.com>
185
  * @copyright 2012 Klarna AB (http://klarna.com)
186
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
187
+ * @link https://developers.klarna.com/
188
  */
189
  class Klarna_UnknownAddressTypeException extends KlarnaException
190
  {
207
  * @author MS Dev <ms.modules@klarna.com>
208
  * @copyright 2012 Klarna AB (http://klarna.com)
209
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
210
+ * @link https://developers.klarna.com/
211
  */
212
  class Klarna_MissingCountryException extends KlarnaException
213
  {
228
  * @author MS Dev <ms.modules@klarna.com>
229
  * @copyright 2012 Klarna AB (http://klarna.com)
230
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
231
+ * @link https://developers.klarna.com/
232
  */
233
  class Klarna_UnknownCountryException extends KlarnaException
234
  {
251
  * @author MS Dev <ms.modules@klarna.com>
252
  * @copyright 2012 Klarna AB (http://klarna.com)
253
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
254
+ * @link https://developers.klarna.com/
255
  */
256
  class Klarna_UnknownLanguageException extends KlarnaException
257
  {
274
  * @author MS Dev <ms.modules@klarna.com>
275
  * @copyright 2012 Klarna AB (http://klarna.com)
276
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
277
+ * @link https://developers.klarna.com/
278
  */
279
  class Klarna_UnknownCurrencyException extends KlarnaException
280
  {
297
  * @author MS Dev <ms.modules@klarna.com>
298
  * @copyright 2012 Klarna AB (http://klarna.com)
299
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
300
+ * @link https://developers.klarna.com/
301
  */
302
  class Klarna_ArgumentNotSetException extends KlarnaException
303
  {
320
  * @author MS Dev <ms.modules@klarna.com>
321
  * @copyright 2012 Klarna AB (http://klarna.com)
322
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
323
+ * @link https://developers.klarna.com/
324
  */
325
  class Klarna_CountryCurrencyMismatchException extends KlarnaException
326
  {
349
  * @author MS Dev <ms.modules@klarna.com>
350
  * @copyright 2012 Klarna AB (http://klarna.com)
351
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
352
+ * @link https://developers.klarna.com/
353
  */
354
  class Klarna_CountryLanguageMismatchException extends KlarnaException
355
  {
378
  * @author MS Dev <ms.modules@klarna.com>
379
  * @copyright 2012 Klarna AB (http://klarna.com)
380
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
381
+ * @link https://developers.klarna.com/
382
  */
383
  class Klarna_ShippingCountryException extends KlarnaException
384
  {
401
  * @author MS Dev <ms.modules@klarna.com>
402
  * @copyright 2012 Klarna AB (http://klarna.com)
403
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
404
+ * @link https://developers.klarna.com/
405
  */
406
  class Klarna_MissingGoodslistException extends KlarnaException
407
  {
422
  * @author MS Dev <ms.modules@klarna.com>
423
  * @copyright 2012 Klarna AB (http://klarna.com)
424
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
425
+ * @link https://developers.klarna.com/
426
  */
427
  class Klarna_InvalidPriceException extends KlarnaException
428
  {
449
  * @author MS Dev <ms.modules@klarna.com>
450
  * @copyright 2012 Klarna AB (http://klarna.com)
451
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
452
+ * @link https://developers.klarna.com/
453
  */
454
  class Klarna_PCStorageInvalidException extends KlarnaException
455
  {
476
  * @author MS Dev <ms.modules@klarna.com>
477
  * @copyright 2012 Klarna AB (http://klarna.com)
478
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
479
+ * @link https://developers.klarna.com/
480
  */
481
  class Klarna_InvalidTypeException extends KlarnaException
482
  {
503
  * @author MS Dev <ms.modules@klarna.com>
504
  * @copyright 2012 Klarna AB (http://klarna.com)
505
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
506
+ * @link https://developers.klarna.com/
507
  */
508
  class Klarna_InvalidPNOException extends KlarnaException
509
  {
525
  * @author MS Dev <ms.modules@klarna.com>
526
  * @copyright 2012 Klarna AB (http://klarna.com)
527
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
528
+ * @link https://developers.klarna.com/
529
  */
530
  class Klarna_InvalidEmailException extends KlarnaException
531
  {
546
  * @author MS Dev <ms.modules@klarna.com>
547
  * @copyright 2012 Klarna AB (http://klarna.com)
548
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
549
+ * @link https://developers.klarna.com/
550
  */
551
  class Klarna_UnsupportedMarketException extends KlarnaException
552
  {
574
  * @author MS Dev <ms.modules@klarna.com>
575
  * @copyright 2012 Klarna AB (http://klarna.com)
576
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
577
+ * @link https://developers.klarna.com/
578
  */
579
  class Klarna_InvalidLocaleException extends KlarnaException
580
  {
598
  * @author MS Dev <ms.modules@klarna.com>
599
  * @copyright 2012 Klarna AB (http://klarna.com)
600
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
601
+ * @link https://developers.klarna.com/
602
  */
603
  class Klarna_AddressFieldMissingException extends KlarnaException
604
  {
621
  * @author MS Dev <ms.modules@klarna.com>
622
  * @copyright 2012 Klarna AB (http://klarna.com)
623
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
624
+ * @link https://developers.klarna.com/
625
  */
626
  class Klarna_FileNotWritableException extends KlarnaException
627
  {
644
  * @author MS Dev <ms.modules@klarna.com>
645
  * @copyright 2012 Klarna AB (http://klarna.com)
646
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
647
+ * @link https://developers.klarna.com/
648
  */
649
  class Klarna_FileNotReadableException extends KlarnaException
650
  {
667
  * @author MS Dev <ms.modules@klarna.com>
668
  * @copyright 2012 Klarna AB (http://klarna.com)
669
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
670
+ * @link https://developers.klarna.com/
671
  */
672
  class Klarna_FileNotFoundException extends KlarnaException
673
  {
690
  * @author MS Dev <ms.modules@klarna.com>
691
  * @copyright 2012 Klarna AB (http://klarna.com)
692
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
693
+ * @link https://developers.klarna.com/
694
  */
695
 
696
  class Klarna_DatabaseException extends KlarnaException
705
  * @author MS Dev <ms.modules@klarna.com>
706
  * @copyright 2012 Klarna AB (http://klarna.com)
707
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
708
+ * @link https://developers.klarna.com/
709
  */
710
  class Klarna_PClassException extends KlarnaException
711
  {
719
  * @author MS Dev <ms.modules@klarna.com>
720
  * @copyright 2012 Klarna AB (http://klarna.com)
721
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
722
+ * @link https://developers.klarna.com/
723
  */
724
  class Klarna_XMLParseException extends KlarnaException
725
  {
lib/Klarna/Flags.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -20,7 +20,7 @@
20
  * @author MS Dev <ms.modules@klarna.com>
21
  * @copyright 2012 Klarna AB (http://klarna.com)
22
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
- * @link http://integration.klarna.com/
24
  */
25
  class KlarnaFlags
26
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
20
  * @author MS Dev <ms.modules@klarna.com>
21
  * @copyright 2012 Klarna AB (http://klarna.com)
22
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
+ * @link https://developers.klarna.com/
24
  */
25
  class KlarnaFlags
26
  {
lib/Klarna/Klarna.php CHANGED
@@ -9,9 +9,13 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
 
 
 
 
15
  /**
16
  * This API provides a way to integrate with Klarna's services over the
17
  * XMLRPC protocol.
@@ -20,7 +24,6 @@
20
  * In addition you need to decode HTML entities, if they exist.<br>
21
  *
22
  * For more information see our
23
- * {@link http://integration.klarna.com/en/api/step-by-step step by step} guide.
24
  *
25
  * Dependencies:
26
  *
@@ -35,7 +38,7 @@
35
  * @author MS Dev <ms.modules@klarna.com>
36
  * @copyright 2012 Klarna AB (http://klarna.com)
37
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
38
- * @link http://integration.klarna.com/
39
  */
40
  class Klarna
41
  {
@@ -44,7 +47,7 @@ class Klarna
44
  *
45
  * @var string
46
  */
47
- protected $VERSION = 'php:api:2.4.3';
48
 
49
  /**
50
  * Klarna protocol identifier.
@@ -53,21 +56,6 @@ class Klarna
53
  */
54
  protected $PROTO = '4.1';
55
 
56
- /**
57
- * Flag to indicate use of the report server Candice.
58
- *
59
- * @var bool
60
- */
61
- private static $_candice = true;
62
-
63
- /**
64
- * URL/Address to the Candice server.
65
- * Port used is 80.
66
- *
67
- * @var string
68
- */
69
- private static $_c_addr = "clientstat.klarna.com";
70
-
71
  /**
72
  * Constants used with LIVE mode for the communications with Klarna.
73
  *
@@ -390,6 +378,13 @@ class Klarna
390
  */
391
  protected $config;
392
 
 
 
 
 
 
 
 
393
  /**
394
  * Empty constructor, because sometimes it's needed.
395
  */
@@ -441,7 +436,6 @@ class Klarna
441
  $this->VERSION = $str;
442
  }
443
 
444
-
445
  /**
446
  * Initializes the Klarna object accordingly to the set config object.
447
  *
@@ -526,13 +520,6 @@ class Klarna
526
  }
527
  }
528
 
529
- try {
530
- $this->hasFields('candice');
531
- self::$_candice = (bool)$this->config['candice'];
532
- } catch(Exception $e) {
533
- //No 'candice' field ignore it...
534
- }
535
-
536
  try {
537
  $this->hasFields('xmlrpcDebug');
538
  Klarna::$xmlrpcDebug = $this->config['xmlrpcDebug'];
@@ -562,6 +549,8 @@ class Klarna
562
  $this->_url['scheme']
563
  );
564
 
 
 
565
  $this->xmlrpc->request_charset_encoding = 'ISO-8859-1';
566
  }
567
 
@@ -592,7 +581,6 @@ class Klarna
592
  * @param string $pcStorage PClass storage module.
593
  * @param string $pcURI PClass URI.
594
  * @param bool $ssl Whether HTTPS (HTTP over SSL) or HTTP is used.
595
- * @param bool $candice Error reporting to Klarna.
596
  *
597
  * @see Klarna::setConfig()
598
  * @see KlarnaConfig
@@ -603,7 +591,7 @@ class Klarna
603
  public function config(
604
  $eid, $secret, $country, $language, $currency,
605
  $mode = Klarna::LIVE, $pcStorage = 'json', $pcURI = 'pclasses.json',
606
- $ssl = true, $candice = true
607
  ) {
608
  try {
609
  KlarnaConfig::$store = false;
@@ -616,7 +604,6 @@ class Klarna
616
  $this->config['currency'] = $currency;
617
  $this->config['mode'] = $mode;
618
  $this->config['ssl'] = $ssl;
619
- $this->config['candice'] = $candice;
620
  $this->config['pcStorage'] = $pcStorage;
621
  $this->config['pcURI'] = $pcURI;
622
 
@@ -647,6 +634,20 @@ class Klarna
647
  $this->init();
648
  }
649
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
650
  /**
651
  * Get the complete locale (country, language, currency) to use for the
652
  * values passed, or the configured value if passing null.
@@ -1061,13 +1062,6 @@ class Klarna
1061
  * <b>Available named values are</b>:<br>
1062
  * string - cust_no<br>
1063
  * string - estore_user<br>
1064
- * string - maiden_name<br>
1065
- * string - place_of_birth<br>
1066
- * string - password<br>
1067
- * string - new_password<br>
1068
- * string - captcha<br>
1069
- * int - poa_group<br>
1070
- * string - poa_pno<br>
1071
  * string - ready_date<br>
1072
  * string - rand_string<br>
1073
  * int - bclass<br>
@@ -1094,14 +1088,6 @@ class Klarna
1094
  *
1095
  * Using this method is optional.
1096
  *
1097
- * <b>Available named values are</b>:<br>
1098
- * int - yearly_salary<br>
1099
- * int - no_people_in_household<br>
1100
- * int - no_children_below_18<br>
1101
- * int - net_monthly_household_income<br>
1102
- * int - monthly_cost_accommodation<br>
1103
- * int - monthly_cost_other_loans<br>
1104
- *
1105
  * Make sure you send in the values as the right data type.<br>
1106
  * Use strval, intval or similar methods to ensure the right type is sent.
1107
  *
@@ -1123,15 +1109,6 @@ class Klarna
1123
  *
1124
  * Using this method is optional.
1125
  *
1126
- * <b>Available named values are</b>:<br>
1127
- * int - bank_acc_bic<br>
1128
- * int - bank_acc_no<br>
1129
- * int - bank_acc_pin<br>
1130
- * int - bank_acc_tan<br>
1131
- * string - bank_name<br>
1132
- * string - bank_city<br>
1133
- * string - iban<br>
1134
- *
1135
  * Make sure you send in the values as the right data type.<br>
1136
  * Use strval, intval or similar methods to ensure the right type is sent.
1137
  *
@@ -1153,16 +1130,6 @@ class Klarna
1153
  *
1154
  * Using this method is optional.
1155
  *
1156
- * <b>Available named values are</b>:<br>
1157
- * string - travel_company<br>
1158
- * string - reseller_company<br>
1159
- * string - departure_date<br>
1160
- * string - return_date<br>
1161
- * array - destinations<br>
1162
- * array - passenger_list<br>
1163
- * array - passport_no<br>
1164
- * array - driver_license_no<br>
1165
- *
1166
  * Make sure you send in the values as the right data type.<br>
1167
  * Use strval, intval or similar methods to ensure the right type is sent.
1168
  *
@@ -1179,6 +1146,18 @@ class Klarna
1179
  $this->travelInfo[$name] = $value;
1180
  }
1181
 
 
 
 
 
 
 
 
 
 
 
 
 
1182
  /**
1183
  * Returns the clients IP address.
1184
  *
@@ -1186,6 +1165,10 @@ class Klarna
1186
  */
1187
  public function getClientIP()
1188
  {
 
 
 
 
1189
  $tmp_ip = '';
1190
  $x_fwd = null;
1191
 
@@ -1406,8 +1389,6 @@ class Klarna
1406
  * @param int $encoding {@link KlarnaEncoding PNO Encoding} constant.
1407
  * @param int $type Specifies returned information.
1408
  *
1409
- * @link http://integration.klarna.com/en/api/standard-integration/functions
1410
- * /getaddresses
1411
  * @throws KlarnaException
1412
  * @return array An array of {@link KlarnaAddr} objects.
1413
  */
@@ -1629,9 +1610,6 @@ class Klarna
1629
  * @param bool $clear Whether customer info should be cleared after
1630
  * this call or not.
1631
  *
1632
- * @link http://integration.klarna.com/en/api/standard-integration/functions/
1633
- * addtransaction
1634
- *
1635
  * @throws KlarnaException
1636
  * @return array An array with invoice number and order status. [string, int]
1637
  */
@@ -1773,8 +1751,6 @@ class Klarna
1773
  * call.
1774
  *
1775
  * @see Klarna::setShipmentInfo()
1776
- * @link http://integration.klarna.com/en/api/standard-integration/functions
1777
- * /activateinvoice
1778
  *
1779
  * @throws KlarnaException
1780
  * @return string An URL to the PDF invoice.
@@ -1917,9 +1893,6 @@ class Klarna
1917
  * @param bool $clear Whether customer info should be cleared after
1918
  * this call.
1919
  *
1920
- * @link http://integration.klarna.com/en/api/advanced-integration
1921
- * /functions/reserveamount
1922
- *
1923
  * @throws KlarnaException
1924
  * @return array An array with reservation number and order
1925
  * status. [string, int]
@@ -2041,8 +2014,6 @@ class Klarna
2041
  *
2042
  * @param string $rno Reservation number.
2043
  *
2044
- * @link http://integration.klarna.com/en/api/advanced-integration/functions
2045
- * /cancelreservation
2046
  *
2047
  * @throws KlarnaException
2048
  * @return bool True, if the cancellation was successful.
@@ -2078,8 +2049,6 @@ class Klarna
2078
  * @param int $amount Amount including VAT.
2079
  * @param int $flags Options which affect the behaviour.
2080
  *
2081
- * @link http://integration.klarna.com/en/api/advanced-integration/functions
2082
- * /changereservation
2083
  *
2084
  * @throws KlarnaException
2085
  * @return bool True, if the change was successful.
@@ -2355,8 +2324,7 @@ class Klarna
2355
  * Gender is only required for Germany and Netherlands.<br>
2356
  *
2357
  * Use of the OCR parameter is optional.
2358
- * An OCR number can be retrieved by using:
2359
- * {@link Klarna::reserveOCR()} or {@link Klarna::reserveOCRemail()}.
2360
  *
2361
  * <b>Flags can be set to</b>:<br>
2362
  * {@link KlarnaFlags::NO_FLAG}<br>
@@ -2386,8 +2354,6 @@ class Klarna
2386
  * @param bool $clear Whether customer info should be cleared after
2387
  * this call.
2388
  *
2389
- * @link http://integration.klarna.com/en/api/advanced-integration/functions
2390
- * /activatereservation
2391
  * @see Klarna::reserveAmount()
2392
  *
2393
  * @throws KlarnaException
@@ -2499,8 +2465,6 @@ class Klarna
2499
  * @param int $amount The amount to be subtracted from the reservation.
2500
  * @param int $flags Options which affect the behaviour.
2501
  *
2502
- * @link http://integration.klarna.com/en/api/advanced-integration/functions
2503
- * /splitreservation
2504
  *
2505
  * @throws KlarnaException
2506
  * @return string A new reservation number.
@@ -2545,8 +2509,6 @@ class Klarna
2545
  * @param int $no The number of OCR numbers to reserve.
2546
  * @param int $country {@link KlarnaCountry} constant.
2547
  *
2548
- * @link http://integration.klarna.com/en/api/advanced-integration/functions
2549
- * /reserveocrnums
2550
  *
2551
  * @throws KlarnaException
2552
  * @return array An array of OCR numbers.
@@ -2578,55 +2540,12 @@ class Klarna
2578
  return $this->xmlrpc_call('reserve_ocr_nums', $paramList);
2579
  }
2580
 
2581
- /**
2582
- * Reserves the number of OCRs specified and sends them to the given email.
2583
- *
2584
- * @param int $no Number of OCR numbers to reserve.
2585
- * @param string $email address.
2586
- * @param int $country {@link KlarnaCountry} constant.
2587
- *
2588
- * @return bool True, if the OCRs were reserved and sent.
2589
- */
2590
- public function reserveOCRemail($no, $email, $country = null)
2591
- {
2592
- $this->_checkNo($no);
2593
- $this->_checkPNO($email, KlarnaEncoding::EMAIL);
2594
-
2595
- if ($country === null) {
2596
- if (!$this->_country) {
2597
- throw new Klarna_MissingCountryException;
2598
- }
2599
- $country = $this->_country;
2600
- } else {
2601
- $this->_checkCountry($country);
2602
- }
2603
-
2604
- $digestSecret = self::digest(
2605
- $this->colon($this->_eid, $no, $this->_secret)
2606
- );
2607
- $paramList = array(
2608
- $no,
2609
- $email,
2610
- $this->_eid,
2611
- $digestSecret,
2612
- $country
2613
- );
2614
-
2615
- self::printDebug('reserve_ocr_nums_email array', $paramList);
2616
-
2617
- $result = $this->xmlrpc_call('reserve_ocr_nums_email', $paramList);
2618
-
2619
- return ($result == 'ok');
2620
- }
2621
-
2622
  /**
2623
  * Checks if the specified SSN/PNO has an part payment account with Klarna.
2624
  *
2625
  * @param string $pno Social security number, Personal number, ...
2626
  * @param int $encoding {@link KlarnaEncoding PNO Encoding} constant.
2627
  *
2628
- * @link http://integration.klarna.com/en/api/standard-integration/functions
2629
- * /hasaccount
2630
  *
2631
  * @throws KlarnaException
2632
  * @return bool True, if customer has an account.
@@ -2666,9 +2585,6 @@ class Klarna
2666
  * @param int $qty Quantity of specified article.
2667
  * @param string $artNo Article number.
2668
  *
2669
- * @link http://integration.klarna.com/en/api/invoice-handling-functions/
2670
- * functions/mkartno
2671
- *
2672
  * @throws KlarnaException
2673
  * @return void
2674
  */
@@ -2708,8 +2624,6 @@ class Klarna
2708
  *
2709
  * @see Klarna::addArtNo()
2710
  * @see Klarna::activateInvoice()
2711
- * @link http://integration.klarna.com/en/api/standard-integration/functions
2712
- * /activatepart
2713
  *
2714
  * @throws KlarnaException
2715
  * @return array An array with invoice URL and invoice number.
@@ -2758,8 +2672,6 @@ class Klarna
2758
  *
2759
  * @param string $invNo Invoice number.
2760
  *
2761
- * @link http://integration.klarna.com/en/api/other-functions/functions
2762
- * /invoiceamount
2763
  *
2764
  * @throws KlarnaException
2765
  * @return float The total amount.
@@ -2793,8 +2705,6 @@ class Klarna
2793
  * @param string $invNo Invoice number.
2794
  * @param string $orderid Estores order number.
2795
  *
2796
- * @link http://integration.klarna.com/en/api/other-functions/functions
2797
- * /updateorderno
2798
  *
2799
  * @throws KlarnaException
2800
  * @return string Invoice number.
@@ -2833,9 +2743,6 @@ class Klarna
2833
  *
2834
  * @param string $invNo Invoice number.
2835
  *
2836
- * @link http://integration.klarna.com/en/api/invoice-handling-functions
2837
- * /functions/emailinvoice
2838
- *
2839
  * @throws KlarnaException
2840
  * @return string Invoice number.
2841
  */
@@ -2863,9 +2770,6 @@ class Klarna
2863
  *
2864
  * @param string $invNo Invoice number.
2865
  *
2866
- * @link http://integration.klarna.com/en/api/invoice-handling-functions
2867
- * /functions/sendinvoice
2868
- *
2869
  * @throws KlarnaException
2870
  * @return string Invoice number.
2871
  */
@@ -2906,9 +2810,6 @@ class Klarna
2906
  * @param string $description Optional custom text to present as discount
2907
  * in the invoice.
2908
  *
2909
- * @link http://integration.klarna.com/en/api/invoice-handling-functions
2910
- * /functions/returnamount
2911
- *
2912
  * @throws KlarnaException
2913
  * @return string Invoice number.
2914
  */
@@ -2949,9 +2850,6 @@ class Klarna
2949
  * @param string $invNo Invoice number.
2950
  * @param string $credNo Credit number.
2951
  *
2952
- * @link http://integration.klarna.com/en/api/invoice-handling-functions
2953
- * /functions/creditinvoice
2954
- *
2955
  * @throws KlarnaException
2956
  * @return string Invoice number.
2957
  */
@@ -2985,8 +2883,6 @@ class Klarna
2985
  * @param string $credNo Credit number.
2986
  *
2987
  * @see Klarna::addArtNo()
2988
- * @link http://integration.klarna.com/en/api/invoice-handling-functions
2989
- * /functions/creditpart
2990
  *
2991
  * @throws KlarnaException
2992
  * @return string Invoice number.
@@ -3039,8 +2935,6 @@ class Klarna
3039
  * @param string $artNo Article number.
3040
  * @param int $qty Quantity of specified article.
3041
  *
3042
- * @link http://integration.klarna.com/en/api/other-functions/functions
3043
- * /updategoodsqty
3044
  *
3045
  * @throws KlarnaException
3046
  * @return string Invoice number.
@@ -3079,8 +2973,6 @@ class Klarna
3079
  * @param int $type Charge type.
3080
  * @param int $newAmount The new amount for the charge.
3081
  *
3082
- * @link http://integration.klarna.com/en/api/other-functions/functions
3083
- * /updatechargeamount
3084
  *
3085
  * @throws KlarnaException
3086
  * @return string Invoice number.
@@ -3120,9 +3012,6 @@ class Klarna
3120
  *
3121
  * @param string $invNo Invoice number.
3122
  *
3123
- * @link http://integration.klarna.com/en/api/other-functions/functions
3124
- * /invoiceaddress
3125
- *
3126
  * @throws KlarnaException
3127
  * @return KlarnaAddr
3128
  */
@@ -3168,8 +3057,6 @@ class Klarna
3168
  *
3169
  * @param string $invNo Invoice number.
3170
  *
3171
- * @link http://integration.klarna.com/en/api/other-functions/functions
3172
- * /invoicepartamount
3173
  * @see Klarna::addArtNo()
3174
  *
3175
  * @throws KlarnaException
@@ -3217,8 +3104,6 @@ class Klarna
3217
  * @param string $id Reservation number or invoice number.
3218
  * @param int $type 0 if $id is an invoice or reservation, 1 for order id
3219
  *
3220
- * @link http://integration.klarna.com/en/api/other-functions/functions
3221
- * /checkorderstatus
3222
  *
3223
  * @throws KlarnaException
3224
  * @return string The order status.
@@ -3351,39 +3236,6 @@ class Klarna
3351
  return ($result == 'ok');
3352
  }
3353
 
3354
- /**
3355
- * Sets notes/log information for the specified invoice number.
3356
- *
3357
- * @param string $invNo Invoice number.
3358
- * @param string $notes Note(s) to be associated with the invoice.
3359
- *
3360
- * @throws KlarnaException
3361
- * @return string Invoice number.
3362
- */
3363
- public function updateNotes($invNo, $notes)
3364
- {
3365
- $this->_checkInvNo($invNo);
3366
-
3367
- if (!is_string($notes)) {
3368
- $notes = strval($notes);
3369
- }
3370
-
3371
- $digestSecret = self::digest(
3372
- $this->colon($invNo, $notes, $this->_secret)
3373
- );
3374
-
3375
- $paramList = array(
3376
- $this->_eid,
3377
- $digestSecret,
3378
- $invNo,
3379
- $notes
3380
- );
3381
-
3382
- self::printDebug('update_notes', $paramList);
3383
-
3384
- return $this->xmlrpc_call('update_notes', $paramList);
3385
- }
3386
-
3387
  /**
3388
  * Returns the configured PCStorage object.
3389
  *
@@ -3709,9 +3561,11 @@ class Klarna
3709
  $dir = dirname(__FILE__);
3710
 
3711
  //Require the CheckoutHTML interface/abstract class
 
3712
  include_once $dir.'/checkoutkpm/checkouthtml.intf.php';
3713
 
3714
  //Iterate over all .class.php files in checkout/
 
3715
  foreach (glob($dir.'/checkoutkpm/*.class.php') as $checkout) {
3716
  if (!self::$debug) {
3717
  ob_start();
@@ -3750,6 +3604,7 @@ class Klarna
3750
  $dir = dirname(__FILE__);
3751
 
3752
  //Require the CheckoutHTML interface/abstract class
 
3753
  include_once $dir.'/checkoutkpm/checkouthtml.intf.php';
3754
 
3755
  //Iterate over all .class.php files in
@@ -3838,11 +3693,6 @@ class Klarna
3838
 
3839
  $status = $xmlrpcresp->faultCode();
3840
 
3841
- //Send report to candice.
3842
- if (self::$_candice === true) {
3843
- $this->sendStat($method, $time, $selectTime, $status);
3844
- }
3845
-
3846
  if ($status !== 0) {
3847
  throw new KlarnaException($xmlrpcresp->faultString(), $status);
3848
  }
@@ -3858,6 +3708,55 @@ class Klarna
3858
  }
3859
  }
3860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3861
  /**
3862
  * Removes all relevant order/customer data from the internal structure.
3863
  *
@@ -3887,40 +3786,6 @@ class Klarna
3887
  $this->coObjects = array();
3888
  }
3889
 
3890
- /**
3891
- * Sends a report to Candice.
3892
- *
3893
- * @param string $method XMLRPC method.
3894
- * @param int $time Elapsed time of entire XMLRPC call.
3895
- * @param int $selectTime Time to create the XMLRPC parameters.
3896
- * @param int $status XMLRPC error code.
3897
- *
3898
- * @return void
3899
- */
3900
- protected function sendStat($method, $time, $selectTime, $status)
3901
- {
3902
- $fp = @fsockopen('udp://'.self::$_c_addr, 80, $errno, $errstr, 1500);
3903
- if ($fp) {
3904
- $uri = "{$this->_url['scheme']}://{$this->_url['host']}" .
3905
- ":{$this->_url['port']}";
3906
-
3907
- $data = $this->pipe(
3908
- $this->_eid,
3909
- $method,
3910
- $time,
3911
- $selectTime,
3912
- $status,
3913
- $uri
3914
- );
3915
- $digest = self::digest($this->pipe($data, $this->_secret));
3916
-
3917
- self::printDebug("candice report", $data);
3918
-
3919
- @fwrite($fp, $this->pipe($data, $digest));
3920
- @fclose($fp);
3921
- }
3922
- }
3923
-
3924
  /**
3925
  * Implodes parameters with delimiter ':'.
3926
  * Null and "" values are ignored by the colon function to
@@ -4011,9 +3876,11 @@ class Klarna
4011
  */
4012
  public static function num_htmlentities($str)
4013
  {
 
 
4014
  if (!self::$htmlentities) {
4015
  self::$htmlentities = array();
4016
- $table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
4017
  foreach ($table as $char => $entity) {
4018
  self::$htmlentities[$entity] = '&#' . ord($char) . ';';
4019
  }
@@ -4022,7 +3889,7 @@ class Klarna
4022
  return str_replace(
4023
  array_keys(
4024
  self::$htmlentities
4025
- ), self::$htmlentities, htmlentities($str)
4026
  );
4027
  }
4028
 
@@ -4622,3 +4489,15 @@ require_once 'Flags.php';
4622
  require_once 'Country.php';
4623
  require_once 'Currency.php';
4624
  require_once 'Language.php';
 
 
 
 
 
 
 
 
 
 
 
 
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
+ if (!defined("ENT_HTML401")) {
16
+ define("ENT_HTML401", 0);
17
+ }
18
+
19
  /**
20
  * This API provides a way to integrate with Klarna's services over the
21
  * XMLRPC protocol.
24
  * In addition you need to decode HTML entities, if they exist.<br>
25
  *
26
  * For more information see our
 
27
  *
28
  * Dependencies:
29
  *
38
  * @author MS Dev <ms.modules@klarna.com>
39
  * @copyright 2012 Klarna AB (http://klarna.com)
40
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
41
+ * @link https://developers.klarna.com/
42
  */
43
  class Klarna
44
  {
47
  *
48
  * @var string
49
  */
50
+ protected $VERSION = 'php:api:3.2.0';
51
 
52
  /**
53
  * Klarna protocol identifier.
56
  */
57
  protected $PROTO = '4.1';
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  /**
60
  * Constants used with LIVE mode for the communications with Klarna.
61
  *
378
  */
379
  protected $config;
380
 
381
+ /**
382
+ * Client IP
383
+ *
384
+ * @var string
385
+ */
386
+ protected $clientIP;
387
+
388
  /**
389
  * Empty constructor, because sometimes it's needed.
390
  */
436
  $this->VERSION = $str;
437
  }
438
 
 
439
  /**
440
  * Initializes the Klarna object accordingly to the set config object.
441
  *
520
  }
521
  }
522
 
 
 
 
 
 
 
 
523
  try {
524
  $this->hasFields('xmlrpcDebug');
525
  Klarna::$xmlrpcDebug = $this->config['xmlrpcDebug'];
549
  $this->_url['scheme']
550
  );
551
 
552
+ $this->xmlrpc->setSSLVerifyHost(2);
553
+
554
  $this->xmlrpc->request_charset_encoding = 'ISO-8859-1';
555
  }
556
 
581
  * @param string $pcStorage PClass storage module.
582
  * @param string $pcURI PClass URI.
583
  * @param bool $ssl Whether HTTPS (HTTP over SSL) or HTTP is used.
 
584
  *
585
  * @see Klarna::setConfig()
586
  * @see KlarnaConfig
591
  public function config(
592
  $eid, $secret, $country, $language, $currency,
593
  $mode = Klarna::LIVE, $pcStorage = 'json', $pcURI = 'pclasses.json',
594
+ $ssl = true
595
  ) {
596
  try {
597
  KlarnaConfig::$store = false;
604
  $this->config['currency'] = $currency;
605
  $this->config['mode'] = $mode;
606
  $this->config['ssl'] = $ssl;
 
607
  $this->config['pcStorage'] = $pcStorage;
608
  $this->config['pcURI'] = $pcURI;
609
 
634
  $this->init();
635
  }
636
 
637
+ /**
638
+ * Vaimo change to set one extra variable in config
639
+ *
640
+ * @param string $name The name in config structure
641
+ * @param string $value The value
642
+ * @return void
643
+ */
644
+ public function setConfigVariable($name, $value)
645
+ {
646
+ if ($this->config) {
647
+ $this->config[$name] = $value;
648
+ }
649
+ }
650
+
651
  /**
652
  * Get the complete locale (country, language, currency) to use for the
653
  * values passed, or the configured value if passing null.
1062
  * <b>Available named values are</b>:<br>
1063
  * string - cust_no<br>
1064
  * string - estore_user<br>
 
 
 
 
 
 
 
1065
  * string - ready_date<br>
1066
  * string - rand_string<br>
1067
  * int - bclass<br>
1088
  *
1089
  * Using this method is optional.
1090
  *
 
 
 
 
 
 
 
 
1091
  * Make sure you send in the values as the right data type.<br>
1092
  * Use strval, intval or similar methods to ensure the right type is sent.
1093
  *
1109
  *
1110
  * Using this method is optional.
1111
  *
 
 
 
 
 
 
 
 
 
1112
  * Make sure you send in the values as the right data type.<br>
1113
  * Use strval, intval or similar methods to ensure the right type is sent.
1114
  *
1130
  *
1131
  * Using this method is optional.
1132
  *
 
 
 
 
 
 
 
 
 
 
1133
  * Make sure you send in the values as the right data type.<br>
1134
  * Use strval, intval or similar methods to ensure the right type is sent.
1135
  *
1146
  $this->travelInfo[$name] = $value;
1147
  }
1148
 
1149
+ /**
1150
+ * Set client IP
1151
+ *
1152
+ * @param string $clientIP Client IP address
1153
+ *
1154
+ * @return void
1155
+ */
1156
+ public function setClientIP($clientIP)
1157
+ {
1158
+ $this->clientIP = $clientIP;
1159
+ }
1160
+
1161
  /**
1162
  * Returns the clients IP address.
1163
  *
1165
  */
1166
  public function getClientIP()
1167
  {
1168
+ if (isset($this->clientIP)) {
1169
+ return $this->clientIP;
1170
+ }
1171
+
1172
  $tmp_ip = '';
1173
  $x_fwd = null;
1174
 
1389
  * @param int $encoding {@link KlarnaEncoding PNO Encoding} constant.
1390
  * @param int $type Specifies returned information.
1391
  *
 
 
1392
  * @throws KlarnaException
1393
  * @return array An array of {@link KlarnaAddr} objects.
1394
  */
1610
  * @param bool $clear Whether customer info should be cleared after
1611
  * this call or not.
1612
  *
 
 
 
1613
  * @throws KlarnaException
1614
  * @return array An array with invoice number and order status. [string, int]
1615
  */
1751
  * call.
1752
  *
1753
  * @see Klarna::setShipmentInfo()
 
 
1754
  *
1755
  * @throws KlarnaException
1756
  * @return string An URL to the PDF invoice.
1893
  * @param bool $clear Whether customer info should be cleared after
1894
  * this call.
1895
  *
 
 
 
1896
  * @throws KlarnaException
1897
  * @return array An array with reservation number and order
1898
  * status. [string, int]
2014
  *
2015
  * @param string $rno Reservation number.
2016
  *
 
 
2017
  *
2018
  * @throws KlarnaException
2019
  * @return bool True, if the cancellation was successful.
2049
  * @param int $amount Amount including VAT.
2050
  * @param int $flags Options which affect the behaviour.
2051
  *
 
 
2052
  *
2053
  * @throws KlarnaException
2054
  * @return bool True, if the change was successful.
2324
  * Gender is only required for Germany and Netherlands.<br>
2325
  *
2326
  * Use of the OCR parameter is optional.
2327
+ * An OCR number can be retrieved by using: {@link Klarna::reserveOCR()}.
 
2328
  *
2329
  * <b>Flags can be set to</b>:<br>
2330
  * {@link KlarnaFlags::NO_FLAG}<br>
2354
  * @param bool $clear Whether customer info should be cleared after
2355
  * this call.
2356
  *
 
 
2357
  * @see Klarna::reserveAmount()
2358
  *
2359
  * @throws KlarnaException
2465
  * @param int $amount The amount to be subtracted from the reservation.
2466
  * @param int $flags Options which affect the behaviour.
2467
  *
 
 
2468
  *
2469
  * @throws KlarnaException
2470
  * @return string A new reservation number.
2509
  * @param int $no The number of OCR numbers to reserve.
2510
  * @param int $country {@link KlarnaCountry} constant.
2511
  *
 
 
2512
  *
2513
  * @throws KlarnaException
2514
  * @return array An array of OCR numbers.
2540
  return $this->xmlrpc_call('reserve_ocr_nums', $paramList);
2541
  }
2542
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2543
  /**
2544
  * Checks if the specified SSN/PNO has an part payment account with Klarna.
2545
  *
2546
  * @param string $pno Social security number, Personal number, ...
2547
  * @param int $encoding {@link KlarnaEncoding PNO Encoding} constant.
2548
  *
 
 
2549
  *
2550
  * @throws KlarnaException
2551
  * @return bool True, if customer has an account.
2585
  * @param int $qty Quantity of specified article.
2586
  * @param string $artNo Article number.
2587
  *
 
 
 
2588
  * @throws KlarnaException
2589
  * @return void
2590
  */
2624
  *
2625
  * @see Klarna::addArtNo()
2626
  * @see Klarna::activateInvoice()
 
 
2627
  *
2628
  * @throws KlarnaException
2629
  * @return array An array with invoice URL and invoice number.
2672
  *
2673
  * @param string $invNo Invoice number.
2674
  *
 
 
2675
  *
2676
  * @throws KlarnaException
2677
  * @return float The total amount.
2705
  * @param string $invNo Invoice number.
2706
  * @param string $orderid Estores order number.
2707
  *
 
 
2708
  *
2709
  * @throws KlarnaException
2710
  * @return string Invoice number.
2743
  *
2744
  * @param string $invNo Invoice number.
2745
  *
 
 
 
2746
  * @throws KlarnaException
2747
  * @return string Invoice number.
2748
  */
2770
  *
2771
  * @param string $invNo Invoice number.
2772
  *
 
 
 
2773
  * @throws KlarnaException
2774
  * @return string Invoice number.
2775
  */
2810
  * @param string $description Optional custom text to present as discount
2811
  * in the invoice.
2812
  *
 
 
 
2813
  * @throws KlarnaException
2814
  * @return string Invoice number.
2815
  */
2850
  * @param string $invNo Invoice number.
2851
  * @param string $credNo Credit number.
2852
  *
 
 
 
2853
  * @throws KlarnaException
2854
  * @return string Invoice number.
2855
  */
2883
  * @param string $credNo Credit number.
2884
  *
2885
  * @see Klarna::addArtNo()
 
 
2886
  *
2887
  * @throws KlarnaException
2888
  * @return string Invoice number.
2935
  * @param string $artNo Article number.
2936
  * @param int $qty Quantity of specified article.
2937
  *
 
 
2938
  *
2939
  * @throws KlarnaException
2940
  * @return string Invoice number.
2973
  * @param int $type Charge type.
2974
  * @param int $newAmount The new amount for the charge.
2975
  *
 
 
2976
  *
2977
  * @throws KlarnaException
2978
  * @return string Invoice number.
3012
  *
3013
  * @param string $invNo Invoice number.
3014
  *
 
 
 
3015
  * @throws KlarnaException
3016
  * @return KlarnaAddr
3017
  */
3057
  *
3058
  * @param string $invNo Invoice number.
3059
  *
 
 
3060
  * @see Klarna::addArtNo()
3061
  *
3062
  * @throws KlarnaException
3104
  * @param string $id Reservation number or invoice number.
3105
  * @param int $type 0 if $id is an invoice or reservation, 1 for order id
3106
  *
 
 
3107
  *
3108
  * @throws KlarnaException
3109
  * @return string The order status.
3236
  return ($result == 'ok');
3237
  }
3238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3239
  /**
3240
  * Returns the configured PCStorage object.
3241
  *
3561
  $dir = dirname(__FILE__);
3562
 
3563
  //Require the CheckoutHTML interface/abstract class
3564
+ // Vaimo changed foldername
3565
  include_once $dir.'/checkoutkpm/checkouthtml.intf.php';
3566
 
3567
  //Iterate over all .class.php files in checkout/
3568
+ // Vaimo changed foldername
3569
  foreach (glob($dir.'/checkoutkpm/*.class.php') as $checkout) {
3570
  if (!self::$debug) {
3571
  ob_start();
3604
  $dir = dirname(__FILE__);
3605
 
3606
  //Require the CheckoutHTML interface/abstract class
3607
+ // Vaimo changed foldername
3608
  include_once $dir.'/checkoutkpm/checkouthtml.intf.php';
3609
 
3610
  //Iterate over all .class.php files in
3693
 
3694
  $status = $xmlrpcresp->faultCode();
3695
 
 
 
 
 
 
3696
  if ($status !== 0) {
3697
  throw new KlarnaException($xmlrpcresp->faultString(), $status);
3698
  }
3708
  }
3709
  }
3710
 
3711
+ /**
3712
+ * Create a new CurlTransport
3713
+ *
3714
+ * @return CurlTransport New CurlTransport instance
3715
+ */
3716
+ public function createTransport()
3717
+ {
3718
+ return new CurlTransport(
3719
+ new CurlHandle(),
3720
+ isset($this->config['timeout']) ? intval($this->config['timeout']) : 10
3721
+ );
3722
+ }
3723
+
3724
+ /**
3725
+ * Perform a checkout service request.
3726
+ *
3727
+ * @param int|float $price The total price for the checkout including VAT.
3728
+ * @param string $currency ISO 4217 Currency Code
3729
+ * @param string $locale Specify what locale is used by the checkout.
3730
+ * ISO 639 language and ISO 3166-1 country separated
3731
+ * by underscore. Example: sv_SE
3732
+ * @param string $country (Optional) Specify what ISO 3166-1 country to use
3733
+ * for fetching payment methods. If not specified
3734
+ * the locale country will be used.
3735
+ *
3736
+ * @throws RuntimeException If the curl extension is not loaded
3737
+ *
3738
+ * @return CheckoutServiceResponse Response with payment methods
3739
+ */
3740
+ public function checkoutService($price, $currency, $locale, $country = null)
3741
+ {
3742
+ $this->_checkAmount($price);
3743
+
3744
+ $params = array(
3745
+ 'merchant_id' => $this->config['eid'],
3746
+ 'total_price' => $price,
3747
+ 'currency' => strtoupper($currency),
3748
+ 'locale' => strtolower($locale)
3749
+ );
3750
+
3751
+ if ($country !== null) {
3752
+ $params['country'] = $country;
3753
+ }
3754
+
3755
+ return $this->createTransport()->send(
3756
+ new CheckoutServiceRequest($this->config, $params)
3757
+ );
3758
+ }
3759
+
3760
  /**
3761
  * Removes all relevant order/customer data from the internal structure.
3762
  *
3786
  $this->coObjects = array();
3787
  }
3788
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3789
  /**
3790
  * Implodes parameters with delimiter ':'.
3791
  * Null and "" values are ignored by the colon function to
3876
  */
3877
  public static function num_htmlentities($str)
3878
  {
3879
+ $charset = 'ISO-8859-1';
3880
+
3881
  if (!self::$htmlentities) {
3882
  self::$htmlentities = array();
3883
+ $table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, $charset);
3884
  foreach ($table as $char => $entity) {
3885
  self::$htmlentities[$entity] = '&#' . ord($char) . ';';
3886
  }
3889
  return str_replace(
3890
  array_keys(
3891
  self::$htmlentities
3892
+ ), self::$htmlentities, htmlentities($str, ENT_COMPAT | ENT_HTML401, $charset)
3893
  );
3894
  }
3895
 
4489
  require_once 'Country.php';
4490
  require_once 'Currency.php';
4491
  require_once 'Language.php';
4492
+
4493
+ /**
4494
+ * Include cURL wrappers
4495
+ */
4496
+ require_once 'CurlTransport.php';
4497
+ require_once 'CurlHandle.php';
4498
+
4499
+ /**
4500
+ * Include cURL requests and responses
4501
+ */
4502
+ require_once 'CheckoutServiceRequest.php';
4503
+ require_once 'CheckoutServiceResponse.php';
lib/Klarna/Language.php CHANGED
@@ -10,7 +10,7 @@
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
- * @link http://integration.klarna.com/
14
  */
15
 
16
  /**
@@ -21,7 +21,7 @@
21
  * @author MS Dev <ms.modules@klarna.com>
22
  * @copyright 2012 Klarna AB (http://klarna.com)
23
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
24
- * @link http://integration.klarna.com/
25
  */
26
  class KlarnaLanguage
27
  {
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
+ * @link https://developers.klarna.com/
14
  */
15
 
16
  /**
21
  * @author MS Dev <ms.modules@klarna.com>
22
  * @copyright 2012 Klarna AB (http://klarna.com)
23
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
24
+ * @link https://developers.klarna.com/
25
  */
26
  class KlarnaLanguage
27
  {
lib/Klarna/checkoutkpm/checkouthtml.intf.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -22,7 +22,7 @@
22
  * @author MS Dev <ms.modules@klarna.com>
23
  * @copyright 2012 Klarna AB (http://klarna.com)
24
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
25
- * @link http://integration.klarna.com/
26
  */
27
  abstract class CheckoutHTML
28
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
22
  * @author MS Dev <ms.modules@klarna.com>
23
  * @copyright 2012 Klarna AB (http://klarna.com)
24
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
25
+ * @link https://developers.klarna.com/
26
  */
27
  abstract class CheckoutHTML
28
  {
lib/Klarna/checkoutkpm/threatmetrix.class.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -20,7 +20,7 @@
20
  * @author MS Dev <ms.modules@klarna.com>
21
  * @copyright 2012 Klarna AB (http://klarna.com)
22
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
- * @link http://integration.klarna.com/
24
  */
25
  class ThreatMetrix extends CheckoutHTML
26
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
20
  * @author MS Dev <ms.modules@klarna.com>
21
  * @copyright 2012 Klarna AB (http://klarna.com)
22
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
+ * @link https://developers.klarna.com/
24
  */
25
  class ThreatMetrix extends CheckoutHTML
26
  {
lib/Klarna/examples/activate.php CHANGED
@@ -8,59 +8,31 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- /**
31
- * 2. Activate the reservation
32
- */
33
  $rno = '123456';
34
 
35
- // Optional fields should be set using
36
- // [[setActivateInfo]]
37
- $k->setActivateInfo('key', 'value');
38
- // [[setActivateInfo]]
39
-
40
- // [[setActivateInfo:response]]
41
- null;
42
- // [[setActivateInfo:response]]
43
-
44
  try {
45
- // [[activate]]
46
- $result = $k->activate($rno);
47
- // [[activate]]
48
-
49
- // [[activate:response]]
50
- array(
51
- "ok",
52
- "1234567890"
53
- );
54
- // [[activate:response]]
55
-
56
 
57
- $risk = $result[0]; // ok or no_risk
58
- $invno = $result[1];
59
 
 
 
60
 
61
- echo "risk: {$risk}\ninvno: {$invno}\n";
62
- // Reservation is activated, proceed accordingly.
63
  } catch(Exception $e) {
64
- // Something went wrong, print the message:
65
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
66
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
24
  $rno = '123456';
25
 
 
 
 
 
 
 
 
 
 
26
  try {
27
+ $result = $k->activate($rno, null, KlarnaFlags::RSRV_SEND_BY_EMAIL);
 
 
 
 
 
 
 
 
 
 
28
 
29
+ // For optional arguments, flags, partial activations and so on, refer to the documentation.
30
+ // See Klarna::setActivateInfo
31
 
32
+ $risk = $result[0]; // "ok" or "no_risk"
33
+ $invNo = $result[1]; // "9876451"
34
 
35
+ echo "OK: invoice number {$invNo} - risk status {$risk}\n";
 
36
  } catch(Exception $e) {
 
37
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
38
  }
lib/Klarna/examples/activateInvoice.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
-
34
- /**
35
- * 2. Activate the invoice
36
- */
37
-
38
- // Here you enter the invoice number you got from addTransaction():
39
- $invNo = '123456';
40
-
41
- try {
42
- // You can specify a new pclass ID if the customer wanted to change it
43
- // before you activate.
44
- $url = $k->activateInvoice($invNo, $pclass = KlarnaPClass::INVOICE);
45
-
46
- echo "{$url}\n";
47
-
48
- // The url points to a PDF file for the invoice.
49
- // Invoice activated, proceed accordingly.
50
- } catch(Exception $e) {
51
- // Something went wrong or the invoice doesn't exist.
52
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/activatePart.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Partially activate the invoice
35
- */
36
-
37
- // Here you specify the quantity of an article you wish to partially activate.
38
- // artNo must be the same as the one you used in addArticle() when you made the
39
- // addTransaction() call.
40
- $k->addArtNo(
41
- 1, // Quantity
42
- 'MG200MMS' // Article number
43
- );
44
-
45
- // Here you enter the invoice number you got from addTransaction():
46
- $invNo = '123456';
47
-
48
- try {
49
- $result = $k->activatePart(
50
- $invNo, // Invoice number
51
- KlarnaPClass::INVOICE // Or the PClass ID used to make the order.
52
- );
53
- $url = $result['url'];
54
- echo "url: ${url}\n";
55
- if (isset($result['invno'])) {
56
- $invno = $result['invno'];
57
- echo "invno: ${invno}\n";
58
- }
59
- // The url points to a PDF file for the invoice.
60
- // The invno field is only present if the invoice was not entirely activated,
61
- // and in that case it contains the new invoice number.
62
-
63
- // Invoice activated, proceed accordingly.
64
- } catch(Exception $e) {
65
- // Something went wrong or the invoice doesn't exist.
66
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/activateReservation.php DELETED
@@ -1,240 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
- // [[init]]
15
- $k = new Klarna();
16
- // [[init]]
17
-
18
- // [[init:response]]
19
- new Klarna();
20
- // [[init:response]]
21
-
22
- // [[config]]
23
- $k->config(
24
- 123456, // Merchant ID
25
- 'sharedSecret', // Shared Secret
26
- KlarnaCountry::SE, // Country
27
- KlarnaLanguage::SV, // Language
28
- KlarnaCurrency::SEK, // Currency
29
- Klarna::BETA, // Server
30
- 'json', // PClass Storage
31
- '/srv/pclasses.json', // PClass Storage URI path
32
- true, // SSL
33
- true // Remote logging of response times of xmlrpc calls
34
- );
35
- // [[config]]
36
-
37
- // [[config:response]]
38
- null;
39
- // [[config:response]]
40
-
41
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
42
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
43
-
44
- /**
45
- * 2. Add the article(s), shipping and/or handling fee.
46
- */
47
-
48
- // Here we add a normal product to our goods list.
49
- $k->addArticle(
50
- 4, // Quantity
51
- "MG200MMS", // Article number
52
- "Matrox G200 MMS", // Article name/title
53
- 299.99, // Price
54
- 25, // 25% VAT
55
- 0, // Discount
56
- KlarnaFlags::INC_VAT // Price is including VAT.
57
- );
58
-
59
- // Next we might want to add a shipment fee for the product
60
- // [[addArticle]]
61
- $k->addArticle(
62
- 1,
63
- "",
64
- "Shipping fee",
65
- 14.5,
66
- 25,
67
- 0,
68
- // Price is including VAT and is shipment fee
69
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_SHIPMENT
70
- );
71
- // [[addArticle]]
72
-
73
- // [[addArticle:response]]
74
- null;
75
- // [[addArticle:response]]
76
-
77
- // Lastly, we want to use an invoice/handling fee as well
78
- $k->addArticle(
79
- 1,
80
- "",
81
- "Handling fee",
82
- 11.5,
83
- 25,
84
- 0,
85
- // Price is including VAT and is handling/invoice fee
86
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING
87
- );
88
-
89
-
90
- /**
91
- * 3. Create and set the address(es).
92
- */
93
-
94
- // Create the address object and specify the values.
95
- // [[setAddress]]
96
- $addr = new KlarnaAddr(
97
- 'always_approved@klarna.com', // email
98
- '', // Telno, only one phone number is needed.
99
- '0762560000', // Cellno
100
- 'Testperson-se', // Firstname
101
- 'Approved', // Lastname
102
- '', // No care of, C/O.
103
- 'Stårgatan 1', // Street
104
- '12345', // Zip Code
105
- 'Ankeborg', // City
106
- KlarnaCountry::SE, // Country
107
- null, // HouseNo for German and Dutch customers.
108
- null // House Extension. Dutch customers only.
109
- );
110
-
111
- $k->setAddress(KlarnaFlags::IS_BILLING, $addr);
112
- // [[setAddress]]
113
-
114
- // [[setAddress:response]]
115
- null;
116
- // [[setAddress:response]]
117
-
118
- $k->setAddress(KlarnaFlags::IS_SHIPPING, $addr); // Shipping / delivery address
119
-
120
- /**
121
- * 4. Specify relevant information from your store. (OPTIONAL)
122
- */
123
-
124
- // Set store specific information so you can e.g. search and associate invoices
125
- // with order numbers.
126
- // [[setEstoreInfo]]
127
- $k->setEstoreInfo(
128
- 'order id #1',
129
- 'order id #2'
130
- );
131
- // [[setEstoreInfo]]
132
-
133
- // [[setEstoreInfo:response]]
134
- null;
135
- // [[setEstoreInfo:response]]
136
-
137
- // If you don't have the order id available at this stage, you can later use the
138
- // method updateOrderNo().
139
-
140
- /**
141
- * 5. Set additional information. (OPTIONAL)
142
- */
143
-
144
- /** Comment **/
145
-
146
- // [[setComment]]
147
- $k->setComment('A text string stored in the invoice commentary area.');
148
- // [[setComment]]
149
-
150
- // [[setComment:response]]
151
- null;
152
- // [[setComment:response]]
153
-
154
- /** Extra info **/
155
-
156
- // Normal shipment is defaulted, delays the start of invoice
157
- // expiration/due-date.
158
-
159
- // [[setShipmentInfo]]
160
- $k->setShipmentInfo('key', 'value');
161
- // [[setShipmentInfo]]
162
-
163
- // [[setShipmentInfo:response]]
164
- null;
165
- // [[setShipmentInfo:response]]
166
-
167
- // [[setTravelInfo]]
168
- $k->setTravelInfo('key', 'value');
169
- // [[setTravelInfo]]
170
-
171
- // [[setTravelInfo:response]]
172
- null;
173
- // [[setTravelInfo:response]]
174
-
175
- // [[setBankInfo]]
176
- $k->setBankInfo('key', 'value');
177
- // [[setBankInfo]]
178
-
179
- // [[setBankInfo:response]]
180
- null;
181
- // [[setBankInfo:response]]
182
-
183
- // [[setIncomeInfo]]
184
- $k->setIncomeInfo('key', 'value');
185
- // [[setIncomeInfo]]
186
-
187
- // [[setIncomeInfo:response]]
188
- null;
189
- // [[setIncomeInfo:response]]
190
-
191
- // [[setExtraInfo]]
192
- $k->setExtraInfo('key', 'value');
193
- // [[setExtraInfo]]
194
-
195
- // [[setExtraInfo:response]]
196
- null;
197
- // [[setExtraInfo:response]]
198
-
199
- /**
200
- * 6. Invoke activateReservation and transmit the data.
201
- */
202
-
203
- /* Make sure the order status is ACCEPTED, before activation.
204
- You can do this by using checkOrderStatus(). */
205
-
206
- // Here you enter the reservation number you got from reserveAmount():
207
- $rno = '123456';
208
-
209
- try {
210
- // Transmit all the specified data, from the steps above, to Klarna.
211
- // [[activateReservation]]
212
- $result = $k->activateReservation(
213
- '4103219202', // PNO (Date of birth for DE and NL).
214
- $rno, // Reservation to activate
215
- null, // Gender.
216
- '', // OCR number to use if you have reserved one.
217
- KlarnaFlags::NO_FLAG, // Flags to affect behavior.
218
- // -1, notes that this is an invoice purchase, for part payment purchase
219
- // you will have a pclass object which you use getId() from.
220
- KlarnaPClass::INVOICE
221
- );
222
- // [[activateReservation]]
223
-
224
- // [[activateReservation:response]]
225
- array(
226
- "ok",
227
- "1234567890"
228
- );
229
- // [[activateReservation:response]]
230
-
231
- $risk = $result[0]; // ok or no_risk
232
- $invno = $result[1];
233
-
234
-
235
- echo "risk: {$risk}\ninvno: {$invno}\n";
236
- // Reservation is activated, proceed accordingly.
237
- } catch(Exception $e) {
238
- // Something went wrong, print the message:
239
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
240
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/addTransaction.php DELETED
@@ -1,159 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Add the article(s), shipping and/or handling fee.
35
- */
36
-
37
- // Here we add a normal product to our goods list.
38
- $k->addArticle(
39
- 4, // Quantity
40
- "MG200MMS", // Article number
41
- "Matrox G200 MMS", // Article name/title
42
- 299.99, // Price
43
- 25, // 25% VAT
44
- 0, // Discount
45
- KlarnaFlags::INC_VAT // Price is including VAT.
46
- );
47
-
48
- // Next we might want to add a shipment fee for the product
49
- $k->addArticle(
50
- 1,
51
- "",
52
- "Shipping fee",
53
- 14.5,
54
- 25,
55
- 0,
56
- // Price is including VAT and is shipment fee
57
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_SHIPMENT
58
- );
59
-
60
- // Lastly, we want to use an invoice/handling fee as well
61
- $k->addArticle(
62
- 1,
63
- "",
64
- "Handling fee",
65
- 11.5,
66
- 25,
67
- 0,
68
- // Price is including VAT and is handling/invoice fee
69
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING
70
- );
71
-
72
- /**
73
- * 3. Create and set the address(es).
74
- */
75
-
76
- // Create the address object and specify the values.
77
- $addr = new KlarnaAddr(
78
- 'always_approved@klarna.com', // email
79
- '', // Telno, only one phone number is needed.
80
- '0762560000', // Cellno
81
- 'Testperson-se', // Firstname
82
- 'Approved', // Lastname
83
- '', // No care of, C/O.
84
- 'St�rgatan 1', // Street
85
- '12345', // Zip Code
86
- 'Ankeborg', // City
87
- KlarnaCountry::SE, // Country
88
- null, // HouseNo for German and Dutch customers.
89
- null // House Extension. Dutch customers only.
90
- );
91
-
92
- // Next we tell the Klarna instance to use the address in the next order.
93
- $k->setAddress(KlarnaFlags::IS_BILLING, $addr); // Billing / invoice address
94
- $k->setAddress(KlarnaFlags::IS_SHIPPING, $addr); // Shipping / delivery address
95
-
96
- /**
97
- * 4. Specify relevant information from your store. (OPTIONAL)
98
- */
99
-
100
- // Set store specific information so you can e.g. search and associate invoices
101
- // with order numbers.
102
- $k->setEstoreInfo(
103
- '175012', // Order ID 1
104
- '1999110234', // Order ID 2
105
- '' // Optional username, email or identifier
106
- );
107
-
108
- // If you don't have the order id available at this stage, you can later use the
109
- // method updateOrderNo().
110
-
111
- /**
112
- * 5. Set additional information. (OPTIONAL)
113
- */
114
-
115
- /** Comment **/
116
-
117
- $k->setComment('A text string stored in the invoice commentary area.');
118
-
119
- /** Shipment type **/
120
-
121
- // Normal shipment is defaulted, delays the start of invoice expiration/due-date.
122
- $k->setShipmentInfo('delay_adjust', KlarnaFlags::EXPRESS_SHIPMENT);
123
-
124
-
125
- /**
126
- * 6. Invoke addTransaction and transmit the data.
127
- */
128
-
129
- try {
130
- // Transmit all the specified data, from the steps above, to Klarna.
131
- $result = $k->addTransaction(
132
- '4103219202', // PNO (Date of birth for DE and NL).
133
- null, // Gender.
134
- KlarnaFlags::NO_FLAG, // Flags to affect behavior.
135
- // -1, notes that this is an invoice purchase, for part payment purchase
136
- // you will have a pclass object on which you use getId().
137
- KlarnaPClass::INVOICE
138
- );
139
-
140
- // Check the order status
141
- if ($result[1] == KlarnaFlags::PENDING) {
142
- /* The order is under manual review and will be accepted or denied at a
143
- later stage. Use cronjob with checkOrderStatus() or visit Klarna
144
- Online to check to see if the status has changed. You should still
145
- show it to the customer as it was accepted, to avoid further attempts
146
- to fraud.
147
- */
148
- }
149
-
150
- // Here we get the invoice number
151
- $invno = $result[0];
152
-
153
- // Order is complete, store it in a database.
154
- echo "Status: {$result[1]}\nInvno: {$result[0]}\n";
155
- } catch(Exception $e) {
156
- // The purchase was denied or something went wrong, print the message:
157
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
158
- echo $e->getTraceAsString();
159
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/calc_monthly_cost.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Calculate the monthly cost for the product page.
35
- */
36
-
37
- $pclass = $k->getCheapestPClass(149.99, KlarnaFlags::PRODUCT_PAGE);
38
-
39
- // Did we get a PClass? (it is false if we didn't)
40
- if ($pclass) {
41
- // Here we reuse the same values as above:
42
- // [[calc_monthly_cost]]
43
- $value = KlarnaCalc::calc_monthly_cost(
44
- 149.99,
45
- $pclass,
46
- KlarnaFlags::PRODUCT_PAGE // or KlarnaFlags::CHECKOUT_PAGE
47
- );
48
- // [[calc_monthly_cost]]
49
-
50
- // [[calc_monthly_cost_response]]
51
- 45.50;
52
- // [[calc_monthly_cost_response]]
53
-
54
- echo "Value: {$value}\n";
55
- /*
56
- $value is now a rounded monthly cost amount to be displayed to the
57
- customer.
58
- */
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/cancelReservation.php CHANGED
@@ -8,48 +8,25 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Cancelling a reservation
35
- */
36
-
37
- // Here you enter the reservation number you got from reserveAmount():
38
- $rno = '123456';
39
 
40
  try {
41
- // [[cancelReservation]]
42
- $result = $k->cancelReservation($rno);
43
- // [[cancelReservation]]
44
-
45
-
46
- // [[response]]
47
- true;
48
- // [[response]]
49
 
50
- echo "Result: {$result}\n";
51
- // Reservation cancelled, proceed accordingly.
52
  } catch(Exception $e) {
53
- // Something went wrong or the reservation doesn't exist.
54
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
55
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
24
+ $rno = '2347667190';
 
 
 
 
 
 
 
 
25
 
26
  try {
27
+ $k->cancelReservation($rno);
 
 
 
 
 
 
 
28
 
29
+ echo "OK\n";
 
30
  } catch(Exception $e) {
 
31
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
32
  }
lib/Klarna/examples/changeReservation.php DELETED
@@ -1,60 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Change the reservation.
35
- */
36
-
37
- // Here you enter the reservation number you got from reserveAmount():
38
- $rno = '123456';
39
-
40
- try {
41
- // [[changeReservation]]
42
- $result = $k->changeReservation(
43
- $rno, // Reservation number
44
- 49.99, // Amount
45
- KlarnaFlags::NEW_AMOUNT // Flag deciding if the amount is the new amount
46
- // to reserve, or if it is to be added to the
47
- // existing amount. (KlarnaFlags::ADD_AMOUNT)
48
- );
49
- // [[changeReservation]]
50
-
51
- // [[changeReservation:response]]
52
- true;
53
- // [[changeReservation:response]]
54
-
55
- // Reservation changed, proceed accordingly.
56
- echo "Result: {$result}\n";
57
- } catch (Exception $e) {
58
- // Something went wrong or the reservation doesn't exist.
59
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
60
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/checkOrderStatus.php CHANGED
@@ -8,57 +8,27 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Check the status on your order (invoice or reservation)
35
- */
36
-
37
- $id = '123456'; // Your reservation or invoice number.
38
 
39
  try {
40
- // [[checkOrderStatus]]
41
- $result = $k->checkOrderStatus(
42
- $id, // Reservation, invoice number or order id.
43
- 0 // Flag specifying number type. 0 = rno or invno. 1 = order id.
44
- );
45
- // [[checkOrderStatus]]
46
 
47
- // [[checkOrderStatus:response]]
48
- "1";
49
- // [[checkOrderStatus:response]]
50
 
51
- if ($result == KlarnaFlags::ACCEPTED) {
52
- // Status changed, you can now activate your invoice/reservation.
53
- echo "Accepted\n";
54
- } else if ($result == KlarnaFlags::DENIED) {
55
- echo "Denied\n";
56
- // Status changed, it is now denied, proceed accordingly.
57
- } else {
58
- echo "Pending\n";
59
- //Order is still pending, try again later.
60
- }
61
  } catch (Exception $e) {
62
- //Something went wrong, print the message:
63
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
64
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
24
+ $rno = '2347666470';
 
 
 
 
 
 
 
25
 
26
  try {
27
+ $status = $k->checkOrderStatus($rno);
 
 
 
 
 
28
 
29
+ // $status is KlarnaFlags::ACCEPTED, KlarnaFlags::DENIED or KlarnaFlags::PENDING
 
 
30
 
31
+ echo "OK: order status {$status}\n";
 
 
 
 
 
 
 
 
 
32
  } catch (Exception $e) {
 
33
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
34
  }
lib/Klarna/examples/checkoutService.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $root = dirname(dirname(__FILE__));
4
+
5
+ require_once $root . '/Klarna.php';
6
+
7
+ // Dependencies from http://phpxmlrpc.sourceforge.net/
8
+ require_once $root . '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
9
+ require_once $root . '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
+
11
+ $klarna = new Klarna();
12
+ $config = new KlarnaConfig();
13
+
14
+ // Default required options but not used by the checkout service.
15
+ $config['mode'] = Klarna::BETA;
16
+ $config['pcStorage'] = 'json';
17
+ $config['pcURI'] = './pclasses.json';
18
+
19
+ // Configuration needed for the checkout service
20
+ $config['eid'] = 0;
21
+ $config['secret'] = "secret";
22
+
23
+ // Optional configuration for the checkout service
24
+ // $config['timeout'] = 15; // time-out in seconds
25
+ // $config['checkout_service_uri'] = 'http://localhost/'; // full uri to a custom endpoint
26
+
27
+ $klarna->setConfig($config);
28
+
29
+ try {
30
+ $response = $klarna->checkoutService(
31
+ 1000.50, // Total price of the checkout including VAT
32
+ 'SEK', // Currency used by the checkout
33
+ 'sv_SE' // Locale used by the checkout
34
+ );
35
+ } catch (KlarnaException $e) {
36
+ // cURL exception
37
+ throw $e;
38
+ }
39
+
40
+ $data = $response->getData();
41
+
42
+ if ($response->getStatus() >= 400) {
43
+ // server responded with error
44
+ throw new Exception(print_r($data, true));
45
+ }
46
+
47
+ print_r($data);
lib/Klarna/examples/creditInvoice.php CHANGED
@@ -8,52 +8,25 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Completely refund a invoice.
35
- */
36
-
37
- // Here you enter the invoice number:
38
- $invNo = '123456';
39
 
40
  try {
41
- // [[creditInvoice]]
42
- $result = $k->creditInvoice(
43
- $invNo, // Invoice Number
44
- '' // Credit number. (Optional).
45
- );
46
- // [[creditInvoice]]
47
-
48
- // [[creditInvoice:response]]
49
- "123456";
50
- // [[creditInvoice:response]]
51
-
52
- echo "Result: {$result}\n";
53
 
54
- /* Invoice fully refunded, proceed accordingly.
55
- $result contains the invoice number of the refunded invoice. */
56
  } catch(Exception $e) {
57
- // Something went wrong, print the message:
58
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
59
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
24
+ $invNo = '31402485123226872';
 
 
 
 
 
 
 
 
25
 
26
  try {
27
+ $k->creditInvoice($invNo);
 
 
 
 
 
 
 
 
 
 
 
28
 
29
+ echo "OK\n";
 
30
  } catch(Exception $e) {
 
31
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
32
  }
lib/Klarna/examples/creditPart.php CHANGED
@@ -8,40 +8,23 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Partially refund a invoice.
35
- */
36
-
37
- // Here you enter the invoice number:
38
  $invNo = '123456';
39
 
40
  // Specify for which article(s) you want to refund.
41
- $k->addArtNo(
42
- 1, // Quantity
43
- 'MG200MMS' // Article Number. Must be the same as the one you used
44
- ); // in addArticle() when you made the addTransaction() call.
45
 
46
  // Adding a return fee is possible. If you are interested in this
47
  // functionality, make sure to always be in contact with Klarna before
@@ -58,23 +41,9 @@ $k->addArtNo(
58
  // );
59
 
60
  try {
61
- // [[creditPart]]
62
- $result = $k->creditPart(
63
- $invNo, // Invoice Number
64
- '' // Credit Number. (Optional).
65
- );
66
- // [[creditPart]]
67
-
68
- // [[creditPart:response]]
69
- "123456";
70
- // [[creditPart:response]]
71
-
72
- echo "Result: {$result}\n";
73
 
74
- /* Invoice partially refunded, proceed accordingly.
75
- $result contains the invoice number of the refunded invoice.
76
- */
77
  } catch(Exception $e) {
78
- // Something went wrong, print the message:
79
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
80
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
 
24
  $invNo = '123456';
25
 
26
  // Specify for which article(s) you want to refund.
27
+ $k->addArtNo(1, 'MG200MMS');
 
 
 
28
 
29
  // Adding a return fee is possible. If you are interested in this
30
  // functionality, make sure to always be in contact with Klarna before
41
  // );
42
 
43
  try {
44
+ $k->creditPart($invNo);
 
 
 
 
 
 
 
 
 
 
 
45
 
46
+ echo "OK\n";
 
 
47
  } catch(Exception $e) {
 
48
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
49
  }
lib/Klarna/examples/deleteInvoice.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Remove the invoice
35
- */
36
-
37
- //Here you enter the invoice number you got from addTransaction():
38
- $invNo = '123456';
39
-
40
- try {
41
- $result = $k->deleteInvoice($invNo);
42
-
43
- echo "Result: {$result}\n";
44
-
45
- //Invoice removed, proceed accordingly.
46
- } catch(Exception $e) {
47
- //Something went wrong or the invoice doesn't exist.
48
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/emailInvoice.php CHANGED
@@ -8,49 +8,25 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Send an (activated) invoice to the customer via email.
35
- */
36
-
37
- // Here you enter the invoice number:
38
  $invNo = '123456';
39
 
40
  try {
41
- // [[emailInvoice]]
42
- $result = $k->emailInvoice($invNo);
43
- // [[emailInvoice]]
44
-
45
- // [[emailInvoice:response]]
46
- "123456";
47
- // [[emailInvoice:response]]
48
 
49
- echo "Result: {$result}\n";
50
- /* Invoice sent to customer via email, proceed accordingly.
51
- $result contains the invoice number of the emailed invoice.
52
- */
53
  } catch(Exception $e) {
54
- // Something went wrong, print the message:
55
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
56
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
 
24
  $invNo = '123456';
25
 
26
  try {
27
+ $k->emailInvoice($invNo);
 
 
 
 
 
 
28
 
29
+ echo "OK\n";
 
 
 
30
  } catch(Exception $e) {
 
31
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
32
  }
lib/Klarna/examples/fetchPClasses.php CHANGED
@@ -8,47 +8,27 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Retrieve the PClasses from Klarna.
35
- */
36
-
37
  try {
38
- // [[fetchPClasses]]
39
  $k->fetchPClasses();
40
- // [[fetchPClasses]]
41
 
42
- // [[fetchPClassesResult]]
43
- null;
44
- // [[fetchPClassesResult]]
45
 
46
- /* PClasses successfully fetched, now you can use getPClasses() to load them
47
- locally or getPClass to load a specific PClass locally.
48
- */
49
- echo "Fetched " . count($k->getAllPClasses()) . " pclasses.\n";
50
 
 
51
  } catch(Exception $e) {
52
- // Something went wrong, print the message:
53
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
54
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
24
  try {
 
25
  $k->fetchPClasses();
 
26
 
27
+ $pclasses = $k->getAllPClasses();
 
 
28
 
29
+ // $pclasses is now a list of KlarnaPClass instances.
 
 
 
30
 
31
+ echo "OK\n";
32
  } catch(Exception $e) {
 
33
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
34
  }
lib/Klarna/examples/getAddresses.php CHANGED
@@ -8,79 +8,26 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Get the address(es) from Klarna. (Sweden only!)
35
- */
36
- $k->setCountry('se');
37
  try {
38
- //Attempt to get the address(es) associated with the SSN/PNO.
39
- // [[getAddresses]]
40
  $addrs = $k->getAddresses('410321-9202');
41
- // [[getAddresses]]
42
-
43
- // [[getAddresses:response]]
44
- array(
45
- new KlarnaAddr(
46
- '',
47
- '',
48
- '',
49
- 'Testperson-se',
50
- 'Approved',
51
- '',
52
- 'Stårgatan 1',
53
- '12345',
54
- 'Ankeborg',
55
- KlarnaCountry::SE,
56
- null,
57
- null
58
- )
59
- );
60
- // [[getAddresses:response]]
61
- /* If there exists several addresses you would want to output a list in
62
- which the customer could choose the address which suits him/her.
63
- */
64
-
65
- // Print them if available:
66
- foreach ($addrs as $key => $addr) {
67
- echo "<table>\n";
68
 
69
- // This only works if the right getAddresses type is used.
70
- if ($addr->isCompany) {
71
- echo "\t<tr><td>Company</td><td>{$addr->getCompanyName()}</td></tr>\n";
72
- } else {
73
- echo "\t<tr><td>First name</td><td>{$addr->getFirstName()}</td></tr>\n";
74
- echo "\t<tr><td>Last name</td><td>{$addr->getLastName()}</td></tr>\n";
75
- }
76
 
77
- echo "\t<tr><td>Street</td><td>{$addr->getStreet()}</td></tr>\n";
78
- echo "\t<tr><td>Zip code</td><td>{$addr->getZipCode()}</td></tr>\n";
79
- echo "\t<tr><td>City</td><td>{$addr->getCity()}</td></tr>\n";
80
- echo "\t<tr><td>Country</td><td>{$addr->getCountryCode()}</td></tr>\n";
81
- echo "</table>\n";
82
- }
83
  } catch(Exception $e) {
84
- //Something went wrong
85
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
86
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
24
+ $k->setCountry('se'); // Sweden only
 
 
 
 
 
 
25
  try {
 
 
26
  $addrs = $k->getAddresses('410321-9202');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ // $addrs is a list of KlarnaAddr instances.
 
 
 
 
 
 
29
 
30
+ echo "OK\n";
 
 
 
 
 
31
  } catch(Exception $e) {
 
32
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
33
  }
lib/Klarna/examples/getPClasses.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Load the PClasses from the local file or MySQL table.
35
- */
36
-
37
- /*
38
- PClasses are loaded from the local storage, as defined by "pcStorage"
39
- and "pcURI".
40
- */
41
-
42
- // Load all PClasses available.
43
- $pclasses = $k->getPClasses();
44
- // Here we can define a specific type of PClass we want to load
45
- // (KlarnaPClass::CAMPAIGN, for example), or leave it empty to get all that
46
- // are usable.
47
-
48
- // Next we might want to display the description in a drop down menu:
49
- echo "<select name='pclass'>\n";
50
- foreach ($pclasses as $pclass) {
51
- echo "\t<option value='{$pclass->getId()}'>{$pclass->getDescription()}</option>\n";
52
- }
53
- echo "</select>\n";
54
-
55
- // When the customer has confirmed the purchase and chosen a pclass, you can
56
- // easily grab just that one by doing:
57
- $pclassId = $pclasses[0]->getId(); // Let's say the customer picked the first one
58
- $pclass = $k->getPClass($pclassId);
59
-
60
- var_dump($pclass);
61
-
62
- // Next we can use $pclassId in the addTransaction call or in the reserveAmount
63
- // call.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/hasAccount.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
+
5
+ // Dependencies from http://phpxmlrpc.sourceforge.net/
6
+ require_once dirname(dirname(__FILE__)) .
7
+ '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
+ require_once dirname(dirname(__FILE__)) .
9
+ '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
+
11
+ $k = new Klarna();
12
+
13
+ $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
+ Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
22
+ );
23
+
24
+ $k->setCountry('se'); // Sweden only
25
+ try {
26
+ $result = $k->hasAccount('4103219202');
27
+
28
+ // $result is now a boolean, true if customer has an account
29
+
30
+ echo "OK\n";
31
+ } catch(Exception $e) {
32
+ echo "{$e->getMessage()} (#{$e->getCode()})\n";
33
+ }
lib/Klarna/examples/helperFunctions.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
+
5
+ // Dependencies from http://phpxmlrpc.sourceforge.net/
6
+ require_once dirname(dirname(__FILE__)) .
7
+ '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
+ require_once dirname(dirname(__FILE__)) .
9
+ '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
+
11
+ $k = new Klarna();
12
+ $k->config(
13
+ 0, // Merchant ID
14
+ 'sharedSecret', // Shared secret
15
+ KlarnaCountry::SE, // Purchase country
16
+ KlarnaLanguage::SV, // Purchase language
17
+ KlarnaCurrency::SEK, // Purchase currency
18
+ Klarna::BETA, // Server
19
+ 'json', // PClass storage
20
+ './pclasses.json' // PClass storage URI path
21
+ );
22
+
23
+
24
+ // Method: addArticle
25
+
26
+ // Handling fee, price including VAT.
27
+ $flags = KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING;
28
+ $k->addArticle(
29
+ 4, // Quantity
30
+ "HANDLING", // Article number
31
+ "Handling fee", // Article name/title
32
+ 50.99, // Price
33
+ 25, // 25% VAT
34
+ 0, // Discount
35
+ $flags // Flags
36
+ );
37
+
38
+
39
+ // Method: setAddress
40
+
41
+ $addr = new KlarnaAddr(
42
+ 'always_approved@klarna.com', // Email address
43
+ '', // Telephone number, only one phone number is needed
44
+ '0762560000', // Cell phone number
45
+ 'Testperson-se', // First name (given name)
46
+ 'Approved', // Last name (family name)
47
+ '', // No care of, C/O
48
+ 'Stårgatan 1', // Street address
49
+ '12345', // Zip code
50
+ 'Ankeborg', // City
51
+ KlarnaCountry::SE, // Country
52
+ null, // House number (AT/DE/NL only)
53
+ null // House extension (NL only)
54
+ );
55
+
56
+ $k->setAddress(KlarnaFlags::IS_BILLING, $addr);
57
+ $k->setAddress(KlarnaFlags::IS_SHIPPING, $addr);
58
+
59
+
60
+ // Method: calcMonthlyCost
61
+
62
+ $amount = 149.99;
63
+ $pclass = $k->getCheapestPClass($amount, KlarnaFlags::PRODUCT_PAGE);
64
+ $value = null;
65
+ if ($pclass) {
66
+ $monthly = KlarnaCalc::calc_monthly_cost($amount, $pclass, KlarnaFlags::PRODUCT_PAGE);
67
+
68
+ echo "monthly cost: {$monthly}\n";
69
+ }
70
+
71
+
72
+ // Method: totalCreditPurchaseCost
73
+
74
+ $id = 100;
75
+ $pclass = $k->getPClass($id);
76
+ $amount = 100.50;
77
+ if ($pclass) {
78
+ $total = KlarnaCalc::total_credit_purchase_cost($amount, $pclass, KlarnaFlags::CHECKOUT_PAGE);
79
+
80
+ echo "total credit purchase cost: {$total}\n";
81
+ }
82
+
83
+
84
+ // Method: calcAPR
85
+
86
+ $id = 100;
87
+ $pclass = $k->getPClass($id);
88
+ $amount = 105.50;
89
+ if ($pclass) {
90
+ $apr = KlarnaCalc::calc_apr($amount, $pclass, KlarnaFlags::CHECKOUT_PAGE);
91
+
92
+ echo "apr: {$apr}\n";
93
+ }
94
+
95
+
96
+ // Method: getPClasses
97
+
98
+ // Optional argument PClass type to filter by.
99
+ // E.g. KlarnaPClass::CAMPAIGN
100
+ $pclasses = $k->getPClasses();
101
+
102
+ // $pclasses is now a list of KlarnaPClass instances.
lib/Klarna/examples/invoiceAddress.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Get the address associated with the purchase/invoice.
35
- */
36
-
37
- // Here you enter the invoice number:
38
- $invNo = '123456';
39
-
40
- try {
41
- // Attempt to get the address
42
- // [[invoiceAddress]]
43
- $addr = $k->invoiceAddress($invNo);
44
- // [[invoiceAddress]]
45
-
46
- // [[invoiceAddress:response]]
47
- new KlarnaAddr(
48
- '',
49
- '',
50
- '',
51
- 'Testperson-se',
52
- 'Approved',
53
- '',
54
- 'Stårgatan 1',
55
- '12345',
56
- 'Ankeborg',
57
- KlarnaCountry::SE,
58
- null,
59
- null
60
- );
61
- // [[invoiceAddress:response]]
62
-
63
- // Display the retrieved address:
64
- echo "<table>\n";
65
- if ($addr->isCompany) {
66
- echo "\t<tr><td>Company</td><td>{$addr->getCompanyName()}</td></tr>\n";
67
- } else {
68
- echo "\t<tr><td>First name</td><td>{$addr->getFirstName()}</td></tr>\n";
69
- echo "\t<tr><td>Last name</td><td>{$addr->getLastName()}</td></tr>\n";
70
- }
71
-
72
- echo "\t<tr><td>Street</td><td>{$addr->getStreet()}</td></tr>\n";
73
- echo "\t<tr><td>Zip code</td><td>{$addr->getZipCode()}</td></tr>\n";
74
- echo "\t<tr><td>City</td><td>{$addr->getCity()}</td></tr>\n";
75
- echo "\t<tr><td>Country</td><td>{$addr->getCountryCode()}</td></tr>\n";
76
- echo "</table>\n";
77
- } catch(Exception $e) {
78
- //Something went wrong
79
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/invoiceAmount.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Retrieve the total amount of a invoice.
35
- */
36
-
37
- // Here you enter the invoice number:
38
- $invNo = '123456';
39
-
40
- try {
41
- // [[InvoiceAmount]]
42
- $result = $k->invoiceAmount($invNo);
43
- // [[InvoiceAmount]]
44
-
45
- // [[InvoiceAmount:response]]
46
- 123.45;
47
- // [[InvoiceAmount:response]]
48
-
49
- echo "Result: {$result}\n";
50
- /* Invoice amount successfully retrieved, proceed accordingly.
51
- $result contains the total sum of the invoice.
52
- */
53
- } catch(Exception $e) {
54
- //Something went wrong, print the message:
55
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/invoicePartAmount.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Retrieve the amount for specific article(s) from an invoice.
35
- */
36
-
37
- // Here you enter the invoice number:
38
- $invNo = '123456';
39
-
40
- // Specify for which article(s) you want the amount.
41
- // artNo must be the same as the one you used in addArticle() when you made the
42
- // addTransaction() call.
43
- // [[addArtNo]]
44
- $k->addArtNo(
45
- 1, // Quantity
46
- 'MG200MMS' // Article number
47
- );
48
- // [[addArtNo]]
49
-
50
- // [[addArtNo:response]]
51
- null;
52
- // [[addArtNo:response]]
53
-
54
- try {
55
- // [[invoicePartAmount]]
56
- $result = $k->invoicePartAmount($invNo);
57
- // [[invoicePartAmount]]
58
-
59
- // [[invoicePartAmount:response]]
60
- 45.50;
61
- // [[invoicePartAmount:response]]
62
-
63
- echo "Result: {$result}\n";
64
- /* Partial invoice amount successfully retrieved, proceed accordingly.
65
- $result contains the sum of specified article(s).
66
- */
67
- } catch(Exception $e) {
68
- // Something went wrong, print the message:
69
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/reserveAmount.php CHANGED
@@ -8,33 +8,19 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Add the article(s), shipping and/or handling fee.
35
- */
36
-
37
- // Here we add a normal product to our goods list.
38
  $k->addArticle(
39
  4, // Quantity
40
  "MG200MMS", // Article number
@@ -45,126 +31,42 @@ $k->addArticle(
45
  KlarnaFlags::INC_VAT // Price is including VAT.
46
  );
47
 
48
- // Next we might want to add a shipment fee for the product
49
- $k->addArticle(
50
- 1,
51
- "",
52
- "Shipping fee",
53
- 14.5,
54
- 25,
55
- 0,
56
- // Price is including VAT and is shipment fee
57
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_SHIPMENT
58
- );
59
-
60
- // Lastly, we want to use an invoice/handling fee as well
61
- $k->addArticle(
62
- 1,
63
- "",
64
- "Handling fee",
65
- 11.5,
66
- 25,
67
- 0,
68
- // Price is including VAT and is handling/invoice fee
69
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING
70
- );
71
-
72
- /**
73
- * 3. Create and set the address(es).
74
- */
75
 
76
- // Create the address object and specify the values.
77
  $addr = new KlarnaAddr(
78
- 'always_approved@klarna.com', // email
79
- '', // Telno, only one phone number is needed.
80
- '0762560000', // Cellno
81
- 'Testperson-se', // Firstname
82
- 'Approved', // Lastname
83
- '', // No care of, C/O.
84
- 'St?rgatan 1', // Street
85
- '12345', // Zip Code
86
  'Ankeborg', // City
87
  KlarnaCountry::SE, // Country
88
- null, // HouseNo for German and Dutch customers.
89
- null // House Extension. Dutch customers only.
90
- );
91
-
92
- // Next we tell the Klarna instance to use the address in the next order.
93
- $k->setAddress(KlarnaFlags::IS_BILLING, $addr); // Billing / invoice address
94
- $k->setAddress(KlarnaFlags::IS_SHIPPING, $addr); // Shipping / delivery address
95
-
96
- /**
97
- * 4. Specify relevant information from your store. (OPTIONAL)
98
- */
99
-
100
- // Set store specific information so you can e.g. search and associate invoices
101
- // with order numbers.
102
- $k->setEstoreInfo(
103
- '175012', // Order ID 1
104
- '1999110234', // Order ID 2
105
- '' // Optional username, email or identifier
106
  );
107
 
108
- // If you don't have the order id available at this stage, you can later use the
109
- // method updateOrderNo().
110
-
111
- /**
112
- * 5. Set additional information. (OPTIONAL)
113
- */
114
-
115
- /** Comment **/
116
-
117
- $k->setComment('A text string stored in the invoice commentary area.');
118
-
119
- /** Shipment type **/
120
-
121
- // Normal shipment is defaulted, delays the start of invoice expiration/due-date.
122
- $k->setShipmentInfo('delay_adjust', KlarnaFlags::EXPRESS_SHIPMENT);
123
-
124
- /**
125
- * 6. Invoke reserveAmount and transmit the data.
126
- */
127
 
128
  try {
129
- // Transmit all the specified data, from the steps above, to Klarna.
130
- // [[reserveAmount]]
131
  $result = $k->reserveAmount(
132
- '4103219202', // PNO (Date of birth for DE and NL).
133
- null, // Gender.
134
- // Amount. -1 specifies that calculation should calculate the amount
135
- // using the goods list
136
- -1,
137
- KlarnaFlags::NO_FLAG, // Flags to affect behavior.
138
- // -1 notes that this is an invoice purchase, for part payment purchase
139
- // you will have a pclass object on which you use getId().
140
  KlarnaPClass::INVOICE
141
  );
142
- // [[reserveAmount]]
143
-
144
- // [[reserveAmount:response]]
145
- array(
146
- "123456",
147
- 1
148
- );
149
- // [[reserveAmount:response]]
150
 
151
-
152
- //Check the order status
153
- if ($result[1] == KlarnaFlags::PENDING) {
154
- /* The order is under manual review and will be accepted or denied at a
155
- later stage. Use cronjob with checkOrderStatus() or visit Klarna
156
- Online to check to see if the status has changed. You should still
157
- show it to the customer as it was accepted, to avoid further attempts
158
- to fraud.
159
- */
160
- }
161
-
162
- // Here we get the reservation number
163
  $rno = $result[0];
 
 
 
164
 
165
- echo "status: {$result[1]}\nrno: {$result[0]}\n";
166
- // Order is complete, store it in a database.
167
  } catch(Exception $e) {
168
- // The purchase was denied or something went wrong, print the message:
169
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
170
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
 
24
  $k->addArticle(
25
  4, // Quantity
26
  "MG200MMS", // Article number
31
  KlarnaFlags::INC_VAT // Price is including VAT.
32
  );
33
 
34
+ $k->addArticle(1, "", "Shipping fee", 14.5, 25, 0, KlarnaFlags::INC_VAT | KlarnaFlags::IS_SHIPMENT);
35
+ $k->addArticle(1, "", "Handling fee", 11.5, 25, 0, KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
 
37
  $addr = new KlarnaAddr(
38
+ 'always_approved@klarna.com', // Email address
39
+ '', // Telephone number, only one phone number is needed
40
+ '0762560000', // Cell phone number
41
+ 'Testperson-se', // First name (given name)
42
+ 'Approved', // Last name (family name)
43
+ '', // No care of, C/O
44
+ 'Stårgatan 1', // Street address
45
+ '12345', // Zip code
46
  'Ankeborg', // City
47
  KlarnaCountry::SE, // Country
48
+ null, // House number (AT/DE/NL only)
49
+ null // House extension (NL only)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  );
51
 
52
+ $k->setAddress(KlarnaFlags::IS_BILLING, $addr);
53
+ $k->setAddress(KlarnaFlags::IS_SHIPPING, $addr);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  try {
 
 
56
  $result = $k->reserveAmount(
57
+ '4103219202', // PNO (Date of birth for AT/DE/NL)
58
+ null, // KlarnaFlags::MALE, KlarnaFlags::FEMALE (AT/DE/NL only)
59
+ -1, // Automatically calculate and reserve the cart total amount
60
+ KlarnaFlags::NO_FLAG,
 
 
 
 
61
  KlarnaPClass::INVOICE
62
  );
 
 
 
 
 
 
 
 
63
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  $rno = $result[0];
65
+ $status = $result[1];
66
+
67
+ // $status is KlarnaFlags::PENDING or KlarnaFlags::ACCEPTED.
68
 
69
+ echo "OK: reservation {$rno} - order status {$status}\n";
 
70
  } catch(Exception $e) {
 
71
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
72
  }
lib/Klarna/examples/reserveOCR.php CHANGED
@@ -8,52 +8,25 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Reserve the OCR numbers.
35
- */
36
-
37
  try {
38
- // Reserve the OCR number(s):
39
- // [[reserveOCR]]
40
- $result = $k->reserveOCR(
41
- 1 // Number of OCR numbers you wish to reserve.
42
- );
43
- // [[reserveOCR]]
44
 
45
- // [[reserveOCR:response]]
46
- array(
47
- "41789461815156"
48
- );
49
- // [[reserveOCR:response]]
50
 
51
- echo "Result: \n";
52
- foreach ($result as $r) {
53
- echo "{$r}\n";
54
- }
55
- /* $result now contains an array of OCR numbers, proceed accordingly. */
56
  } catch(Exception $e) {
57
- // Something went wrong, print the message:
58
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
59
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
24
  try {
25
+ $ocrs = $k->reserveOCR(1);
 
 
 
 
 
26
 
27
+ // $ocrs is a list of string OCR numbers.
 
 
 
 
28
 
29
+ echo "OK\n";
 
 
 
 
30
  } catch(Exception $e) {
 
31
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
32
  }
lib/Klarna/examples/returnAmount.php CHANGED
@@ -8,56 +8,31 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Give a discount on the invoice.
35
- */
36
-
37
- // Here you enter the invoice number:
38
  $invNo = '123456';
39
 
40
  try {
41
- // [[returnAmount]]
42
- $result = $k->returnAmount(
43
  $invNo, // Invoice number
44
  19.99, // Amount given as a discount.
45
  25, // 25% VAT
46
  KlarnaFlags::INC_VAT, // Amount including VAT.
47
  "Family discount" // Description
48
  );
49
- // [[returnAmount]]
50
-
51
- // [[returnAmountResult]]
52
- "123456";
53
- // [[returnAmountResult]]
54
-
55
- echo "Result: {$result}\n";
56
 
57
- /* Discount given, proceed accordingly.
58
- $result contains the invoice number of the discounted invoice.
59
- */
60
  } catch(Exception $e) {
61
- // Something went wrong, print the message:
62
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
63
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
 
24
  $invNo = '123456';
25
 
26
  try {
27
+ $k->returnAmount(
 
28
  $invNo, // Invoice number
29
  19.99, // Amount given as a discount.
30
  25, // 25% VAT
31
  KlarnaFlags::INC_VAT, // Amount including VAT.
32
  "Family discount" // Description
33
  );
 
 
 
 
 
 
 
34
 
35
+ echo "OK\n";
 
 
36
  } catch(Exception $e) {
 
37
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
38
  }
lib/Klarna/examples/sendInvoice.php CHANGED
@@ -8,51 +8,25 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Send an (activated) invoice to the customer.
35
- * (Postal service / normal mail)
36
- */
37
-
38
- // Here you enter the invoice number:
39
  $invNo = '123456';
40
 
41
  try {
42
- // [[sendInvoice]]
43
- $result = $k->sendInvoice("123456");
44
- // [[sendInvoice]]
45
-
46
- // [[sendInvoice:response]]
47
- "123456";
48
- // [[sendInvoice:response]]
49
-
50
- echo "Result: {$result}\n";
51
 
52
- /* Invoice sent to customer, proceed accordingly.
53
- $result contains the invoice number of the sent invoice.
54
- */
55
  } catch(Exception $e) {
56
- // Something went wrong, print the message:
57
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
58
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
 
 
24
  $invNo = '123456';
25
 
26
  try {
27
+ $k->sendInvoice($invNo);
 
 
 
 
 
 
 
 
28
 
29
+ echo "OK\n";
 
 
30
  } catch(Exception $e) {
 
31
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
32
  }
lib/Klarna/examples/splitReservation.php CHANGED
@@ -8,59 +8,31 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Split the reservation.
35
- */
36
-
37
- // Here you enter the reservation number you got from reserveAmount():
38
- $rno = '123456';
39
 
40
  try {
41
- // Transmit all the specified data, from the steps above, to Klarna.
42
- // [[splitReservation]]
43
- $result = $k->splitReservation(
44
- $rno, // Reservation number
45
- 99.5, // Amount to be subtracted from the reservation.
46
- KlarnaFlags::NO_FLAG // No specific behaviour.
47
- );
48
- // [[splitReservation]]
49
-
50
- // [[splitReservation:response]]
51
- array(
52
- '12345',
53
- 1
54
- );
55
- // [[splitReservation:response]]
56
 
 
 
57
 
58
- // Split successful, proceed accordingly.
59
- $newRno = $result[0]; // New reservation number
60
- $status = $result[1]; // Status of the new reservation (1 or 2)
61
 
62
- echo "New RNO: {$result[0]}\nStatus: {$result[1]}\n";
63
  } catch(Exception $e) {
64
- // Something went wrong, print the message:
65
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
66
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
 
 
 
 
 
 
 
 
 
24
 
25
  try {
26
+ $rno = '123456';
27
+ $amount = 99.5; // Amount to be subtracted from the reservation.
28
+ $result = $k->splitReservation($rno, $amount);
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ $newRno = $result[0];
31
+ $status = $result[1];
32
 
33
+ // $status is KlarnaFlags::PENDING or KlarnaFlags::ACCEPTED.
 
 
34
 
35
+ echo "OK: new reservation {$newRno} - order status {$status}\n";
36
  } catch(Exception $e) {
 
37
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
38
  }
lib/Klarna/examples/update.php CHANGED
@@ -8,33 +8,21 @@ require_once dirname(dirname(__FILE__)) .
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
  $k = new Klarna();
16
 
17
  $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
  Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
  );
29
 
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Add the article(s), shipping and/or handling fee. (OPTIONAL)
35
- */
36
 
37
- // Here we add a normal product to our goods list.
38
  $k->addArticle(
39
  4, // Quantity
40
  "MG200MMS", // Article number
@@ -45,85 +33,17 @@ $k->addArticle(
45
  KlarnaFlags::INC_VAT // Price is including VAT.
46
  );
47
 
48
- // Next we might want to add a shipment fee for the product
49
- $k->addArticle(
50
- 1,
51
- "",
52
- "Shipping fee",
53
- 14.5,
54
- 25,
55
- 0,
56
- // Price is including VAT and is shipment fee
57
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_SHIPMENT
58
- );
59
-
60
- // Lastly, we want to use an invoice/handling fee as well
61
- $k->addArticle(
62
- 1,
63
- "",
64
- "Handling fee",
65
- 11.5,
66
- 25,
67
- 0,
68
- // Price is including VAT and is handling/invoice fee
69
- KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING
70
- );
71
 
72
- /**
73
- * 3. Create and set the address(es). (OPTIONAL)
74
- */
75
 
76
- // Create the address object and specify the values.
77
- $addr = new KlarnaAddr(
78
- 'always_approved@klarna.com', // email
79
- '', // Telno, only one phone number is needed.
80
- '0762560000', // Cellno
81
- 'Testperson-se', // Firstname
82
- 'Approved', // Lastname
83
- '', // No care of, C/O.
84
- 'St�rgatan 1', // Street
85
- '12345', // Zip Code
86
- 'Ankeborg', // City
87
- KlarnaCountry::SE, // Country
88
- null, // HouseNo for German and Dutch customers.
89
- null // House Extension. Dutch customers only.
90
- );
91
-
92
- // Next we tell the Klarna instance to use the address in the next order.
93
- $k->setAddress(KlarnaFlags::IS_BILLING, $addr); // Billing / invoice address
94
- $k->setAddress(KlarnaFlags::IS_SHIPPING, $addr); // Shipping / delivery address
95
-
96
- /**
97
- * 4. Specify relevant information from your store. (OPTIONAL)
98
- */
99
-
100
- // Set store specific information so you can e.g. search and associate invoices
101
- // with order numbers.
102
- $k->setEstoreInfo(
103
- '175012', // Order ID 1
104
- '1999110234', // Order ID 2
105
- '' // Optional username, email or identifier
106
- );
107
-
108
- /**
109
- * 5. Make the call to Klarna
110
- */
111
-
112
- // Reservation number
113
  $rno = '123456';
114
 
115
  try {
116
- // [[update]]
117
- $result = $k->update($rno);
118
- // [[update]]
119
-
120
- // [[update:response]]
121
- true;
122
- // [[update:response]]
123
 
124
- if ($result) {
125
- echo "Update successful\n";
126
- }
127
  } catch(KlarnaException $e) {
128
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
129
  }
8
  require_once dirname(dirname(__FILE__)) .
9
  '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
 
 
 
 
 
11
  $k = new Klarna();
12
 
13
  $k->config(
14
+ 0, // Merchant ID
15
+ 'sharedSecret', // Shared secret
16
+ KlarnaCountry::SE, // Purchase country
17
+ KlarnaLanguage::SV, // Purchase language
18
+ KlarnaCurrency::SEK, // Purchase currency
19
  Klarna::BETA, // Server
20
+ 'json', // PClass storage
21
+ './pclasses.json' // PClass storage URI path
 
 
22
  );
23
 
24
+ // Replace cart with new items
 
 
 
 
 
25
 
 
26
  $k->addArticle(
27
  4, // Quantity
28
  "MG200MMS", // Article number
33
  KlarnaFlags::INC_VAT // Price is including VAT.
34
  );
35
 
36
+ $k->addArticle(1, "", "Shipping fee", 14.5, 25, 0, KlarnaFlags::INC_VAT | KlarnaFlags::IS_SHIPMENT);
37
+ $k->addArticle(1, "", "Handling fee", 11.5, 25, 0, KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
+ // For information on what else you can update, refer to the documentation
 
 
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  $rno = '123456';
42
 
43
  try {
44
+ $k->update($rno);
 
 
 
 
 
 
45
 
46
+ echo "OK\n";
 
 
47
  } catch(KlarnaException $e) {
48
  echo "{$e->getMessage()} (#{$e->getCode()})\n";
49
  }
lib/Klarna/examples/updateChargeAmount.php DELETED
@@ -1,60 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Update charge amount (shipping fee or handling fee).
35
- */
36
-
37
- // Here you enter the invoice number you got from addTransaction():
38
- $invNo = '123456';
39
-
40
- try {
41
- // [[updateChargeAmount]]
42
- $result = $k->updateChargeAmount(
43
- $invNo, // Invoice number
44
- KlarnaFlags::IS_SHIPMENT, // IS_SHIPMENT or IS_HANDLING
45
- 16.7 // Set the shipping fee to 16.7
46
- );
47
- // [[updateChargeAmount]]
48
-
49
- // [[updateChargeAmount:response]]
50
- "123456";
51
- // [[updateChargeAmount:response]]
52
-
53
- echo "Result: {$result}\n";
54
- /* Charge type updated successfully, proceed accordingly.
55
- $result contains the same invoice number.
56
- */
57
- } catch(Exception $e) {
58
- // Something went wrong, print the message:
59
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
60
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/updateGoodsQty.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Update goods quantity.
35
- */
36
-
37
- // Here you enter the invoice number you got from addTransaction():
38
- $invNo = '123456';
39
-
40
- try {
41
- // [[updateGoodsQty]]
42
- $result = $k->updateGoodsQty(
43
- $invNo, // Invoice number
44
- 'MG200MMS', // ArtNo must be the same as the one you used in
45
- // addArticle() when you made the addTransaction() call.
46
- 2 // New Quantity
47
- );
48
- // [[updateGoodsQty]]
49
-
50
- // [[updateGoodsQty:response]]
51
- "123456";
52
- // [[updateGoodsQty:response]]
53
-
54
- echo "Result: {$result}\n";
55
- /* Article quantity updated successfully, proceed accordingly.
56
- $result contains the same invoice number.
57
- */
58
- } catch(Exception $e) {
59
- // Something went wrong, print the message:
60
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/examples/updateOrderNo.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- require_once dirname(dirname(__FILE__)) . '/Klarna.php';
4
-
5
- // Dependencies from http://phpxmlrpc.sourceforge.net/
6
- require_once dirname(dirname(__FILE__)) .
7
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc';
8
- require_once dirname(dirname(__FILE__)) .
9
- '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc';
10
-
11
- /**
12
- * 1. Initialize and setup the Klarna instance.
13
- */
14
-
15
- $k = new Klarna();
16
-
17
- $k->config(
18
- 123456, // Merchant ID
19
- 'sharedSecret', // Shared Secret
20
- KlarnaCountry::SE, // Country
21
- KlarnaLanguage::SV, // Language
22
- KlarnaCurrency::SEK, // Currency
23
- Klarna::BETA, // Server
24
- 'json', // PClass Storage
25
- '/srv/pclasses.json', // PClass Storage URI path
26
- true, // SSL
27
- true // Remote logging of response times of xmlrpc calls
28
- );
29
-
30
- // OR you can set the config to loads from a file, for example /srv/klarna.json:
31
- // $k->setConfig(new KlarnaConfig('/srv/klarna.json'));
32
-
33
- /**
34
- * 2. Update order number / id.
35
- */
36
-
37
- // Here you enter the invoice number you got from addTransaction():
38
- $invNo = '123456';
39
-
40
- try {
41
- // [[updateOrderNo]]
42
- $result = $k->updateOrderNo(
43
- $invNo, // Invoice Number
44
- '1234' // The order id/number you wish to associated.
45
- );
46
- // [[updateOrderNo]]
47
-
48
- // [[updateOrderNo:response]]
49
- "123456";
50
- // [[updateOrderNo:response]]
51
-
52
- echo "Result: {$result}\n";
53
- /* Order id is now assicated with the invoice, proceed accordingly.
54
- $result contains the same invoice number.
55
- */
56
- } catch(Exception $e) {
57
- // Something went wrong, print the message:
58
- echo "{$e->getMessage()} (#{$e->getCode()})\n";
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Klarna/klarnaaddr.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -20,7 +20,7 @@
20
  * @author MS Dev <ms.modules@klarna.com>
21
  * @copyright 2012 Klarna AB (http://klarna.com)
22
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
- * @link http://integration.klarna.com/
24
  */
25
  class KlarnaAddr
26
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
20
  * @author MS Dev <ms.modules@klarna.com>
21
  * @copyright 2012 Klarna AB (http://klarna.com)
22
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
23
+ * @link https://developers.klarna.com/
24
  */
25
  class KlarnaAddr
26
  {
lib/Klarna/klarnacalc.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -38,7 +38,7 @@
38
  * @author MS Dev <ms.modules@klarna.com>
39
  * @copyright 2012 Klarna AB (http://klarna.com)
40
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
41
- * @link http://integration.klarna.com/
42
  */
43
  class KlarnaCalc
44
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
38
  * @author MS Dev <ms.modules@klarna.com>
39
  * @copyright 2012 Klarna AB (http://klarna.com)
40
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
41
+ * @link https://developers.klarna.com/
42
  */
43
  class KlarnaCalc
44
  {
lib/Klarna/klarnaconfig.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -30,8 +30,6 @@
30
  * currency - Currency constant or code (int|string)
31
  * mode - Klarna::BETA or Klarna::LIVE
32
  * ssl - Use HTTPS or HTTP. (bool)
33
- * candice - Status reporting to Klarna, to detect erroneous
34
- * integrations, etc. (bool)
35
  * pcStorage - Storage module, e.g. 'json'
36
  * pcURI - URI to where the PClasses are stored, e.g.
37
  * '/srv/shop/pclasses.json'
@@ -43,7 +41,7 @@
43
  * @author MS Dev <ms.modules@klarna.com>
44
  * @copyright 2012 Klarna AB (http://klarna.com)
45
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
46
- * @link http://integration.klarna.com/
47
  */
48
  class KlarnaConfig implements ArrayAccess
49
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
30
  * currency - Currency constant or code (int|string)
31
  * mode - Klarna::BETA or Klarna::LIVE
32
  * ssl - Use HTTPS or HTTP. (bool)
 
 
33
  * pcStorage - Storage module, e.g. 'json'
34
  * pcURI - URI to where the PClasses are stored, e.g.
35
  * '/srv/shop/pclasses.json'
41
  * @author MS Dev <ms.modules@klarna.com>
42
  * @copyright 2012 Klarna AB (http://klarna.com)
43
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
44
+ * @link https://developers.klarna.com/
45
  */
46
  class KlarnaConfig implements ArrayAccess
47
  {
lib/Klarna/klarnapclass.php CHANGED
@@ -10,7 +10,7 @@
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
- * @link http://integration.klarna.com/
14
  */
15
 
16
  /**
@@ -24,7 +24,7 @@
24
  * @author MS Dev <ms.modules@klarna.com>
25
  * @copyright 2012 Klarna AB (http://klarna.com)
26
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
27
- * @link http://integration.klarna.com/
28
  */
29
  class KlarnaPClass
30
  {
10
  * @author MS Dev <ms.modules@klarna.com>
11
  * @copyright 2012 Klarna AB (http://klarna.com)
12
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
13
+ * @link https://developers.klarna.com/
14
  */
15
 
16
  /**
24
  * @author MS Dev <ms.modules@klarna.com>
25
  * @copyright 2012 Klarna AB (http://klarna.com)
26
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
27
+ * @link https://developers.klarna.com/
28
  */
29
  class KlarnaPClass
30
  {
lib/Klarna/pclasses/jsonstorage.class.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -27,7 +27,7 @@ require_once 'storage.intf.php';
27
  * @author MS Dev <ms.modules@klarna.com>
28
  * @copyright 2012 Klarna AB (http://klarna.com)
29
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
30
- * @link http://integration.klarna.com/
31
  */
32
 
33
  class JSONStorage extends PCStorage
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
27
  * @author MS Dev <ms.modules@klarna.com>
28
  * @copyright 2012 Klarna AB (http://klarna.com)
29
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
30
+ * @link https://developers.klarna.com/
31
  */
32
 
33
  class JSONStorage extends PCStorage
lib/Klarna/pclasses/mysqlstorage.class.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -51,7 +51,7 @@ require_once 'storage.intf.php';
51
  * @author MS Dev <ms.modules@klarna.com>
52
  * @copyright 2012 Klarna AB (http://klarna.com)
53
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
54
- * @link http://integration.klarna.com/
55
  */
56
  class MySQLStorage extends PCStorage
57
  {
@@ -109,12 +109,13 @@ class MySQLStorage extends PCStorage
109
  }
110
 
111
  /**
112
- * Connects to the DB and checks if DB and table exists.
 
 
113
  *
114
- * @throws KlarnaException
115
  * @return void
116
  */
117
- protected function connect()
118
  {
119
  $this->link = mysql_connect($this->addr, $this->user, $this->passwd);
120
  if ($this->link === false) {
@@ -122,7 +123,17 @@ class MySQLStorage extends PCStorage
122
  'Failed to connect to database! ('.mysql_error().')'
123
  );
124
  }
 
125
 
 
 
 
 
 
 
 
 
 
126
  if (!mysql_query(
127
  "CREATE DATABASE IF NOT EXISTS `{$this->dbName}`",
128
  $this->link
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
51
  * @author MS Dev <ms.modules@klarna.com>
52
  * @copyright 2012 Klarna AB (http://klarna.com)
53
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
54
+ * @link https://developers.klarna.com/
55
  */
56
  class MySQLStorage extends PCStorage
57
  {
109
  }
110
 
111
  /**
112
+ * Establish a connection to the DB
113
+ *
114
+ * @throws Klarna_DatabaseException If a connection could not be made
115
  *
 
116
  * @return void
117
  */
118
+ public function connect()
119
  {
120
  $this->link = mysql_connect($this->addr, $this->user, $this->passwd);
121
  if ($this->link === false) {
123
  'Failed to connect to database! ('.mysql_error().')'
124
  );
125
  }
126
+ }
127
 
128
+ /**
129
+ * Initialize the DB by creating the necessary database tables.
130
+ *
131
+ * @throws Klarna_DatabaseException If tables could not be created
132
+ *
133
+ * @return void
134
+ */
135
+ public function create()
136
+ {
137
  if (!mysql_query(
138
  "CREATE DATABASE IF NOT EXISTS `{$this->dbName}`",
139
  $this->link
lib/Klarna/pclasses/sqlstorage.class.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -51,7 +51,7 @@ require_once 'storage.intf.php';
51
  * @author MS Dev <ms.modules@klarna.com>
52
  * @copyright 2012 Klarna AB (http://klarna.com)
53
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
54
- * @link http://integration.klarna.com/
55
  */
56
  class SQLStorage extends PCStorage
57
  {
@@ -227,12 +227,15 @@ class SQLStorage extends PCStorage
227
  }
228
 
229
  /**
230
- * Grabs the PDO connection to the database, specified by the URI.
231
  *
232
- * @param string $uri pclass uri
 
 
 
 
233
  *
234
  * @return void
235
- * @throws KlarnaException
236
  */
237
  protected function getConnection($uri)
238
  {
@@ -251,20 +254,46 @@ class SQLStorage extends PCStorage
251
  }
252
 
253
  /**
254
- * Initializes the DB, if the database or table is missing.
 
 
 
 
255
  *
256
  * @return void
257
- * @throws KlarnaException
258
  */
259
  protected function initDB()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  {
261
  try {
262
  $this->pdo->exec("CREATE DATABASE `{$this->dbName}`");
263
  } catch (PDOException $e) {
264
  //SQLite does not support this...
265
- //throw new KlarnaException(
266
- // 'Database non-existant, failed to create it!'
267
- //);
268
  }
269
 
270
  $sql = <<<SQL
@@ -291,20 +320,6 @@ SQL;
291
  }
292
  }
293
 
294
- /**
295
- * Connects to the DB and checks if DB and table exists.
296
- *
297
- * @param string|array $uri pclass uri
298
- *
299
- * @throws KlarnaException
300
- * @return void
301
- */
302
- protected function connect($uri)
303
- {
304
- $this->getConnection($uri);
305
- $this->initDB();
306
- }
307
-
308
  /**
309
  * Loads the PClasses.
310
  *
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
51
  * @author MS Dev <ms.modules@klarna.com>
52
  * @copyright 2012 Klarna AB (http://klarna.com)
53
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
54
+ * @link https://developers.klarna.com/
55
  */
56
  class SQLStorage extends PCStorage
57
  {
227
  }
228
 
229
  /**
230
+ * Connects to the DB.
231
  *
232
+ * @param string|array $uri pclass uri
233
+ *
234
+ * @throws Klarna_DatabaseException If connection could not be established.
235
+ *
236
+ * @deprecated Use the connect method instead.
237
  *
238
  * @return void
 
239
  */
240
  protected function getConnection($uri)
241
  {
254
  }
255
 
256
  /**
257
+ * Attempt to create the database and tables needed to store pclasses.
258
+ *
259
+ * @throws Klarna_DatabaseException If the table could not be created.
260
+ *
261
+ * @deprecated Use the create method instead
262
  *
263
  * @return void
 
264
  */
265
  protected function initDB()
266
+ {
267
+ $this->create();
268
+ }
269
+
270
+ /**
271
+ * Connects to the DB.
272
+ *
273
+ * @param string|array $uri pclass uri
274
+ *
275
+ * @throws Klarna_DatabaseException If connection could not be established.
276
+ *
277
+ * @return void
278
+ */
279
+ public function connect($uri)
280
+ {
281
+ $this->getConnection($uri);
282
+ }
283
+
284
+ /**
285
+ * Attempt to create the database and tables needed to store pclasses.
286
+ *
287
+ * @throws Klarna_DatabaseException If the table could not be created.
288
+ *
289
+ * @return void
290
+ */
291
+ public function create()
292
  {
293
  try {
294
  $this->pdo->exec("CREATE DATABASE `{$this->dbName}`");
295
  } catch (PDOException $e) {
296
  //SQLite does not support this...
 
 
 
297
  }
298
 
299
  $sql = <<<SQL
320
  }
321
  }
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  /**
324
  * Loads the PClasses.
325
  *
lib/Klarna/pclasses/storage.intf.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -22,7 +22,7 @@
22
  * @author MS Dev <ms.modules@klarna.com>
23
  * @copyright 2012 Klarna AB (http://klarna.com)
24
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
25
- * @link http://integration.klarna.com/
26
  */
27
  abstract class PCStorage
28
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
22
  * @author MS Dev <ms.modules@klarna.com>
23
  * @copyright 2012 Klarna AB (http://klarna.com)
24
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
25
+ * @link https://developers.klarna.com/
26
  */
27
  abstract class PCStorage
28
  {
lib/Klarna/pclasses/xmlstorage.class.php CHANGED
@@ -9,7 +9,7 @@
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
- * @link http://integration.klarna.com/
13
  */
14
 
15
  /**
@@ -27,7 +27,7 @@ require_once 'storage.intf.php';
27
  * @author MS Dev <ms.modules@klarna.com>
28
  * @copyright 2012 Klarna AB (http://klarna.com)
29
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
30
- * @link http://integration.klarna.com/
31
  */
32
  class XMLStorage extends PCStorage
33
  {
9
  * @author MS Dev <ms.modules@klarna.com>
10
  * @copyright 2012 Klarna AB (http://klarna.com)
11
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
12
+ * @link https://developers.klarna.com/
13
  */
14
 
15
  /**
27
  * @author MS Dev <ms.modules@klarna.com>
28
  * @copyright 2012 Klarna AB (http://klarna.com)
29
  * @license http://opensource.org/licenses/BSD-2-Clause BSD-2
30
+ * @link https://developers.klarna.com/
31
  */
32
  class XMLStorage extends PCStorage
33
  {
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>klarnapayments</name>
4
- <version>5.2.0</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>2014-11-05</date>
14
- <time>13:34:42</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="6c35211c76987e619b51f6b6f06b0707"/><dir name="children"><file name="invoicefee.phtml" hash="2b721be479706716f6468c8395455fa5"/><file name="invoices.phtml" hash="ac4e3bd4aea83e9ea3479fc04ed0d5a4"/><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="3ddb8e805772c96d1833961df13a78eb"/></dir><dir name="template"><dir name="vaimo"><dir name="klarna"><dir name="catalog"><dir name="product"><file name="pricewidget.phtml" hash="f5838b8bb129634487a398ca2557f48b"/></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="25386497892129effff92a64f326ff42"/><dir name="address"><file name="search.phtml" hash="42c4fa161e9f6870bba41971c865cf34"/></dir><file name="checkout.phtml" hash="fe86056c73f86d53a73ebda5c5f3547c"/><dir name="children"><file name="addressresult.phtml" hash="7ed16bca431a8146139ce51fd7001d11"/><file name="consent.phtml" hash="a4f446258fa20a453d3566cffc20085d"/><file name="dateofbirth.phtml" hash="e1dbe367ce43029d671dae6f7d3ca956"/><file name="gender.phtml" hash="c8428e9b76db957a866cfc109d7a0c09"/><file name="notifications.phtml" hash="485d9f8e90ca6ff3c8152d2c3a0ee138"/><file name="paymentplan_information.phtml" hash="8f28c418c08df3e664744ef28bc283c3"/><file name="pclass.phtml" hash="848a7e485badbdf11d10628c93906b21"/><file name="personalnumber.phtml" hash="a8d723a0ff1b71f07ccdd1aed1dba5fb"/><file name="phonenumber.phtml" hash="6348b12795e073d8881ab0b74d7df175"/></dir><file name="invoice.phtml" hash="43a3a4aaae78b3a835c8de7d9edff8b4"/><dir name="paymentplan"><file name="information.phtml" hash="d19f6766d1bebdacb367aee65edb06fd"/></dir><file name="special.phtml" hash="68561f42f556c496fb46c2c12f35b410"/></dir><dir name="info"><file name="account.phtml" hash="a848c9544a5e400bc27e26d050eafa3c"/><file name="checkout.phtml" hash="1364aae5f0b71233e215e8a1c40ea7f7"/><dir name="children"><file name="invoicefee.phtml" hash="c6b4ccff75e220c5641a8fadd6753131"/><file name="invoices.phtml" hash="cbdd0256b8e1d742257bcba9b1eef67a"/><file name="paymentplan.phtml" hash="3a73d918dc733c0888f18e442f9eb64c"/><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="autofill.phtml" hash="6bdd6c22fd1771106f52876e66d7f4de"/><dir name="cart"><dir name="item"><file name="default.phtml" hash="3d7c79cb13703b9cffe190fe6947306f"/></dir><file name="totals.phtml" hash="73b2c41c796fbf542c1f52ba99d131c4"/></dir><file name="cart.phtml" hash="c1c367cda021a53fb57029642803a03f"/><dir name="customer"><file name="balance.phtml" hash="af890728b26b0808c299ab199bc5f4c0"/></dir><dir name="discount"><file name="coupon.phtml" hash="35ccd00c06e448b900577f40ba360af0"/><file name="giftcardaccount.phtml" hash="8895e32abbc97d84fce366221637a1d9"/></dir><file name="discount.phtml" hash="04c4a517d0fbeae72aec9d2dd0fac84e"/><file name="header.phtml" hash="a0125224ad2b46b8348d81c308e92ee7"/><file name="klarnacheckout.phtml" hash="e5ad0ae7db7cb7279220de4e2b1453c7"/><file name="msg.phtml" hash="292efb0ca5a1b70204fb383ab4d4173e"/><file name="newsletter.phtml" hash="8c26bd84bc690c1aa0172c063dae99f8"/><file name="othermethod.phtml" hash="7fe13acf83fe1f0b5624414bbef4a566"/><file name="reward.phtml" hash="1aecb7c2b7e154d47e2c4add8b79e1ee"/><dir name="shipping_method"><file name="available.phtml" hash="a441651173fda6ec78742e4fcb859b97"/></dir><file name="shipping_method.phtml" hash="56f31b29cbf65527eeea8d919a085a78"/><file name="success.phtml" hash="b1f276ce825e09d472aef29d631ddf7b"/></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="69faf96ad13d2d4a5c9dcd30fb60bd6c"/></dir><dir name="de_AT"><file name="Vaimo_Klarna.csv" hash="86ec4e92f26cc28e2bbe3efaf7896e1d"/></dir><dir name="de_DE"><file name="Vaimo_Klarna.csv" hash="1e167c02c49a79fb0834a49ae2b6deb6"/></dir><dir name="fi_FI"><file name="Vaimo_Klarna.csv" hash="b63b5a2176896b24494e7e84434597b5"/></dir><dir name="nb_NO"><file name="Vaimo_Klarna.csv" hash="f1722434ccb02247c8326574b4ce61e8"/></dir><dir name="nl_NL"><file name="Vaimo_Klarna.csv" hash="ae931192108a1bafadce32363e8c2792"/></dir><dir name="nn_NO"><file name="Vaimo_Klarna.csv" hash="fc847790589c737f8c8362e57754184e"/></dir><dir name="sv_SE"><file name="Vaimo_Klarna.csv" hash="da59083e4dd7f1ca7b8499ff1635d95c"/></dir></target><target name="mage"><dir name="js"><dir name="vaimo"><dir name="klarna"><file name="klarna.js" hash="0b4cd9d9238833d4d8783e3265c1b87a"/><file name="klarnacheckout.js" hash="ff6e3b5db706ffa4c90c764696983969"/></dir></dir></dir></target><target name="magelib"><dir name="Klarna"><file name="CHANGELOG" hash="7c2deef157ef77304e1d0efc970d6c48"/><file name="Changelog-Vaimo.txt" hash="e4dd5098593f2c52ae0bffa0fda2cd09"/><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="Country.php" hash="40360c3964fc6193e7fb922845eb419b"/><file name="Currency.php" hash="a709407428d86521cc0775cbeb281523"/><file name="Encoding.php" hash="f8f8e744303ff7ce7f4b226331e7bdcf"/><file name="Exceptions.php" hash="933b2811e910da817743766cdde8ffeb"/><file name="Flags.php" hash="b407a1373adf5f172bef3e3d01e81cdb"/><file name="Klarna.php" hash="36e5956a0eeb94c7ba1871d0bd8b9973"/><file name="Language.php" hash="8e40aed0dece8f0a3fbe07e37451af16"/><dir name="checkoutkpm"><file name="checkouthtml.intf.php" hash="81e0740254585f2af67895df28093d35"/><file name="threatmetrix.class.php" hash="6ce1bfded90b6b3bb329176ff4c7acac"/></dir><dir name="examples"><file name="activate.php" hash="b49a0bd5c5a57577b9765d657dad7b78"/><file name="activateInvoice.php" hash="31061b3cf79a6fd32f580f3aa6b603ad"/><file name="activatePart.php" hash="72af1ee8d312df08e24cdc7b01cc72ed"/><file name="activateReservation.php" hash="6380e346db2466a655df17cbe4078b3a"/><file name="addTransaction.php" hash="015cdd7663d7bbe0716f8ed8f700e13e"/><file name="calc_monthly_cost.php" hash="9a45009fe051f76bd2d23db854f67cad"/><file name="cancelReservation.php" hash="219504c253caa372f479af8f6bf452eb"/><file name="changeReservation.php" hash="cdf4f971d74570e2ba9191792f69bf79"/><file name="checkOrderStatus.php" hash="b9d12df62f9619cb791bc4db9b2e19c4"/><file name="creditInvoice.php" hash="f174d28d812f5139c4a0397a27f419d9"/><file name="creditPart.php" hash="4c1a6397eb2bc7ee0bac5ed1a76aa7d8"/><file name="deleteInvoice.php" hash="b59be611d1ba7439d0c9ec43f38e8f95"/><file name="emailInvoice.php" hash="31f644dc6b1a97181d3ba474f2d77517"/><file name="fetchPClasses.php" hash="18a60ab1bde9ace0765c58f3343c4165"/><file name="getAddresses.php" hash="bf80e3108d51dcf4c581bff291e4a2fc"/><file name="getPClasses.php" hash="18b7bc054ceb36c8f004d21804fea832"/><file name="invoiceAddress.php" hash="a7a9c89f6ee017d72f9d9d5a959c7416"/><file name="invoiceAmount.php" hash="d404dba99dd5efd2954bec58eab720ca"/><file name="invoicePartAmount.php" hash="37e3726190f1fb403fbba19de2088dd5"/><file name="reserveAmount.php" hash="4c93a455264dafc93a2cd9ce41c8aaaa"/><file name="reserveOCR.php" hash="a67258e40b080027c5e60490a15d3347"/><file name="returnAmount.php" hash="ae01bab7225bdd6529593d499247e8f6"/><file name="sendInvoice.php" hash="46584ac7995d779ff4fa2a4a4b109df9"/><file name="splitReservation.php" hash="35c495a8bfc1e29b109a0de3800d4d44"/><file name="update.php" hash="1275db160660e97a6eb1328cf1f9c6b4"/><file name="updateChargeAmount.php" hash="ae4cf8072078cc8e527b786ea03a8337"/><file name="updateGoodsQty.php" hash="6e10c98895fe94f842ee45673ec790b3"/><file name="updateOrderNo.php" hash="e9d7a59d10b4be660b2cfd700ecc992d"/></dir><file name="klarnaaddr.php" hash="b090d4b0a819fdb7cc58815a8643de18"/><file name="klarnacalc.php" hash="3ab728bf3889240b881f282122fd25fd"/><file name="klarnaconfig.php" hash="a3a4011dccda60fcf3567f56254699ff"/><file name="klarnapclass.php" hash="26a8fd1df0806788f6719cb894787f76"/><dir name="pclasses"><file name="jsonstorage.class.php" hash="e59e526d9dcc17d1ca92ded188750672"/><file name="mysqlstorage.class.php" hash="896a5cd4edf461ef517e0bb2e328707b"/><file name="sqlstorage.class.php" hash="bb7ba4359e7e69424c9f0ecdafc0c9ae"/><file name="storage.intf.php" hash="26db57484b6db3d717c0150ffaa87b19"/><file name="xmlstorage.class.php" hash="4f13939bf8d73f2724f858dd17f219de"/></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="4cbeefa920f8d31181e030aeff997bad"/><file name="checkout_osc.css" hash="61f85446731eb80de0a592897e87cd21"/><file name="global.css" hash="22b6a446e6e874e6a95608f7046eac2a"/><file name="klarnacheckout.css" hash="c4e9dcdf5be333fb5a959ff400484ac1"/><file name="product.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></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="198afd117e90e17999f24c419a92b24b"/></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="67210e5d92b4dc33c729759f47a2cf24"/></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="8fc62f56116522ba14b6759985231244"/><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="586393b00cd2c57ed6d53b8b50a8a535"/><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="9bfabd568384b14c70175218f62fab9a"/><dir name="Customer"><file name="Balance.php" hash="e35153845d979d91ff79d0558e7b6c0b"/></dir><file name="Discount.php" hash="d0470865220ff0cd09e5f2daf33f372f"/><file name="Ga.php" hash="c74dd6174899a65d61bd0abeefb6ae6b"/><file name="Klarnacheckout.php" hash="5780da78ea75efd34ca0db1d4f0705fa"/><file name="Newsletter.php" hash="ce97e11c097b0cd9696919936fa59dc6"/><file name="Othermethod.php" hash="a31bc678ce541f8eea1d043801c13974"/><file name="Reward.php" hash="98d72b6cf65070dcb4cc87a303cd8b54"/><file name="Success.php" hash="8b04804a106bae8dabb7f0d93fa33e2d"/></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><dir name="controllers"><file name="AddressController.php" hash="e3272d6463e7ea0082c249924c31e34b"/><dir name="Adminhtml"><dir name="Klarna"><file name="PclassController.php" hash="80dc9c19549ce161e50484e57c600b0c"/></dir></dir><dir name="Checkout"><file name="KlarnaController.php" hash="bff463d2262cbe7c28bd685357b9af59"/></dir><file name="PaymentplanController.php" hash="fea9d33a5dbd5d4858ef174569dae636"/></dir><dir name="etc"><file name="config.xml" hash="5c5894fe9a4c5d39060be598566affee"/><file name="system.xml" hash="8232ea11eecb1c84817883f682318f31"/></dir><dir name="Helper"><file name="Data.php" hash="4d8ac90de2d8374193e0c7b6265742bf"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="b3057bd602fda03cce6fc420c495673b"/><file name="Kco.php" hash="e17c83b2e915131bc9a79c42dda6a67e"/><file name="Rest.php" hash="553ef171cb17e5399e97a7dd30c3757a"/><file name="Xmlrpc.php" hash="035d10f930efedad724ef17180871824"/></dir><file name="Api.php" hash="5c3f199a2fb6a8d733bd9c8d8996791e"/><dir name="Creditmemo"><file name="Tax.php" hash="c3d5162de38f5ef2075bca483085e5d0"/><file name="Total.php" hash="0f9b9298c35f2e69b141d1197bb593a5"/></dir><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="06412f97df9ac6a1854978b61f68fb36"/></dir><file name="Tax.php" hash="ff4c665fade58265440f21f00e577932"/><file name="Total.php" hash="3e89c7d9e9be6cc481b140a0bcc543b6"/></dir><dir name="Klarna"><file name="Abstract.php" hash="0c2a3aaa1de1e938b85cd8cd1a419768"/></dir><file name="Klarna.php" hash="3dc634a89bfeb8c14c2494b6297f5f60"/><dir name="Klarnacheckout"><file name="Abstract.php" hash="ae4c167242096aec289ddcc339469853"/></dir><file name="Klarnacheckout.php" hash="f5a5a1189433e29e1031110067699a03"/><file name="Observer.php" hash="b76c1d29a35eb98a083840d53ae461ff"/><dir name="Payment"><file name="Abstract.php" hash="036a09c1b4c9ad57c2d348940bd14403"/><file name="Account.php" hash="184c3b627b2355490058463c5c8452df"/><file name="Checkout.php" hash="83e6c060effd7c99aca28754926fa70d"/><file name="Invoice.php" hash="8db24d7cddfd3166257ab1de3159efbd"/><file name="Special.php" hash="bd11a7c3aad411dbff20b62d7b522f4d"/></dir><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><dir name="Source"><file name="Abstract.php" hash="8d0d746d1cd2e5bc7d11350908a01585"/><file name="Allspecificcountries.php" hash="1a98316e25baeaba307b3be62364e1ca"/><file name="Apiversion.php" hash="536c62f5022aec99d71f68e1118c0d99"/><file name="Capture.php" hash="c2d31ebb607202555e9905e439dbe86d"/><file name="Country.php" hash="2444140a6155e42d2e4909ae150037b7"/><file name="Customergroup.php" hash="01c6e41abac6e7105e4d290f53f68733"/><file name="Language.php" hash="efe69e0132b87242d2fbf08b2f8febe1"/><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="2e404635744d99c769d465592658e0b2"/></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"/></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.2.2</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>2014-12-23</date>
14
+ <time>09:31:51</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="6c35211c76987e619b51f6b6f06b0707"/><dir name="children"><file name="invoicefee.phtml" hash="2b721be479706716f6468c8395455fa5"/><file name="invoices.phtml" hash="ac4e3bd4aea83e9ea3479fc04ed0d5a4"/><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="3ddb8e805772c96d1833961df13a78eb"/></dir><dir name="template"><dir name="vaimo"><dir name="klarna"><dir name="catalog"><dir name="product"><file name="pricewidget.phtml" hash="f5838b8bb129634487a398ca2557f48b"/></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="78ec2685231b4664ec9106be2fb1b847"/><dir name="address"><file name="search.phtml" hash="42c4fa161e9f6870bba41971c865cf34"/></dir><file name="checkout.phtml" hash="fe86056c73f86d53a73ebda5c5f3547c"/><dir name="children"><file name="addressresult.phtml" hash="7ed16bca431a8146139ce51fd7001d11"/><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="485d9f8e90ca6ff3c8152d2c3a0ee138"/><file name="paymentplan_information.phtml" hash="8f28c418c08df3e664744ef28bc283c3"/><file name="pclass.phtml" hash="848a7e485badbdf11d10628c93906b21"/><file name="personalnumber.phtml" hash="a8d723a0ff1b71f07ccdd1aed1dba5fb"/><file name="phonenumber.phtml" hash="6348b12795e073d8881ab0b74d7df175"/></dir><file name="invoice.phtml" hash="96495650061287f034fd789a372359a2"/><dir name="paymentplan"><file name="information.phtml" hash="d19f6766d1bebdacb367aee65edb06fd"/></dir><file name="special.phtml" hash="a81e468c29aff1c020cde8d9b3b1f223"/></dir><dir name="info"><file name="account.phtml" hash="a848c9544a5e400bc27e26d050eafa3c"/><file name="checkout.phtml" hash="1364aae5f0b71233e215e8a1c40ea7f7"/><dir name="children"><file name="invoicefee.phtml" hash="c6b4ccff75e220c5641a8fadd6753131"/><file name="invoices.phtml" hash="cbdd0256b8e1d742257bcba9b1eef67a"/><file name="paymentplan.phtml" hash="3a73d918dc733c0888f18e442f9eb64c"/><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="autofill.phtml" hash="6bdd6c22fd1771106f52876e66d7f4de"/><dir name="cart"><dir name="item"><file name="default.phtml" hash="3d7c79cb13703b9cffe190fe6947306f"/></dir><file name="totals.phtml" hash="73b2c41c796fbf542c1f52ba99d131c4"/></dir><file name="cart.phtml" hash="c1c367cda021a53fb57029642803a03f"/><dir name="customer"><file name="balance.phtml" hash="af890728b26b0808c299ab199bc5f4c0"/></dir><dir name="discount"><file name="coupon.phtml" hash="35ccd00c06e448b900577f40ba360af0"/><file name="giftcardaccount.phtml" hash="8895e32abbc97d84fce366221637a1d9"/></dir><file name="discount.phtml" hash="04c4a517d0fbeae72aec9d2dd0fac84e"/><file name="header.phtml" hash="a0125224ad2b46b8348d81c308e92ee7"/><file name="klarnacheckout.phtml" hash="e5ad0ae7db7cb7279220de4e2b1453c7"/><file name="msg.phtml" hash="292efb0ca5a1b70204fb383ab4d4173e"/><file name="newsletter.phtml" hash="8c26bd84bc690c1aa0172c063dae99f8"/><file name="othermethod.phtml" hash="7fe13acf83fe1f0b5624414bbef4a566"/><file name="reward.phtml" hash="1aecb7c2b7e154d47e2c4add8b79e1ee"/><dir name="shipping_method"><file name="available.phtml" hash="a441651173fda6ec78742e4fcb859b97"/></dir><file name="shipping_method.phtml" hash="56f31b29cbf65527eeea8d919a085a78"/><file name="success.phtml" hash="b1f276ce825e09d472aef29d631ddf7b"/></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="69faf96ad13d2d4a5c9dcd30fb60bd6c"/></dir><dir name="de_AT"><file name="Vaimo_Klarna.csv" hash="86ec4e92f26cc28e2bbe3efaf7896e1d"/></dir><dir name="de_DE"><file name="Vaimo_Klarna.csv" hash="1e167c02c49a79fb0834a49ae2b6deb6"/></dir><dir name="fi_FI"><file name="Vaimo_Klarna.csv" hash="b63b5a2176896b24494e7e84434597b5"/></dir><dir name="nb_NO"><file name="Vaimo_Klarna.csv" hash="f1722434ccb02247c8326574b4ce61e8"/></dir><dir name="nl_NL"><file name="Vaimo_Klarna.csv" hash="ae931192108a1bafadce32363e8c2792"/></dir><dir name="nn_NO"><file name="Vaimo_Klarna.csv" hash="fc847790589c737f8c8362e57754184e"/></dir><dir name="sv_SE"><file name="Vaimo_Klarna.csv" hash="da59083e4dd7f1ca7b8499ff1635d95c"/></dir></target><target name="mage"><dir name="js"><dir name="vaimo"><dir name="klarna"><file name="klarna.js" hash="73b2c9b9eaddb71569c61b2896f44f17"/><file name="klarnacheckout.js" hash="ff6e3b5db706ffa4c90c764696983969"/></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="849fa477cb91df3a0156e6c5f62c4aea"/><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="a06b5b32be043a091631eb27591b063d"/><file name="checkout_osc.css" hash="029bf44cbf11e8c061df2e6011e1741c"/><file name="global.css" hash="22b6a446e6e874e6a95608f7046eac2a"/><file name="klarnacheckout.css" hash="c4e9dcdf5be333fb5a959ff400484ac1"/><file name="product.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></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="198afd117e90e17999f24c419a92b24b"/></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="540d01d9f335dc7c92fb286c3312e6d8"/></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="23e5478851b02c8439ca2eca76938ad8"/><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="586393b00cd2c57ed6d53b8b50a8a535"/><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="9bfabd568384b14c70175218f62fab9a"/><dir name="Customer"><file name="Balance.php" hash="e35153845d979d91ff79d0558e7b6c0b"/></dir><file name="Discount.php" hash="d56512c70315f0ad2ee1f8b857f30c78"/><file name="Ga.php" hash="c74dd6174899a65d61bd0abeefb6ae6b"/><file name="Klarnacheckout.php" hash="5780da78ea75efd34ca0db1d4f0705fa"/><file name="Newsletter.php" hash="ce97e11c097b0cd9696919936fa59dc6"/><file name="Othermethod.php" hash="a31bc678ce541f8eea1d043801c13974"/><file name="Reward.php" hash="98d72b6cf65070dcb4cc87a303cd8b54"/><file name="Success.php" hash="8b04804a106bae8dabb7f0d93fa33e2d"/></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="b2d6ab863caa8498d8f067a949cd67be"/></dir></dir><file name="Position.php" hash="8e48499e9f0604019e0d0d0584f12986"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AddressController.php" hash="e3272d6463e7ea0082c249924c31e34b"/><dir name="Adminhtml"><dir name="Klarna"><file name="PclassController.php" hash="80dc9c19549ce161e50484e57c600b0c"/></dir></dir><dir name="Checkout"><file name="KlarnaController.php" hash="ed5fea690e903c098fc4d790a33cb17a"/></dir><file name="PaymentplanController.php" hash="fea9d33a5dbd5d4858ef174569dae636"/></dir><dir name="etc"><file name="config.xml" hash="26d07b372f0b3c0e1ea13fd6cbe6112a"/><file name="system.xml" hash="2ac428266617b2ddf7060dcf9613386f"/></dir><dir name="Helper"><file name="Data.php" hash="07df51560875d1d493d15c4f4b28d60f"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="1659c0bf5ef7b788f4f92ffc4309b4a4"/><file name="Kco.php" hash="7e32f2302598d55efcd50f5f9a23dbed"/><file name="Rest.php" hash="bdb67d8b170083478e2f09019cea3377"/><file name="Xmlrpc.php" hash="38100fde96e09193158bc2b000eb251a"/></dir><file name="Api.php" hash="5c3f199a2fb6a8d733bd9c8d8996791e"/><dir name="Creditmemo"><file name="Tax.php" hash="c3d5162de38f5ef2075bca483085e5d0"/><file name="Total.php" hash="0f9b9298c35f2e69b141d1197bb593a5"/></dir><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="06412f97df9ac6a1854978b61f68fb36"/></dir><file name="Tax.php" hash="ff4c665fade58265440f21f00e577932"/><file name="Total.php" hash="3e89c7d9e9be6cc481b140a0bcc543b6"/></dir><dir name="Klarna"><file name="Abstract.php" hash="dacacc36fc5129281ec3635be9d6e2d2"/></dir><file name="Klarna.php" hash="46d1ed5cf99969dd96d27ee1d0573be7"/><dir name="Klarnacheckout"><file name="Abstract.php" hash="ae4c167242096aec289ddcc339469853"/></dir><file name="Klarnacheckout.php" hash="f5a5a1189433e29e1031110067699a03"/><file name="Observer.php" hash="09c144909ed6c372495edab084f7e913"/><dir name="Payment"><file name="Abstract.php" hash="9edabeefa773ab7645e18646ef87a16e"/><file name="Account.php" hash="184c3b627b2355490058463c5c8452df"/><file name="Checkout.php" hash="83e6c060effd7c99aca28754926fa70d"/><file name="Invoice.php" hash="8db24d7cddfd3166257ab1de3159efbd"/><file name="Special.php" hash="bd11a7c3aad411dbff20b62d7b522f4d"/></dir><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><dir name="Source"><file name="Abstract.php" hash="8d0d746d1cd2e5bc7d11350908a01585"/><file name="Allspecificcountries.php" hash="1a98316e25baeaba307b3be62364e1ca"/><file name="Apiversion.php" hash="536c62f5022aec99d71f68e1118c0d99"/><file name="Capture.php" hash="c2d31ebb607202555e9905e439dbe86d"/><file name="Country.php" hash="2444140a6155e42d2e4909ae150037b7"/><file name="Customergroup.php" hash="01c6e41abac6e7105e4d290f53f68733"/><file name="Language.php" hash="efe69e0132b87242d2fbf08b2f8febe1"/><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="7231d7915ce6c54ee2320cea73784637"/></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"/></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
@@ -43,7 +43,7 @@ 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: 20px;
47
  }
48
 
49
  .payment_plan_wrapper {
@@ -55,25 +55,27 @@ ul#payment_form_vaimo_klarna_special {
55
  }
56
 
57
  .sp-methods .form-list li.payment_plan_info_wrapper {
58
- margin: 20px 10px 10px 30px;
59
  float: left;
60
  padding: 10px;
61
- background-color: #FFF;
 
62
  }
63
 
64
  .sp-methods .form-list li.payment_plan_info_wrapper .payment_plan_details dt {
65
  float: left;
66
  clear: both;
67
  margin: 0px 10px 3px 0px;
68
- min-width: 100px;
 
69
  font-weight: normal;
70
- font-size: 10px;
71
  }
72
 
73
  .sp-methods .form-list li.payment_plan_info_wrapper .payment_plan_details dd {
74
- float: left;
75
  font-weight: normal;
76
- font-size: 10px;
77
  }
78
 
79
  .sp-methods .form-list li.payment_plan_info_wrapper .payment_plan_details dd .price {
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 {
55
  }
56
 
57
  .sp-methods .form-list li.payment_plan_info_wrapper {
58
+ margin: 5px 10px 10px 30px;
59
  float: left;
60
  padding: 10px;
61
+ border: 1px solid #B6B6B6;
62
+ // background-color: #FFF;
63
  }
64
 
65
  .sp-methods .form-list li.payment_plan_info_wrapper .payment_plan_details dt {
66
  float: left;
67
  clear: both;
68
  margin: 0px 10px 3px 0px;
69
+ min-width: 200px;
70
+ max-width: 400px;
71
  font-weight: normal;
72
+ // font-size: 10px;
73
  }
74
 
75
  .sp-methods .form-list li.payment_plan_info_wrapper .payment_plan_details dd {
76
+ float: right;
77
  font-weight: normal;
78
+ // font-size: 10px;
79
  }
80
 
81
  .sp-methods .form-list li.payment_plan_info_wrapper .payment_plan_details dd .price {
skin/frontend/base/default/css/vaimo/klarna/checkout_osc.css CHANGED
@@ -69,7 +69,7 @@ ul#payment_form_vaimo_klarna_special {
69
  }
70
 
71
  .payment-method .form-list li.payment_plan_info_wrapper .payment_plan_details dd {
72
- float: left;
73
  font-weight: normal;
74
  font-size: 10px;
75
  }
69
  }
70
 
71
  .payment-method .form-list li.payment_plan_info_wrapper .payment_plan_details dd {
72
+ float: right;
73
  font-weight: normal;
74
  font-size: 10px;
75
  }