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.3.1 |
Comparing to | |
See all releases |
Code changes from version 5.2.16 to 5.3.1
- app/code/community/Vaimo/Klarna/Block/Klarnacheckout/Othermethod.php +8 -2
- app/code/community/Vaimo/Klarna/Helper/Data.php +3 -0
- app/code/community/Vaimo/Klarna/Model/Api/Kco.php +55 -29
- app/code/community/Vaimo/Klarna/Model/Api/Rest.php +236 -126
- app/code/community/Vaimo/Klarna/Model/Klarnacheckout.php +128 -61
- app/code/community/Vaimo/Klarna/Model/Observer.php +27 -3
- app/code/community/Vaimo/Klarna/controllers/Checkout/KlarnaController.php +99 -29
- app/code/community/Vaimo/Klarna/controllers/LoginController.php +1 -0
- app/code/community/Vaimo/Klarna/etc/config.xml +10 -2
- app/code/community/Vaimo/Klarna/etc/system.xml +32 -4
- app/design/frontend/base/default/template/vaimo/klarna/catalog/product/pricewidget.phtml +1 -2
- app/design/frontend/base/default/template/vaimo/klarna/klarnacheckout/account-login.phtml +1 -1
- app/design/frontend/base/default/template/vaimo/klarna/klarnacheckout/othermethod.phtml +3 -2
- js/vaimo/klarna/klarnacheckout.js +188 -429
- js/vaimo/klarna/klarnautils.js +310 -31
- package.xml +4 -4
- skin/frontend/base/default/css/vaimo/klarna/product.css +4 -0
app/code/community/Vaimo/Klarna/Block/Klarnacheckout/Othermethod.php
CHANGED
@@ -91,12 +91,18 @@ class Vaimo_Klarna_Block_Klarnacheckout_Othermethod extends Mage_Core_Block_Temp
|
|
91 |
* Should not have been in here, but didn't want to create a new block for this one
|
92 |
* function. So I added it here instead, as it's being loaded at the same time...
|
93 |
*/
|
94 |
-
public function
|
95 |
{
|
96 |
try {
|
97 |
$klarna = Mage::getModel('klarna/klarnacheckout');
|
98 |
$klarna->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
} catch (Exception $e) {
|
101 |
$res = false;
|
102 |
}
|
91 |
* Should not have been in here, but didn't want to create a new block for this one
|
92 |
* function. So I added it here instead, as it's being loaded at the same time...
|
93 |
*/
|
94 |
+
public function triggerChangedJSInputId()
|
95 |
{
|
96 |
try {
|
97 |
$klarna = Mage::getModel('klarna/klarnacheckout');
|
98 |
$klarna->setQuote($this->getQuote(), Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
99 |
+
if ($klarna->getConfigData('enable_trigger_changed_js')) {
|
100 |
+
if ($klarna->getConfigData('enable_postcode_update')) {
|
101 |
+
$res = 'klarna-checkout-shipping-update-postcode';
|
102 |
+
} else {
|
103 |
+
$res = 'klarna-checkout-shipping-update';
|
104 |
+
}
|
105 |
+
}
|
106 |
} catch (Exception $e) {
|
107 |
$res = false;
|
108 |
}
|
app/code/community/Vaimo/Klarna/Helper/Data.php
CHANGED
@@ -183,6 +183,9 @@ class Vaimo_Klarna_Helper_Data extends Mage_Core_Helper_Abstract
|
|
183 |
|
184 |
const KLARNA_CHECKOUT_ALLOW_ALL_GROUP_ID = 99;
|
185 |
|
|
|
|
|
|
|
186 |
const ENCODING_MAGENTO = 'UTF-8';
|
187 |
const ENCODING_KLARNA = 'ISO-8859-1';
|
188 |
|
183 |
|
184 |
const KLARNA_CHECKOUT_ALLOW_ALL_GROUP_ID = 99;
|
185 |
|
186 |
+
const KLARNA_DISPATCH_VALIDATE = 'vaimo_klarna_validate_cart';
|
187 |
+
const KLARNA_VALIDATE_ERRORS = 'klarna_validate_errors';
|
188 |
+
|
189 |
const ENCODING_MAGENTO = 'UTF-8';
|
190 |
const ENCODING_KLARNA = 'ISO-8859-1';
|
191 |
|
app/code/community/Vaimo/Klarna/Model/Api/Kco.php
CHANGED
@@ -252,12 +252,14 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
|
|
252 |
|
253 |
$create['merchant']['push_uri'] = $pushUrl;
|
254 |
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
$
|
|
|
|
|
261 |
}
|
262 |
|
263 |
$create['cart']['items'] = $this->_getCartItems();
|
@@ -310,12 +312,21 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
|
|
310 |
/** @var $session Mage_Customer_Model_Session */
|
311 |
$session = Mage::getSingleton('customer/session');
|
312 |
if ($session->isLoggedIn()) {
|
|
|
313 |
$address = $session->getCustomer()->getPrimaryBillingAddress();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
if ($this->_getTransport()->moreDetailsToKCORequest()) {
|
315 |
if ($address &&
|
316 |
-
( preg_match('/^([^\d]*[^\d\s]) *(\d.*)$/', $address->getStreet(1), $
|
317 |
-
$streetName = $
|
318 |
-
$streetNumber = $
|
319 |
}
|
320 |
|
321 |
if ($gender = $session->getCustomer()->getGender()) {
|
@@ -328,24 +339,32 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
|
|
328 |
break;
|
329 |
}
|
330 |
}
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
'
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
}
|
350 |
return $result;
|
351 |
}
|
@@ -430,7 +449,8 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
|
|
430 |
if ($checkoutId) {
|
431 |
$this->_klarnaOrder = new Klarna_Checkout_Order($this->_getConnector(), Klarna_Checkout_Order::$baseUri . '/' . $checkoutId);
|
432 |
$this->_klarnaOrder->fetch();
|
433 |
-
|
|
|
434 |
}
|
435 |
return NULL;
|
436 |
}
|
@@ -507,6 +527,11 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
|
|
507 |
return false;
|
508 |
}
|
509 |
|
|
|
|
|
|
|
|
|
|
|
510 |
/*
|
511 |
* Not happy with this, but I guess we can't solve it in other ways.
|
512 |
*
|
@@ -552,8 +577,9 @@ class Vaimo_Klarna_Model_Api_Kco extends Vaimo_Klarna_Model_Api_Abstract
|
|
552 |
return NULL;
|
553 |
}
|
554 |
|
555 |
-
public function
|
556 |
{
|
|
|
557 |
if ($this->_klarnaOrder) {
|
558 |
$order = new Varien_Object($this->_klarnaOrder->marshal());
|
559 |
if ($order) {
|
252 |
|
253 |
$create['merchant']['push_uri'] = $pushUrl;
|
254 |
|
255 |
+
if ($this->_getTransport()->getConfigData('enable_validation')) {
|
256 |
+
$validateUrl = Mage::getUrl('checkout/klarna/validate?klarna_order={checkout.order.id}', array('_nosid' => true));
|
257 |
+
if (substr($validateUrl, -1, 1) == '/') {
|
258 |
+
$validateUrl = substr($validateUrl, 0, strlen($validateUrl) - 1);
|
259 |
+
}
|
260 |
+
if (substr($validateUrl, 0, 5) == 'https') {
|
261 |
+
$create['merchant']['validation_uri'] = $validateUrl;
|
262 |
+
}
|
263 |
}
|
264 |
|
265 |
$create['cart']['items'] = $this->_getCartItems();
|
312 |
/** @var $session Mage_Customer_Model_Session */
|
313 |
$session = Mage::getSingleton('customer/session');
|
314 |
if ($session->isLoggedIn()) {
|
315 |
+
$result = array();
|
316 |
$address = $session->getCustomer()->getPrimaryBillingAddress();
|
317 |
+
if ($session->getCustomer()->getEmail()) {
|
318 |
+
$result['email'] = $session->getCustomer()->getEmail();
|
319 |
+
}
|
320 |
+
if ($address) {
|
321 |
+
if ($address->getPostcode()) {
|
322 |
+
$result['postal_code'] = $address->getPostcode();
|
323 |
+
}
|
324 |
+
}
|
325 |
if ($this->_getTransport()->moreDetailsToKCORequest()) {
|
326 |
if ($address &&
|
327 |
+
( preg_match('/^([^\d]*[^\d\s]) *(\d.*)$/', $address->getStreet(1), $tmp) )) {
|
328 |
+
$streetName = $tmp[1];
|
329 |
+
$streetNumber = $tmp[2];
|
330 |
}
|
331 |
|
332 |
if ($gender = $session->getCustomer()->getGender()) {
|
339 |
break;
|
340 |
}
|
341 |
}
|
342 |
+
if ($streetName) {
|
343 |
+
$result['street_name'] = $streetName;
|
344 |
+
}
|
345 |
+
if ($streetNumber) {
|
346 |
+
$result['street_number'] = $streetNumber;
|
347 |
+
}
|
348 |
+
if ($address) {
|
349 |
+
if ($address->getFirstname()) {
|
350 |
+
$result['given_name'] = $address->getFirstname();
|
351 |
+
}
|
352 |
+
if ($address->getLastname()) {
|
353 |
+
$result['family_name'] = $address->getLastname();
|
354 |
+
}
|
355 |
+
if ($address->getCity()) {
|
356 |
+
$result['city'] = $address->getCity();
|
357 |
+
}
|
358 |
+
if ($address->getTelephone()) {
|
359 |
+
$result['phone'] = $address->getTelephone();
|
360 |
+
}
|
361 |
+
if ($address->getCountryId()) {
|
362 |
+
$result['country'] = $address->getCountryId();
|
363 |
+
}
|
364 |
+
if ($gender) {
|
365 |
+
$result['title'] = $gender;
|
366 |
+
}
|
367 |
+
}
|
368 |
}
|
369 |
return $result;
|
370 |
}
|
449 |
if ($checkoutId) {
|
450 |
$this->_klarnaOrder = new Klarna_Checkout_Order($this->_getConnector(), Klarna_Checkout_Order::$baseUri . '/' . $checkoutId);
|
451 |
$this->_klarnaOrder->fetch();
|
452 |
+
$order = new Varien_Object($this->_klarnaOrder->marshal());
|
453 |
+
return $order;
|
454 |
}
|
455 |
return NULL;
|
456 |
}
|
527 |
return false;
|
528 |
}
|
529 |
|
530 |
+
public function prepareTaxAndShippingReply()
|
531 |
+
{
|
532 |
+
return '';
|
533 |
+
}
|
534 |
+
|
535 |
/*
|
536 |
* Not happy with this, but I guess we can't solve it in other ways.
|
537 |
*
|
577 |
return NULL;
|
578 |
}
|
579 |
|
580 |
+
public function fetchCreatedOrder($checkoutId)
|
581 |
{
|
582 |
+
$this->initKlarnaOrder($checkoutId);
|
583 |
if ($this->_klarnaOrder) {
|
584 |
$order = new Varien_Object($this->_klarnaOrder->marshal());
|
585 |
if ($order) {
|
app/code/community/Vaimo/Klarna/Model/Api/Rest.php
CHANGED
@@ -46,17 +46,22 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
46 |
return $this;
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
public function init($klarnaSetup)
|
50 |
{
|
51 |
$this->_klarnaSetup = $klarnaSetup;
|
52 |
if ($this->_klarnaSetup->getHost() == 'BETA') {
|
53 |
-
if ($this->
|
54 |
$this->_url = 'https://api-na.playground.klarna.com';
|
55 |
} else {
|
56 |
$this->_url = 'https://api.playground.klarna.com';
|
57 |
}
|
58 |
} else {
|
59 |
-
if ($this->
|
60 |
$this->_url = 'https://api-na.klarna.com';
|
61 |
} else {
|
62 |
$this->_url = 'https://api.klarna.com';
|
@@ -94,31 +99,62 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
94 |
return $res;
|
95 |
}
|
96 |
|
97 |
-
protected function
|
98 |
{
|
99 |
if (!$this->_getTransport()->getConfigData('auto_prefil')) return NULL;
|
|
|
|
|
100 |
|
101 |
/** @var $session Mage_Customer_Model_Session */
|
102 |
-
|
103 |
-
|
104 |
-
$
|
105 |
-
$
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
if ($address->getRegionCode()) {
|
116 |
-
$
|
117 |
}
|
118 |
-
return $res;
|
119 |
}
|
120 |
-
|
121 |
-
return NULL;
|
122 |
}
|
123 |
|
124 |
protected function _getCustomerData()
|
@@ -170,10 +206,15 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
170 |
Mage::getSingleton('checkout/session')->setKlarnaCheckoutId($checkoutId);
|
171 |
}
|
172 |
|
173 |
-
protected function _getCartItems()
|
174 |
{
|
175 |
-
|
|
|
|
|
|
|
|
|
176 |
$items = array();
|
|
|
177 |
$calculator = Mage::getSingleton('tax/calculation');
|
178 |
|
179 |
foreach ($quote->getAllVisibleItems() as $quoteItem) {
|
@@ -182,44 +223,35 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
182 |
} else {
|
183 |
$taxRate = $quoteItem->getTaxAmount() / $quoteItem->getRowTotal() * 100;
|
184 |
}
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
'total_amount' => round($quoteItem->getRowTotalInclTax() * 100),
|
198 |
-
'total_tax_amount' => round($taxAmount * 100),
|
199 |
-
);
|
200 |
-
|
201 |
-
/*
|
202 |
-
if ($quoteItem->getTaxAmount() && $taxRate!=0) {
|
203 |
-
$taxAmount = $quoteItem->getTaxAmount();
|
204 |
-
$rowTotalInclTax = $quoteItem->getRowTotal() + $taxAmount;
|
205 |
} else {
|
206 |
-
$
|
207 |
-
$
|
208 |
}
|
209 |
-
// $priceInclTax = $quoteItem->getPriceInclTax();
|
210 |
-
$priceInclTax = round($rowTotalInclTax / $quoteItem->getQty(), 2);
|
211 |
$items[] = array(
|
212 |
'type' => 'physical',
|
213 |
'reference' => $quoteItem->getSku(),
|
214 |
'name' => $quoteItem->getName(),
|
215 |
'quantity' => round($quoteItem->getQty()),
|
216 |
'quantity_unit' => 'pcs',
|
217 |
-
'unit_price' => round($
|
|
|
|
|
218 |
'tax_rate' => round($taxRate * 100),
|
219 |
-
'total_amount' => round($
|
220 |
'total_tax_amount' => round($taxAmount * 100),
|
221 |
);
|
222 |
-
*/
|
223 |
}
|
224 |
|
225 |
foreach ($quote->getTotals() as $key => $total) {
|
@@ -235,16 +267,25 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
235 |
$amount = $amount - $taxAmount - $hiddenTaxAmount;
|
236 |
}
|
237 |
$taxRate = ($taxAmount + $hiddenTaxAmount) / $amount * 100;
|
238 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
$items[] = array(
|
240 |
'type' => 'shipping_fee',
|
241 |
'reference' => $total->getCode(),
|
242 |
'name' => $total->getTitle(),
|
243 |
'quantity' => 1,
|
244 |
-
'unit_price' => round(
|
245 |
'discount_rate' => 0,
|
246 |
'tax_rate' => round($taxRate * 100),
|
247 |
-
'total_amount' => round(
|
248 |
'total_tax_amount' => round($taxAmount * 100),
|
249 |
);
|
250 |
}
|
@@ -258,15 +299,25 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
258 |
$taxAmount = $total->getAddress()->getHiddenTaxAmount();
|
259 |
$amount = -$total->getAddress()->getDiscountAmount() - $taxAmount;
|
260 |
$taxRate = $taxAmount / $amount * 100;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
$items[] = array(
|
262 |
'type' => 'discount',
|
263 |
'reference' => $total->getCode(),
|
264 |
'name' => $total->getTitle(),
|
265 |
'quantity' => 1,
|
266 |
-
'unit_price' => -round(
|
267 |
'discount_rate' => 0,
|
268 |
'tax_rate' => round($taxRate * 100),
|
269 |
-
'total_amount' => -round(
|
270 |
'total_tax_amount' => -round($taxAmount * 100),
|
271 |
);
|
272 |
}
|
@@ -333,6 +384,30 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
333 |
break;
|
334 |
}
|
335 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
return $items;
|
338 |
}
|
@@ -360,7 +435,7 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
360 |
|
361 |
$this->_addUserDefinedVariables($create);
|
362 |
|
363 |
-
if ($data = $this->
|
364 |
$create['billing_address'] = $data;
|
365 |
}
|
366 |
|
@@ -373,49 +448,58 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
373 |
$create['order_lines'] = $this->_getCartItems();
|
374 |
|
375 |
foreach ($create['order_lines'] as $line) {
|
376 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
}
|
378 |
-
if ($this->
|
|
|
379 |
$shippingCountries = $this->_getTransport()->getConfigData('shipping_countries');
|
380 |
if ($shippingCountries) {
|
381 |
$create['shipping_countries'] = explode(',', $shippingCountries);
|
382 |
}
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
}
|
402 |
-
$
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
'
|
407 |
-
'
|
408 |
-
'tax_rate' => (int)($taxRate * 100) * 100,
|
409 |
-
'preselected' => $preSelected,
|
410 |
);
|
411 |
}
|
412 |
-
$address->setShippingMethod($originalShippingMethod);
|
413 |
-
$this->_getQuote()->setTotalsCollectedFlag(false)->collectTotals();
|
414 |
-
$create['shipping_options'] = $shippingOptions;
|
415 |
-
$create['selected_shipping_option'] = array(
|
416 |
-
'id' => $address->getShippingMethod(),
|
417 |
-
'name' => $address->getShippingDescription(),
|
418 |
-
);
|
419 |
}
|
420 |
|
421 |
$pushUrl = Mage::getUrl('checkout/klarna/push?klarna_order={checkout.order.id}', array('_nosid' => true));
|
@@ -428,15 +512,23 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
428 |
$create['merchant_urls']['confirmation'] = Mage::getUrl('checkout/klarna/success');
|
429 |
$create['merchant_urls']['push'] = $pushUrl;
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
$
|
|
|
|
|
437 |
}
|
438 |
-
if ($this->
|
439 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
}
|
441 |
|
442 |
Mage::helper('klarna')->logDebugInfo('_getCreateRequest rest', $create);
|
@@ -447,28 +539,28 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
447 |
return $request->getData();
|
448 |
}
|
449 |
|
450 |
-
|
451 |
{
|
452 |
$update = array();
|
453 |
|
454 |
-
if ($data = $this->
|
455 |
-
$update['
|
456 |
}
|
457 |
|
458 |
-
|
459 |
-
$update['customer'] = $data;
|
460 |
-
}
|
461 |
-
|
462 |
-
$update['order_amount'] = round($this->_getQuote()->getGrandTotal() * 100);
|
463 |
$update['order_tax_amount'] = 0;
|
464 |
-
$update['order_lines'] = $this->_getCartItems();
|
465 |
|
466 |
foreach ($update['order_lines'] as $line) {
|
467 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
}
|
469 |
|
470 |
-
Mage::helper('klarna')->logDebugInfo('_getUpdateRequest rest', $update);
|
471 |
-
|
472 |
$request = new Varien_Object($update);
|
473 |
Mage::dispatchEvent('klarnacheckout_get_update_request', array('request' => $request));
|
474 |
|
@@ -495,12 +587,12 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
495 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
496 |
curl_close($ch);
|
497 |
|
|
|
|
|
498 |
if ($status != 201) {
|
499 |
Mage::throwException('Error creating order: ' . $status);
|
500 |
}
|
501 |
|
502 |
-
Mage::helper('klarna')->logDebugInfo('_createOrder rest response = ' . $response . ' status = ' . $status);
|
503 |
-
|
504 |
if (isset($this->_curlHeaders['Location'])) {
|
505 |
return $this->_getLocationOrderId($this->_curlHeaders['Location']);
|
506 |
}
|
@@ -522,12 +614,12 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
522 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
523 |
curl_close($ch);
|
524 |
|
|
|
|
|
525 |
if ($status != 200) {
|
526 |
Mage::throwException('Error fetching order: ' . $status);
|
527 |
}
|
528 |
|
529 |
-
Mage::helper('klarna')->logDebugInfo('_fetchOrder rest response = ' . $response . ' status = ' . $status);
|
530 |
-
|
531 |
$this->_klarnaOrder = new Varien_Object(json_decode($response, true));
|
532 |
$this->_klarnaOrder->setLocation($location);
|
533 |
}
|
@@ -549,20 +641,21 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
549 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
550 |
curl_close($ch);
|
551 |
|
|
|
|
|
552 |
if ($status != 200) {
|
553 |
Mage::throwException('Error updating order: ' . $status);
|
554 |
}
|
555 |
|
556 |
-
Mage::helper('klarna')->logDebugInfo('_updateOrder rest response = ' . $response . ' status = ' . $status);
|
557 |
-
|
558 |
$this->_klarnaOrder = new Varien_Object(json_decode($response, true));
|
559 |
$this->_klarnaOrder->setLocation($location);
|
560 |
}
|
561 |
|
562 |
-
protected function
|
563 |
{
|
564 |
$ch = curl_init();
|
565 |
-
|
|
|
566 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_getTransport()->getConfigData('merchant_id') . ':' . $this->_getTransport()->getConfigData('shared_secret'));
|
567 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
568 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
@@ -572,9 +665,14 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
572 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
573 |
curl_close($ch);
|
574 |
|
575 |
-
Mage::helper('klarna')->logDebugInfo('
|
|
|
|
|
|
|
|
|
576 |
|
577 |
-
|
|
|
578 |
}
|
579 |
|
580 |
protected function _acknowledgeOrder($orderId)
|
@@ -655,7 +753,6 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
655 |
Mage::throwException($message);
|
656 |
}
|
657 |
|
658 |
-
$location = "";
|
659 |
$capture_id = "";
|
660 |
if (isset($this->_curlHeaders['Location'])) {
|
661 |
$location = $this->_curlHeaders['Location'];
|
@@ -877,7 +974,7 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
877 |
|
878 |
return false;
|
879 |
}
|
880 |
-
|
881 |
/*
|
882 |
* Not happy with this, but I guess we can't solve it in other ways.
|
883 |
*
|
@@ -920,13 +1017,14 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
920 |
return NULL;
|
921 |
}
|
922 |
|
923 |
-
public function
|
924 |
{
|
|
|
925 |
if ($this->_klarnaOrder) {
|
926 |
-
$
|
927 |
-
$this->_klarnaOrder
|
928 |
}
|
929 |
-
return
|
930 |
}
|
931 |
|
932 |
/**
|
@@ -1035,4 +1133,16 @@ class Vaimo_Klarna_Model_Api_Rest extends Vaimo_Klarna_Model_Api_Abstract
|
|
1035 |
}
|
1036 |
}
|
1037 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1038 |
}
|
46 |
return $this;
|
47 |
}
|
48 |
|
49 |
+
protected function _isUSA()
|
50 |
+
{
|
51 |
+
return $this->_apiVersion == Vaimo_Klarna_Helper_Data::KLARNA_KCO_API_VERSION_USA;
|
52 |
+
}
|
53 |
+
|
54 |
public function init($klarnaSetup)
|
55 |
{
|
56 |
$this->_klarnaSetup = $klarnaSetup;
|
57 |
if ($this->_klarnaSetup->getHost() == 'BETA') {
|
58 |
+
if ($this->_isUSA()) {
|
59 |
$this->_url = 'https://api-na.playground.klarna.com';
|
60 |
} else {
|
61 |
$this->_url = 'https://api.playground.klarna.com';
|
62 |
}
|
63 |
} else {
|
64 |
+
if ($this->_isUSA()) {
|
65 |
$this->_url = 'https://api-na.klarna.com';
|
66 |
} else {
|
67 |
$this->_url = 'https://api.klarna.com';
|
99 |
return $res;
|
100 |
}
|
101 |
|
102 |
+
protected function _getAddressData($useTransport = false, $type = Mage_Sales_Model_Quote_Address::TYPE_BILLING)
|
103 |
{
|
104 |
if (!$this->_getTransport()->getConfigData('auto_prefil')) return NULL;
|
105 |
+
$result = NULL;
|
106 |
+
$address = NULL;
|
107 |
|
108 |
/** @var $session Mage_Customer_Model_Session */
|
109 |
+
if ($useTransport) {
|
110 |
+
$result = array();
|
111 |
+
$result['email'] = $this->_getTransport()->getQuote()->getCustomerEmail();
|
112 |
+
if ($type==Mage_Sales_Model_Quote_Address::TYPE_BILLING) {
|
113 |
+
$address = $this->_getTransport()->getBillingAddress();
|
114 |
+
} else {
|
115 |
+
$address = $this->_getTransport()->getShippingAddress();
|
116 |
+
}
|
117 |
+
} else {
|
118 |
+
$session = Mage::getSingleton('customer/session');
|
119 |
+
if ($session->isLoggedIn()) {
|
120 |
+
if ($type==Mage_Sales_Model_Quote_Address::TYPE_BILLING) {
|
121 |
+
$address = $session->getCustomer()->getPrimaryBillingAddress();
|
122 |
+
} else {
|
123 |
+
$address = $session->getCustomer()->getPrimaryShippingAddress();
|
124 |
+
}
|
125 |
+
$result = array();
|
126 |
+
if ($session->getCustomer()->getEmail()) {
|
127 |
+
$result['email'] = $session->getCustomer()->getEmail();
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
if ($address) {
|
132 |
+
if ($address->getPostcode()) {
|
133 |
+
$result['postal_code'] = $address->getPostcode();
|
134 |
+
}
|
135 |
+
if ($address->getFirstname()) {
|
136 |
+
$result['given_name'] = $address->getFirstname();
|
137 |
+
}
|
138 |
+
if ($address->getLastname()) {
|
139 |
+
$result['family_name'] = $address->getLastname();
|
140 |
+
}
|
141 |
+
if ($address->getStreet(1)) {
|
142 |
+
$result['street_address'] = $address->getStreet(1);
|
143 |
+
}
|
144 |
+
if ($address->getCity()) {
|
145 |
+
$result['city'] = $address->getCity();
|
146 |
+
}
|
147 |
+
if ($address->getTelephone()) {
|
148 |
+
$result['phone'] = $address->getTelephone();
|
149 |
+
}
|
150 |
+
if ($address->getCountryId()) {
|
151 |
+
$result['country'] = $address->getCountryId();
|
152 |
+
}
|
153 |
if ($address->getRegionCode()) {
|
154 |
+
$result['region'] = $address->getRegionCode();
|
155 |
}
|
|
|
156 |
}
|
157 |
+
return $result;
|
|
|
158 |
}
|
159 |
|
160 |
protected function _getCustomerData()
|
206 |
Mage::getSingleton('checkout/session')->setKlarnaCheckoutId($checkoutId);
|
207 |
}
|
208 |
|
209 |
+
protected function _getCartItems($useTransport = false)
|
210 |
{
|
211 |
+
if ($useTransport) {
|
212 |
+
$quote = $this->_getTransport()->getQuote();
|
213 |
+
} else {
|
214 |
+
$quote = $this->_getQuote();
|
215 |
+
}
|
216 |
$items = array();
|
217 |
+
$taxes = array();
|
218 |
$calculator = Mage::getSingleton('tax/calculation');
|
219 |
|
220 |
foreach ($quote->getAllVisibleItems() as $quoteItem) {
|
223 |
} else {
|
224 |
$taxRate = $quoteItem->getTaxAmount() / $quoteItem->getRowTotal() * 100;
|
225 |
}
|
226 |
+
$taxAmount = $calculator->calcTaxAmount($quoteItem->getRowTotalInclTax(), $taxRate, true);
|
227 |
+
if (isset($taxes[$taxRate])) {
|
228 |
+
$taxes[$taxRate] += $taxAmount;
|
229 |
+
} else {
|
230 |
+
$taxes[$taxRate] = $taxAmount;
|
231 |
+
}
|
232 |
+
if ($this->_isUSA()) {
|
233 |
+
// $unitPrice = $quoteItem->getPrice();
|
234 |
+
$totalAmount = $quoteItem->getRowTotalInclTax() - $taxAmount;
|
235 |
+
$unitPrice = $totalAmount / $quoteItem->getQty();
|
236 |
+
$taxRate = 0;
|
237 |
+
$taxAmount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
} else {
|
239 |
+
$unitPrice = $quoteItem->getPriceInclTax();
|
240 |
+
$totalAmount = $quoteItem->getRowTotalInclTax();
|
241 |
}
|
|
|
|
|
242 |
$items[] = array(
|
243 |
'type' => 'physical',
|
244 |
'reference' => $quoteItem->getSku(),
|
245 |
'name' => $quoteItem->getName(),
|
246 |
'quantity' => round($quoteItem->getQty()),
|
247 |
'quantity_unit' => 'pcs',
|
248 |
+
'unit_price' => round($unitPrice * 100),
|
249 |
+
'discount_rate' => 0,
|
250 |
+
// 'discount_rate' => round($quoteItem->getDiscountPercent() * 100),
|
251 |
'tax_rate' => round($taxRate * 100),
|
252 |
+
'total_amount' => round($totalAmount * 100),
|
253 |
'total_tax_amount' => round($taxAmount * 100),
|
254 |
);
|
|
|
255 |
}
|
256 |
|
257 |
foreach ($quote->getTotals() as $key => $total) {
|
267 |
$amount = $amount - $taxAmount - $hiddenTaxAmount;
|
268 |
}
|
269 |
$taxRate = ($taxAmount + $hiddenTaxAmount) / $amount * 100;
|
270 |
+
$taxes[$taxRate] += $taxAmount;
|
271 |
+
if ($this->_isUSA()) {
|
272 |
+
$unitPrice = $amount;
|
273 |
+
$totalAmount = $amount;
|
274 |
+
$taxRate = 0;
|
275 |
+
$taxAmount = 0;
|
276 |
+
} else {
|
277 |
+
$unitPrice = $amount + $taxAmount + $hiddenTaxAmount;
|
278 |
+
$totalAmount = $amount + $taxAmount + $hiddenTaxAmount;
|
279 |
+
}
|
280 |
$items[] = array(
|
281 |
'type' => 'shipping_fee',
|
282 |
'reference' => $total->getCode(),
|
283 |
'name' => $total->getTitle(),
|
284 |
'quantity' => 1,
|
285 |
+
'unit_price' => round($unitPrice * 100),
|
286 |
'discount_rate' => 0,
|
287 |
'tax_rate' => round($taxRate * 100),
|
288 |
+
'total_amount' => round($totalAmount * 100),
|
289 |
'total_tax_amount' => round($taxAmount * 100),
|
290 |
);
|
291 |
}
|
299 |
$taxAmount = $total->getAddress()->getHiddenTaxAmount();
|
300 |
$amount = -$total->getAddress()->getDiscountAmount() - $taxAmount;
|
301 |
$taxRate = $taxAmount / $amount * 100;
|
302 |
+
$taxes[$taxRate] -= $taxAmount;
|
303 |
+
if ($this->_isUSA()) {
|
304 |
+
$unitPrice = $amount;
|
305 |
+
$totalAmount = $amount;
|
306 |
+
$taxRate = 0;
|
307 |
+
$taxAmount = 0;
|
308 |
+
} else {
|
309 |
+
$unitPrice = $amount + $taxAmount;
|
310 |
+
$totalAmount = $amount + $taxAmount;
|
311 |
+
}
|
312 |
$items[] = array(
|
313 |
'type' => 'discount',
|
314 |
'reference' => $total->getCode(),
|
315 |
'name' => $total->getTitle(),
|
316 |
'quantity' => 1,
|
317 |
+
'unit_price' => -round($unitPrice * 100),
|
318 |
'discount_rate' => 0,
|
319 |
'tax_rate' => round($taxRate * 100),
|
320 |
+
'total_amount' => -round($totalAmount * 100),
|
321 |
'total_tax_amount' => -round($taxAmount * 100),
|
322 |
);
|
323 |
}
|
384 |
break;
|
385 |
}
|
386 |
}
|
387 |
+
if ($this->_isUSA()) {
|
388 |
+
$totalAmount = 0;
|
389 |
+
foreach ($items as $item) {
|
390 |
+
$totalAmount += $item['total_amount'];
|
391 |
+
}
|
392 |
+
$totalTax = (($quote->getGrandTotal() * 100) - $totalAmount) / 100;
|
393 |
+
/*
|
394 |
+
$totalTax = 0;
|
395 |
+
foreach ($taxes as $taxRate => $tax) {
|
396 |
+
$totalTax += $tax;
|
397 |
+
}
|
398 |
+
*/
|
399 |
+
$items[] = array(
|
400 |
+
'type' => 'sales_tax',
|
401 |
+
'reference' => Mage::helper('klarna')->__('Sales Tax'),
|
402 |
+
'name' => Mage::helper('klarna')->__('Sales Tax'),
|
403 |
+
'quantity' => 1,
|
404 |
+
'unit_price' => round($totalTax * 100),
|
405 |
+
'discount_rate' => 0,
|
406 |
+
'tax_rate' => 0,
|
407 |
+
'total_amount' => round($totalTax * 100),
|
408 |
+
'total_tax_amount' => 0,
|
409 |
+
);
|
410 |
+
}
|
411 |
|
412 |
return $items;
|
413 |
}
|
435 |
|
436 |
$this->_addUserDefinedVariables($create);
|
437 |
|
438 |
+
if ($data = $this->_getAddressData()) {
|
439 |
$create['billing_address'] = $data;
|
440 |
}
|
441 |
|
448 |
$create['order_lines'] = $this->_getCartItems();
|
449 |
|
450 |
foreach ($create['order_lines'] as $line) {
|
451 |
+
if ($this->_isUSA()) {
|
452 |
+
if (isset($line['type']) && $line['type']=='sales_tax') {
|
453 |
+
$create['order_tax_amount'] += $line['total_amount'];
|
454 |
+
}
|
455 |
+
} else {
|
456 |
+
$create['order_tax_amount'] += $line['total_tax_amount'];
|
457 |
+
}
|
458 |
+
|
459 |
}
|
460 |
+
if ($this->_isUSA()) {
|
461 |
+
|
462 |
$shippingCountries = $this->_getTransport()->getConfigData('shipping_countries');
|
463 |
if ($shippingCountries) {
|
464 |
$create['shipping_countries'] = explode(',', $shippingCountries);
|
465 |
}
|
466 |
+
|
467 |
+
if ($this->_getTransport()->getConfigData('shipping_options')) {
|
468 |
+
$shippingOptions = array();
|
469 |
+
$address = $this->_getQuote()->getShippingAddress();
|
470 |
+
$originalShippingMethod = $address->getShippingMethod();
|
471 |
+
$methods = Mage::getModel('checkout/cart_shipping_api')->getShippingMethodsList($this->_getQuote()->getId());
|
472 |
+
foreach ($methods as $method) {
|
473 |
+
$address->setShippingMethod($method['code']);
|
474 |
+
$this->_getQuote()->setTotalsCollectedFlag(false)->collectTotals();
|
475 |
+
if ($address->getShippingAmount()>0) {
|
476 |
+
$taxRate = ($address->getShippingAmount + $address->getShippingTaxAmount()) / $address->getShippingAmount() * 100;
|
477 |
+
} else {
|
478 |
+
$taxRate = 0;
|
479 |
+
}
|
480 |
+
if ($method['code']==$originalShippingMethod) {
|
481 |
+
$preSelected = true;
|
482 |
+
} else {
|
483 |
+
$preSelected = false;
|
484 |
+
}
|
485 |
+
$shippingOptions[] = array(
|
486 |
+
'id' => $method['code'],
|
487 |
+
'name' => $method['method_title'],
|
488 |
+
'description' => $method['carrier_title'],
|
489 |
+
'price' => (int)($address->getShippingAmount() + $address->getShippingTaxAmount()) * 100,
|
490 |
+
'tax_amount' => (int)$address->getShippingTaxAmount() * 100,
|
491 |
+
'tax_rate' => (int)($taxRate * 100) * 100,
|
492 |
+
'preselected' => $preSelected,
|
493 |
+
);
|
494 |
}
|
495 |
+
$address->setShippingMethod($originalShippingMethod);
|
496 |
+
$this->_getQuote()->setTotalsCollectedFlag(false)->collectTotals();
|
497 |
+
$create['shipping_options'] = $shippingOptions;
|
498 |
+
$create['selected_shipping_option'] = array(
|
499 |
+
'id' => $address->getShippingMethod(),
|
500 |
+
'name' => $address->getShippingDescription(),
|
|
|
|
|
501 |
);
|
502 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
}
|
504 |
|
505 |
$pushUrl = Mage::getUrl('checkout/klarna/push?klarna_order={checkout.order.id}', array('_nosid' => true));
|
512 |
$create['merchant_urls']['confirmation'] = Mage::getUrl('checkout/klarna/success');
|
513 |
$create['merchant_urls']['push'] = $pushUrl;
|
514 |
|
515 |
+
if ($this->_getTransport()->getConfigData('enable_validation')) {
|
516 |
+
$validateUrl = Mage::getUrl('checkout/klarna/validate?klarna_order={checkout.order.id}', array('_nosid' => true));
|
517 |
+
if (substr($validateUrl, -1, 1) == '/') {
|
518 |
+
$validateUrl = substr($validateUrl, 0, strlen($validateUrl) - 1);
|
519 |
+
}
|
520 |
+
if (substr($validateUrl, 0, 5) == 'https') {
|
521 |
+
$create['merchant_urls']['validation'] = $validateUrl;
|
522 |
+
}
|
523 |
}
|
524 |
+
if ($this->_getTransport()->getConfigData('enable_postcode_update')) {
|
525 |
+
$validateUrl = Mage::getUrl('checkout/klarna/taxshippingupdate?klarna_order={checkout.order.id}', array('_nosid' => true));
|
526 |
+
if (substr($validateUrl, -1, 1) == '/') {
|
527 |
+
$validateUrl = substr($validateUrl, 0, strlen($validateUrl) - 1);
|
528 |
+
}
|
529 |
+
if (substr($validateUrl, 0, 5) == 'https') {
|
530 |
+
$create['merchant_urls']['shipping_address_update'] = $validateUrl;
|
531 |
+
}
|
532 |
}
|
533 |
|
534 |
Mage::helper('klarna')->logDebugInfo('_getCreateRequest rest', $create);
|
539 |
return $request->getData();
|
540 |
}
|
541 |
|
542 |
+
public function prepareTaxAndShippingReply()
|
543 |
{
|
544 |
$update = array();
|
545 |
|
546 |
+
if ($data = $this->_getAddressData(true, Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)) {
|
547 |
+
$update['shipping_address'] = $data;
|
548 |
}
|
549 |
|
550 |
+
$update['order_amount'] = round($this->_getTransport()->getQuote()->getGrandTotal() * 100);
|
|
|
|
|
|
|
|
|
551 |
$update['order_tax_amount'] = 0;
|
552 |
+
$update['order_lines'] = $this->_getCartItems(true);
|
553 |
|
554 |
foreach ($update['order_lines'] as $line) {
|
555 |
+
if ($this->_isUSA()) {
|
556 |
+
if (isset($line['type']) && $line['type']=='sales_tax') {
|
557 |
+
$update['order_tax_amount'] += $line['total_amount'];
|
558 |
+
}
|
559 |
+
} else {
|
560 |
+
$update['order_tax_amount'] += $line['total_tax_amount'];
|
561 |
+
}
|
562 |
}
|
563 |
|
|
|
|
|
564 |
$request = new Varien_Object($update);
|
565 |
Mage::dispatchEvent('klarnacheckout_get_update_request', array('request' => $request));
|
566 |
|
587 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
588 |
curl_close($ch);
|
589 |
|
590 |
+
Mage::helper('klarna')->logDebugInfo('_createOrder rest response = ' . $response . ' status = ' . $status);
|
591 |
+
|
592 |
if ($status != 201) {
|
593 |
Mage::throwException('Error creating order: ' . $status);
|
594 |
}
|
595 |
|
|
|
|
|
596 |
if (isset($this->_curlHeaders['Location'])) {
|
597 |
return $this->_getLocationOrderId($this->_curlHeaders['Location']);
|
598 |
}
|
614 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
615 |
curl_close($ch);
|
616 |
|
617 |
+
Mage::helper('klarna')->logDebugInfo('_fetchOrder rest response = ' . $response . ' status = ' . $status);
|
618 |
+
|
619 |
if ($status != 200) {
|
620 |
Mage::throwException('Error fetching order: ' . $status);
|
621 |
}
|
622 |
|
|
|
|
|
623 |
$this->_klarnaOrder = new Varien_Object(json_decode($response, true));
|
624 |
$this->_klarnaOrder->setLocation($location);
|
625 |
}
|
641 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
642 |
curl_close($ch);
|
643 |
|
644 |
+
Mage::helper('klarna')->logDebugInfo('_updateOrder rest response = ' . $response . ' status = ' . $status);
|
645 |
+
|
646 |
if ($status != 200) {
|
647 |
Mage::throwException('Error updating order: ' . $status);
|
648 |
}
|
649 |
|
|
|
|
|
650 |
$this->_klarnaOrder = new Varien_Object(json_decode($response, true));
|
651 |
$this->_klarnaOrder->setLocation($location);
|
652 |
}
|
653 |
|
654 |
+
protected function _fetchCreatedOrder($checkoutId)
|
655 |
{
|
656 |
$ch = curl_init();
|
657 |
+
$location = $this->_getUrl() . '/ordermanagement/v1/orders/' . $checkoutId;
|
658 |
+
curl_setopt($ch, CURLOPT_URL, $location);
|
659 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_getTransport()->getConfigData('merchant_id') . ':' . $this->_getTransport()->getConfigData('shared_secret'));
|
660 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
661 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
665 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
666 |
curl_close($ch);
|
667 |
|
668 |
+
Mage::helper('klarna')->logDebugInfo('_fetchCreatedOrder rest response = ' . $response . ' status = ' . $status);
|
669 |
+
|
670 |
+
if ($status != 200) {
|
671 |
+
Mage::throwException('Error fetching order: ' . $status);
|
672 |
+
}
|
673 |
|
674 |
+
$this->_klarnaOrder = new Varien_Object(json_decode($response, true));
|
675 |
+
$this->_klarnaOrder->setLocation($location);
|
676 |
}
|
677 |
|
678 |
protected function _acknowledgeOrder($orderId)
|
753 |
Mage::throwException($message);
|
754 |
}
|
755 |
|
|
|
756 |
$capture_id = "";
|
757 |
if (isset($this->_curlHeaders['Location'])) {
|
758 |
$location = $this->_curlHeaders['Location'];
|
974 |
|
975 |
return false;
|
976 |
}
|
977 |
+
|
978 |
/*
|
979 |
* Not happy with this, but I guess we can't solve it in other ways.
|
980 |
*
|
1017 |
return NULL;
|
1018 |
}
|
1019 |
|
1020 |
+
public function fetchCreatedOrder($checkoutId)
|
1021 |
{
|
1022 |
+
$this->_fetchCreatedOrder($checkoutId);
|
1023 |
if ($this->_klarnaOrder) {
|
1024 |
+
$this->_klarnaOrder->setStatus('created');
|
1025 |
+
return $this->_klarnaOrder;
|
1026 |
}
|
1027 |
+
return NULL;
|
1028 |
}
|
1029 |
|
1030 |
/**
|
1133 |
}
|
1134 |
}
|
1135 |
|
1136 |
+
/*
|
1137 |
+
* Will return the klarna order or null, if it doesn't find it
|
1138 |
+
* Not used by this module, but as a service for others.
|
1139 |
+
*
|
1140 |
+
*/
|
1141 |
+
public function getKlarnaOrderRaw($checkoutId)
|
1142 |
+
{
|
1143 |
+
if ($checkoutId) {
|
1144 |
+
return $this->fetchCreatedOrder($checkoutId);
|
1145 |
+
}
|
1146 |
+
return NULL;
|
1147 |
+
}
|
1148 |
}
|
app/code/community/Vaimo/Klarna/Model/Klarnacheckout.php
CHANGED
@@ -144,10 +144,10 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
144 |
return $res;
|
145 |
}
|
146 |
|
147 |
-
public function validateQuote(
|
148 |
{
|
149 |
/** @var Mage_Sales_Model_Quote $quote */
|
150 |
-
$quote = $this->
|
151 |
|
152 |
if (!$quote->getId()) {
|
153 |
$this->_getHelper()->logDebugInfo('validateQuote could not get quote');
|
@@ -158,13 +158,38 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
158 |
$this->_getHelper()->logDebugInfo('validateQuote has no items');
|
159 |
return 'has no items';
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
if ($quote->getHasError()) {
|
163 |
-
$result = array('has error');
|
164 |
/** @var Mage_Core_Model_Message_Error $error */
|
165 |
foreach ($quote->getErrors() as $error) {
|
166 |
$result[] = $error->getText();
|
167 |
}
|
|
|
|
|
|
|
168 |
$this->_getHelper()->logDebugInfo('validateQuote errors: ' . implode(" ", $result));
|
169 |
return implode("\n", $result);
|
170 |
}
|
@@ -188,11 +213,12 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
188 |
} else {
|
189 |
$this->_getHelper()->logKlarnaApi('Call with checkout ID NULL');
|
190 |
}
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
194 |
}
|
195 |
-
|
196 |
$quote = $this->_api->loadQuote();
|
197 |
if (!$quote) {
|
198 |
$this->_getHelper()->logDebugInfo('createOrder could not get quote');
|
@@ -200,46 +226,41 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
200 |
}
|
201 |
$this->setQuote($quote);
|
202 |
|
203 |
-
$varienOrder = $this->_api->initVarienOrder();
|
204 |
-
if (!$varienOrder) {
|
205 |
-
$this->_getHelper()->logDebugInfo('createOrder could not create varienOrder');
|
206 |
-
return 'could not create varienOrder';
|
207 |
-
}
|
208 |
|
209 |
-
$billingStreetAddress = $
|
210 |
-
$billingStreetAddress2 = $
|
211 |
-
$billingStreetName = $
|
212 |
-
$billingStreetNumber = $
|
213 |
-
$billingRegionCode = $
|
214 |
-
$shippingStreetAddress = $
|
215 |
-
$shippingStreetAddress2 = $
|
216 |
-
$shippingStreetName = $
|
217 |
-
$shippingStreetNumber = $
|
218 |
-
$shippingRegionCode = $
|
219 |
|
220 |
if (!$billingStreetAddress && $billingStreetName && $billingStreetNumber) {
|
221 |
-
$streetAddress = $
|
222 |
$streetAddress['street_address'] = $billingStreetName . ' ' . $billingStreetNumber;
|
223 |
-
$
|
224 |
}
|
225 |
if ($billingStreetAddress2) {
|
226 |
-
$streetAddress = $
|
227 |
$streetAddress['street_address'] = array($streetAddress['street_address'], $billingStreetAddress2);
|
228 |
-
$
|
229 |
}
|
230 |
|
231 |
if (!$shippingStreetAddress && $shippingStreetName && $shippingStreetNumber) {
|
232 |
-
$streetAddress = $
|
233 |
$streetAddress['street_address'] = $shippingStreetName . ' ' . $shippingStreetNumber;
|
234 |
-
$
|
235 |
}
|
236 |
if ($shippingStreetAddress2) {
|
237 |
-
$streetAddress = $
|
238 |
$streetAddress['street_address'] = array($streetAddress['street_address'], $shippingStreetAddress2);
|
239 |
-
$
|
240 |
}
|
241 |
|
242 |
-
if ($
|
243 |
$this->_getHelper()->logDebugInfo('createOrder status not complete');
|
244 |
return 'status not complete';
|
245 |
}
|
@@ -247,7 +268,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
247 |
$orderId = $this->_findAlreadyCreatedOrder($quote->getId());
|
248 |
if ($orderId>0) {
|
249 |
$this->_getHelper()->logDebugInfo('createOrder order already created ' . $orderId);
|
250 |
-
if (($
|
251 |
$order = $this->_loadOrderByKey($quote->getId());
|
252 |
$this->_api->updateKlarnaOrder($order, true);
|
253 |
$this->_getHelper()->logDebugInfo('updating order status on already crated order ' . $orderId);
|
@@ -262,7 +283,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
262 |
$quote->setCheckoutMethod('customer');
|
263 |
} else {
|
264 |
/** @var $customer Mage_Customer_Model_Customer */
|
265 |
-
$customer = $this->_loadCustomerByEmail($
|
266 |
if ($customer->getId()) {
|
267 |
$quote->setCustomer($customer);
|
268 |
$quote->setCheckoutMethod('customer');
|
@@ -285,15 +306,15 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
285 |
$billingAddress->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
|
286 |
}
|
287 |
} else {
|
288 |
-
$billingAddress->setFirstname($
|
289 |
-
$billingAddress->setLastname($
|
290 |
-
$billingAddress->setCareOf($
|
291 |
-
$billingAddress->setStreet($
|
292 |
-
$billingAddress->setPostcode($
|
293 |
-
$billingAddress->setCity($
|
294 |
-
$billingAddress->setCountryId(strtoupper($
|
295 |
-
$billingAddress->setEmail($
|
296 |
-
$billingAddress->setTelephone($
|
297 |
$billingAddress->setSaveInAddressBook(1);
|
298 |
if ($billingRegionCode) {
|
299 |
$billingRegionId = Mage::getModel('directory/region')->loadByCode($billingRegionCode, $billingAddress->getCountryId());
|
@@ -304,15 +325,15 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
304 |
// $this->_validateCustomerData($data);
|
305 |
|
306 |
$shippingAddress = $quote->getShippingAddress();
|
307 |
-
$shippingAddress->setFirstname($
|
308 |
-
$shippingAddress->setLastname($
|
309 |
-
$shippingAddress->setCareOf($
|
310 |
-
$shippingAddress->setStreet($
|
311 |
-
$shippingAddress->setPostcode($
|
312 |
-
$shippingAddress->setCity($
|
313 |
-
$shippingAddress->setCountryId(strtoupper($
|
314 |
-
$shippingAddress->setEmail($
|
315 |
-
$shippingAddress->setTelephone($
|
316 |
if ($shippingRegionCode) {
|
317 |
$shippingRegionId = Mage::getModel('directory/region')->loadByCode($shippingRegionCode, $shippingAddress->getCountryId());
|
318 |
$shippingAddress->setRegionId($shippingRegionId->getId());
|
@@ -353,9 +374,9 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
353 |
|
354 |
$quote->save();
|
355 |
|
356 |
-
$reservation = $
|
357 |
-
if ($
|
358 |
-
$reservation = $
|
359 |
}
|
360 |
|
361 |
// Update Order
|
@@ -363,18 +384,18 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
363 |
$order = $this->_loadOrderByKey($quote->getId());
|
364 |
$payment = $order->getPayment();
|
365 |
|
366 |
-
if ($
|
367 |
-
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_REFERENCE, $
|
368 |
-
} else if ($
|
369 |
-
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_REFERENCE, $
|
370 |
}
|
371 |
|
372 |
if ($reservation) {
|
373 |
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_RESERVATION_ID, $reservation);
|
374 |
}
|
375 |
|
376 |
-
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_FORM_FIELD_PHONENUMBER, $
|
377 |
-
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_FORM_FIELD_EMAIL, $
|
378 |
|
379 |
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_HOST, $this->getConfigData("host") );
|
380 |
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_MERCHANT_ID, $this->getConfigData("merchant_id") );
|
@@ -400,7 +421,7 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
400 |
// Subscribe customer to newsletter
|
401 |
try {
|
402 |
if ($quote->getKlarnaCheckoutNewsletter()) {
|
403 |
-
$this->_addToSubscription($
|
404 |
}
|
405 |
} catch(Exception $e) {
|
406 |
$this->_getHelper()->logKlarnaException($e);
|
@@ -461,6 +482,52 @@ class Vaimo_Klarna_Model_Klarnacheckout extends Vaimo_Klarna_Model_Klarnacheckou
|
|
461 |
return true;
|
462 |
}
|
463 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
public function checkNewsletter()
|
465 |
{
|
466 |
// set newsletter subscribe based on settings
|
144 |
return $res;
|
145 |
}
|
146 |
|
147 |
+
public function validateQuote()
|
148 |
{
|
149 |
/** @var Mage_Sales_Model_Quote $quote */
|
150 |
+
$quote = $this->getQuote();
|
151 |
|
152 |
if (!$quote->getId()) {
|
153 |
$this->_getHelper()->logDebugInfo('validateQuote could not get quote');
|
158 |
$this->_getHelper()->logDebugInfo('validateQuote has no items');
|
159 |
return 'has no items';
|
160 |
}
|
161 |
+
|
162 |
+
$result = array();
|
163 |
+
$simpleQty = array();
|
164 |
+
foreach ($quote->getItemsCollection() as $item) {
|
165 |
+
if ($item->getProductType()=='simple') {
|
166 |
+
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($item->getProductId());
|
167 |
+
if ($stockItem->getId()) {
|
168 |
+
if (isset($simpleQty[$item->getSku()])) {
|
169 |
+
$simpleQty[$item->getSku()] += $item->getQty();
|
170 |
+
} else {
|
171 |
+
$simpleQty[$item->getSku()] = $item->getQty();
|
172 |
+
}
|
173 |
+
if (!$stockItem->checkQty($simpleQty[$item->getSku()])) {
|
174 |
+
$result[] = $this->_getHelper()->__('The requested quantity for "%s" is not available.', $item->getName());
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
if (sizeof($result)>0) {
|
180 |
+
return implode("\n", $result);
|
181 |
+
}
|
182 |
+
|
183 |
+
Mage::dispatchEvent(Vaimo_Klarna_Helper_Data::KLARNA_DISPATCH_VALIDATE, array('quote' => $quote) );
|
184 |
|
185 |
if ($quote->getHasError()) {
|
|
|
186 |
/** @var Mage_Core_Model_Message_Error $error */
|
187 |
foreach ($quote->getErrors() as $error) {
|
188 |
$result[] = $error->getText();
|
189 |
}
|
190 |
+
if (sizeof($result)==0) {
|
191 |
+
$result = array('Unknown error');
|
192 |
+
}
|
193 |
$this->_getHelper()->logDebugInfo('validateQuote errors: ' . implode(" ", $result));
|
194 |
return implode("\n", $result);
|
195 |
}
|
213 |
} else {
|
214 |
$this->_getHelper()->logKlarnaApi('Call with checkout ID NULL');
|
215 |
}
|
216 |
+
$createdKlarnaOrder = $this->_api->fetchCreatedOrder($checkoutId);
|
217 |
+
if (!$createdKlarnaOrder) {
|
218 |
+
$this->_getHelper()->logDebugInfo('createOrder could not fetch createdKlarnaOrder');
|
219 |
+
return 'could not fetch createdKlarnaOrder';
|
220 |
}
|
221 |
+
|
222 |
$quote = $this->_api->loadQuote();
|
223 |
if (!$quote) {
|
224 |
$this->_getHelper()->logDebugInfo('createOrder could not get quote');
|
226 |
}
|
227 |
$this->setQuote($quote);
|
228 |
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
+
$billingStreetAddress = $createdKlarnaOrder->getBillingAddress('street_address');
|
231 |
+
$billingStreetAddress2 = $createdKlarnaOrder->getBillingAddress('street_address2');
|
232 |
+
$billingStreetName = $createdKlarnaOrder->getBillingAddress('street_name');
|
233 |
+
$billingStreetNumber = $createdKlarnaOrder->getBillingAddress('street_number');
|
234 |
+
$billingRegionCode = $createdKlarnaOrder->getBillingAddress('region');
|
235 |
+
$shippingStreetAddress = $createdKlarnaOrder->getShippingAddress('street_address');
|
236 |
+
$shippingStreetAddress2 = $createdKlarnaOrder->getShippingAddress('street_address2');
|
237 |
+
$shippingStreetName = $createdKlarnaOrder->getShippingAddress('street_name');
|
238 |
+
$shippingStreetNumber = $createdKlarnaOrder->getShippingAddress('street_number');
|
239 |
+
$shippingRegionCode = $createdKlarnaOrder->getShippingAddress('region');
|
240 |
|
241 |
if (!$billingStreetAddress && $billingStreetName && $billingStreetNumber) {
|
242 |
+
$streetAddress = $createdKlarnaOrder->getBillingAddress();
|
243 |
$streetAddress['street_address'] = $billingStreetName . ' ' . $billingStreetNumber;
|
244 |
+
$createdKlarnaOrder->setBillingAddress($streetAddress);
|
245 |
}
|
246 |
if ($billingStreetAddress2) {
|
247 |
+
$streetAddress = $createdKlarnaOrder->getBillingAddress();
|
248 |
$streetAddress['street_address'] = array($streetAddress['street_address'], $billingStreetAddress2);
|
249 |
+
$createdKlarnaOrder->setBillingAddress($streetAddress);
|
250 |
}
|
251 |
|
252 |
if (!$shippingStreetAddress && $shippingStreetName && $shippingStreetNumber) {
|
253 |
+
$streetAddress = $createdKlarnaOrder->getShippingAddress();
|
254 |
$streetAddress['street_address'] = $shippingStreetName . ' ' . $shippingStreetNumber;
|
255 |
+
$createdKlarnaOrder->setShippingAddress($streetAddress);
|
256 |
}
|
257 |
if ($shippingStreetAddress2) {
|
258 |
+
$streetAddress = $createdKlarnaOrder->getShippingAddress();
|
259 |
$streetAddress['street_address'] = array($streetAddress['street_address'], $shippingStreetAddress2);
|
260 |
+
$createdKlarnaOrder->setShippingAddress($streetAddress);
|
261 |
}
|
262 |
|
263 |
+
if ($createdKlarnaOrder->getStatus() != 'checkout_complete' && $createdKlarnaOrder->getStatus() != 'created') {
|
264 |
$this->_getHelper()->logDebugInfo('createOrder status not complete');
|
265 |
return 'status not complete';
|
266 |
}
|
268 |
$orderId = $this->_findAlreadyCreatedOrder($quote->getId());
|
269 |
if ($orderId>0) {
|
270 |
$this->_getHelper()->logDebugInfo('createOrder order already created ' . $orderId);
|
271 |
+
if (($createdKlarnaOrder->getStatus() == 'checkout_complete') || ($createdKlarnaOrder->getStatus() == 'created')) {
|
272 |
$order = $this->_loadOrderByKey($quote->getId());
|
273 |
$this->_api->updateKlarnaOrder($order, true);
|
274 |
$this->_getHelper()->logDebugInfo('updating order status on already crated order ' . $orderId);
|
283 |
$quote->setCheckoutMethod('customer');
|
284 |
} else {
|
285 |
/** @var $customer Mage_Customer_Model_Customer */
|
286 |
+
$customer = $this->_loadCustomerByEmail($createdKlarnaOrder->getBillingAddress('email'), $quote->getStore());
|
287 |
if ($customer->getId()) {
|
288 |
$quote->setCustomer($customer);
|
289 |
$quote->setCheckoutMethod('customer');
|
306 |
$billingAddress->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
|
307 |
}
|
308 |
} else {
|
309 |
+
$billingAddress->setFirstname($createdKlarnaOrder->getBillingAddress('given_name'));
|
310 |
+
$billingAddress->setLastname($createdKlarnaOrder->getBillingAddress('family_name'));
|
311 |
+
$billingAddress->setCareOf($createdKlarnaOrder->getBillingAddress('care_of'));
|
312 |
+
$billingAddress->setStreet($createdKlarnaOrder->getBillingAddress('street_address'));
|
313 |
+
$billingAddress->setPostcode($createdKlarnaOrder->getBillingAddress('postal_code'));
|
314 |
+
$billingAddress->setCity($createdKlarnaOrder->getBillingAddress('city'));
|
315 |
+
$billingAddress->setCountryId(strtoupper($createdKlarnaOrder->getBillingAddress('country')));
|
316 |
+
$billingAddress->setEmail($createdKlarnaOrder->getBillingAddress('email'));
|
317 |
+
$billingAddress->setTelephone($createdKlarnaOrder->getBillingAddress('phone'));
|
318 |
$billingAddress->setSaveInAddressBook(1);
|
319 |
if ($billingRegionCode) {
|
320 |
$billingRegionId = Mage::getModel('directory/region')->loadByCode($billingRegionCode, $billingAddress->getCountryId());
|
325 |
// $this->_validateCustomerData($data);
|
326 |
|
327 |
$shippingAddress = $quote->getShippingAddress();
|
328 |
+
$shippingAddress->setFirstname($createdKlarnaOrder->getShippingAddress('given_name'));
|
329 |
+
$shippingAddress->setLastname($createdKlarnaOrder->getShippingAddress('family_name'));
|
330 |
+
$shippingAddress->setCareOf($createdKlarnaOrder->getShippingAddress('care_of'));
|
331 |
+
$shippingAddress->setStreet($createdKlarnaOrder->getShippingAddress('street_address'));
|
332 |
+
$shippingAddress->setPostcode($createdKlarnaOrder->getShippingAddress('postal_code'));
|
333 |
+
$shippingAddress->setCity($createdKlarnaOrder->getShippingAddress('city'));
|
334 |
+
$shippingAddress->setCountryId(strtoupper($createdKlarnaOrder->getShippingAddress('country')));
|
335 |
+
$shippingAddress->setEmail($createdKlarnaOrder->getShippingAddress('email'));
|
336 |
+
$shippingAddress->setTelephone($createdKlarnaOrder->getShippingAddress('phone'));
|
337 |
if ($shippingRegionCode) {
|
338 |
$shippingRegionId = Mage::getModel('directory/region')->loadByCode($shippingRegionCode, $shippingAddress->getCountryId());
|
339 |
$shippingAddress->setRegionId($shippingRegionId->getId());
|
374 |
|
375 |
$quote->save();
|
376 |
|
377 |
+
$reservation = $createdKlarnaOrder->getReservation();
|
378 |
+
if ($createdKlarnaOrder->getOrderId()) {
|
379 |
+
$reservation = $createdKlarnaOrder->getOrderId();
|
380 |
}
|
381 |
|
382 |
// Update Order
|
384 |
$order = $this->_loadOrderByKey($quote->getId());
|
385 |
$payment = $order->getPayment();
|
386 |
|
387 |
+
if ($createdKlarnaOrder->getReference()) {
|
388 |
+
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_REFERENCE, $createdKlarnaOrder->getReference());
|
389 |
+
} else if ($createdKlarnaOrder->getKlarnaReference()) {
|
390 |
+
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_REFERENCE, $createdKlarnaOrder->getKlarnaReference());
|
391 |
}
|
392 |
|
393 |
if ($reservation) {
|
394 |
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_RESERVATION_ID, $reservation);
|
395 |
}
|
396 |
|
397 |
+
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_FORM_FIELD_PHONENUMBER, $createdKlarnaOrder->getBillingAddress('phone'));
|
398 |
+
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_FORM_FIELD_EMAIL, $createdKlarnaOrder->getBillingAddress('email'));
|
399 |
|
400 |
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_HOST, $this->getConfigData("host") );
|
401 |
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_INFO_FIELD_MERCHANT_ID, $this->getConfigData("merchant_id") );
|
421 |
// Subscribe customer to newsletter
|
422 |
try {
|
423 |
if ($quote->getKlarnaCheckoutNewsletter()) {
|
424 |
+
$this->_addToSubscription($createdKlarnaOrder->getBillingAddress('email'));
|
425 |
}
|
426 |
} catch(Exception $e) {
|
427 |
$this->_getHelper()->logKlarnaException($e);
|
482 |
return true;
|
483 |
}
|
484 |
|
485 |
+
public function updateTaxAndShipping($data)
|
486 |
+
{
|
487 |
+
$this->_init(Vaimo_Klarna_Helper_Data::KLARNA_API_CALL_KCOCREATE_ORDER);
|
488 |
+
|
489 |
+
$newAddress = new Varien_Object($data['shipping_address']);
|
490 |
+
Mage::helper('klarna')->logDebugInfo('taxshippingupdate A' . $newAddress->getGivenName());
|
491 |
+
$quote = $this->getQuote();
|
492 |
+
$address = $quote->getShippingAddress();
|
493 |
+
$address->setFirstname($newAddress->getGivenName());
|
494 |
+
$address->setLastname($newAddress->getFamilyName());
|
495 |
+
$address->setStreet($newAddress->getStreetAddress());
|
496 |
+
$address->setPostcode($newAddress->getPostalCode());
|
497 |
+
$address->setCity($newAddress->getCity());
|
498 |
+
$address->setTelephone($newAddress->getPhone());
|
499 |
+
$address->setCountryId($newAddress->getCountry());
|
500 |
+
$regionId = Mage::getModel('directory/region')->loadByCode($newAddress->getRegion(), $address->getCountryId());
|
501 |
+
$address->setRegionId($regionId->getId());
|
502 |
+
$address->save();
|
503 |
+
|
504 |
+
if (isset($data['billing_address'])) {
|
505 |
+
$newAddress = new Varien_Object($data['billing_address']);
|
506 |
+
}
|
507 |
+
$address = $quote->getBillingAddress();
|
508 |
+
$address->setFirstname($newAddress->getGivenName());
|
509 |
+
$address->setLastname($newAddress->getFamilyName());
|
510 |
+
$address->setStreet($newAddress->getStreetAddress());
|
511 |
+
$address->setPostcode($newAddress->getPostalCode());
|
512 |
+
$address->setCity($newAddress->getCity());
|
513 |
+
$address->setTelephone($newAddress->getPhone());
|
514 |
+
$address->setCountryId($newAddress->getCountry());
|
515 |
+
$regionId = Mage::getModel('directory/region')->loadByCode($newAddress->getRegion(), $address->getCountryId());
|
516 |
+
$address->setRegionId($regionId->getId());
|
517 |
+
$address->save();
|
518 |
+
|
519 |
+
$quote->setCustomerEmail($newAddress->getEmail());
|
520 |
+
$quote->setTotalsCollectedFlag(false);
|
521 |
+
$quote->collectTotals();
|
522 |
+
$quote->save();
|
523 |
+
$this->setQuote($quote);
|
524 |
+
Mage::helper('klarna')->logDebugInfo('taxshippingupdate A' . $quote->getId());
|
525 |
+
|
526 |
+
$res = $this->_api->prepareTaxAndShippingReply();
|
527 |
+
Mage::helper('klarna')->logDebugInfo('taxshippingupdate B' . $res);
|
528 |
+
return $res;
|
529 |
+
}
|
530 |
+
|
531 |
public function checkNewsletter()
|
532 |
{
|
533 |
// set newsletter subscribe based on settings
|
app/code/community/Vaimo/Klarna/Model/Observer.php
CHANGED
@@ -108,6 +108,27 @@ class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
|
|
108 |
$this->_getSession()->setKlarnaUseOtherMethods(false);
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
// KLARNA CHECKOUT FROM HERE
|
112 |
|
113 |
public function customerAddressFormat(Varien_Event_Observer $observer)
|
@@ -167,14 +188,17 @@ class Vaimo_Klarna_Model_Observer extends Mage_Core_Model_Abstract
|
|
167 |
$class = get_class($controller);
|
168 |
$action = $controller->getRequest()->getActionName();
|
169 |
$clearFlag = false;
|
170 |
-
if (
|
171 |
-
(stristr($class, 'checkout') && !stristr($class, 'ajax') &&
|
172 |
-
|
|
|
|
|
173 |
}
|
174 |
if ((stristr($class, 'customer_account') && stristr($action, 'loginPost'))) {
|
175 |
$clearFlag = false;
|
176 |
}
|
177 |
if ($clearFlag) {
|
|
|
178 |
$this->_getSession()->setKlarnaUseOtherMethods(false);
|
179 |
$payment = $quote->getPayment();
|
180 |
$payment->setMethod(Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
108 |
$this->_getSession()->setKlarnaUseOtherMethods(false);
|
109 |
}
|
110 |
|
111 |
+
/*
|
112 |
+
* Making sure the status is Klarna Reserved after a
|
113 |
+
*
|
114 |
+
* @param Varien_Event_Observer $observer
|
115 |
+
*/
|
116 |
+
public function checkForKlarnaStatusChange($observer)
|
117 |
+
{
|
118 |
+
$order = $observer->getEvent()->getOrder();
|
119 |
+
$method = $order->getPayment()->getMethod();
|
120 |
+
if (Mage::helper('klarna')->isMethodKlarna($method)) {
|
121 |
+
$orderOriginal = Mage::getModel('sales/order')->load($order->getId());
|
122 |
+
if ($orderOriginal->getState()==Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
|
123 |
+
if ($order->getState()==Mage_Sales_Model_Order::STATE_PROCESSING) {
|
124 |
+
$klarna = Mage::getModel('klarna/klarna');
|
125 |
+
$klarna->setOrder($order);
|
126 |
+
$order->setStatus($klarna->getConfigData('order_status'));
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
// KLARNA CHECKOUT FROM HERE
|
133 |
|
134 |
public function customerAddressFormat(Varien_Event_Observer $observer)
|
188 |
$class = get_class($controller);
|
189 |
$action = $controller->getRequest()->getActionName();
|
190 |
$clearFlag = false;
|
191 |
+
if ($action!='noRoute') {
|
192 |
+
if ((!stristr($class, 'checkout') && !stristr($class, 'ajax') && !stristr($class, 'klarna')) ||
|
193 |
+
(stristr($class, 'checkout') && !stristr($class, 'ajax') && stristr($class, 'cart'))) {
|
194 |
+
$clearFlag = true;
|
195 |
+
}
|
196 |
}
|
197 |
if ((stristr($class, 'customer_account') && stristr($action, 'loginPost'))) {
|
198 |
$clearFlag = false;
|
199 |
}
|
200 |
if ($clearFlag) {
|
201 |
+
Mage::helper('klarna')->logKlarnaDebug('checkDisableUseOtherMethods clearFlag is true. class = ' . $class . ' and action = ' . $action);
|
202 |
$this->_getSession()->setKlarnaUseOtherMethods(false);
|
203 |
$payment = $quote->getPayment();
|
204 |
$payment->setMethod(Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
app/code/community/Vaimo/Klarna/controllers/Checkout/KlarnaController.php
CHANGED
@@ -32,6 +32,7 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
|
|
32 |
{
|
33 |
return Mage::getSingleton('checkout/session');
|
34 |
}
|
|
|
35 |
/**
|
36 |
* Retrieve shopping cart model object
|
37 |
*
|
@@ -206,70 +207,137 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
|
|
206 |
$quote->save();
|
207 |
}
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
public function addressUpdateAction()
|
210 |
{
|
211 |
$result = false;
|
212 |
$quote = $this->_getQuote();
|
213 |
-
|
214 |
-
$
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
219 |
-
$
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
if ($result) {
|
|
|
|
|
226 |
$quote->save();
|
227 |
}
|
228 |
$this->getResponse()->setBody(Zend_Json::encode($result));
|
229 |
}
|
230 |
|
231 |
-
public function
|
232 |
{
|
233 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
-
$
|
237 |
-
$
|
238 |
-
|
239 |
-
$orderLines = $this->getRequest()->getParam('order_lines');
|
240 |
|
241 |
-
|
242 |
-
Mage::helper('klarna')->logKlarnaDebug('orderAmount = ' . $orderAmount);
|
243 |
-
Mage::helper('klarna')->logKlarnaDebug('orderAmountTax = ' . $orderAmountTax);
|
244 |
-
Mage::helper('klarna')->logKlarnaDebug('orderLines = ' . $orderLines);
|
245 |
|
246 |
-
Mage::helper('klarna')->
|
|
|
|
|
247 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
public function validateAction()
|
251 |
{
|
252 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
|
|
|
253 |
$checkoutId = $this->getRequest()->getParam('klarna_order');
|
254 |
$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
|
255 |
$klarna = Mage::getModel('klarna/klarnacheckout');
|
256 |
$klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
257 |
|
258 |
-
if (substr($checkoutId, -1, 1) == '/') {
|
259 |
-
$checkoutId = substr($checkoutId, 0, strlen($checkoutId) - 1);
|
260 |
-
}
|
261 |
Mage::helper('klarna')->logKlarnaApi('validateAction checkout id: ' . $checkoutId);
|
262 |
|
263 |
-
$result = $klarna->validateQuote(
|
264 |
-
Mage::helper('klarna')->logKlarnaApi('validateAction result = ' . $result);
|
265 |
|
|
|
266 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
|
267 |
|
268 |
if ($result !== true) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
$this->getResponse()
|
270 |
->setHttpResponseCode(303)
|
271 |
-
->setHeader('Location', Mage::getUrl('checkout/
|
272 |
}
|
|
|
|
|
273 |
}
|
274 |
|
275 |
public function pushAction()
|
@@ -317,8 +385,10 @@ class Vaimo_Klarna_Checkout_KlarnaController extends Mage_Core_Controller_Front_
|
|
317 |
Mage::helper('klarna')->logKlarnaApi('successAction checkout id: ' . $checkoutId);
|
318 |
|
319 |
if (!$checkoutId) {
|
320 |
-
|
321 |
-
|
|
|
|
|
322 |
}
|
323 |
|
324 |
$status = $klarna->getCheckoutStatus($checkoutId);
|
32 |
{
|
33 |
return Mage::getSingleton('checkout/session');
|
34 |
}
|
35 |
+
|
36 |
/**
|
37 |
* Retrieve shopping cart model object
|
38 |
*
|
207 |
$quote->save();
|
208 |
}
|
209 |
|
210 |
+
protected function _updateAddressField($address, $field, $value)
|
211 |
+
{
|
212 |
+
$res = false;
|
213 |
+
if ($value && $address->getData($field)!=$value) {
|
214 |
+
$address->setData($field, $value);
|
215 |
+
$res = true;
|
216 |
+
}
|
217 |
+
return $res;
|
218 |
+
}
|
219 |
+
|
220 |
public function addressUpdateAction()
|
221 |
{
|
222 |
$result = false;
|
223 |
$quote = $this->_getQuote();
|
224 |
+
|
225 |
+
$firstname = $this->getRequest()->getParam('firstname');
|
226 |
+
$lastname = $this->getRequest()->getParam('lastname');
|
227 |
+
$street = $this->getRequest()->getParam('street');
|
228 |
+
$postcode = $this->getRequest()->getParam('postcode');
|
229 |
+
$city = $this->getRequest()->getParam('city');
|
230 |
+
$region = strtoupper($this->getRequest()->getParam('region'));
|
231 |
+
$telephone = $this->getRequest()->getParam('telephone');
|
232 |
+
$country = strtoupper($this->getRequest()->getParam('country'));
|
233 |
+
|
234 |
+
$country_id = NULL;
|
235 |
+
$region_id = NULL;
|
236 |
+
|
237 |
+
if ($country) {
|
238 |
+
$countryRec = Mage::getModel('directory/country')->loadByCode($country, 'iso3_code');
|
239 |
+
if ($countryRec) {
|
240 |
+
$country_id = $countryRec->getId();
|
241 |
+
}
|
242 |
}
|
243 |
+
if ($region && $country_id) {
|
244 |
+
$regionRec = Mage::getModel('directory/region')->loadByCode($region, $country_id);
|
245 |
+
if ($regionRec) {
|
246 |
+
$region_id = $regionRec->getId();
|
247 |
+
}
|
248 |
}
|
249 |
+
|
250 |
+
$address = $quote->getShippingAddress();
|
251 |
+
|
252 |
+
if ($this->_updateAddressField($address, 'firstname', $firstname)) $result = true;
|
253 |
+
if ($this->_updateAddressField($address, 'lastname', $lastname)) $result = true;
|
254 |
+
if ($this->_updateAddressField($address, 'street', $street)) $result = true;
|
255 |
+
if ($this->_updateAddressField($address, 'postcode', $postcode)) $result = true;
|
256 |
+
if ($this->_updateAddressField($address, 'city', $city)) $result = true;
|
257 |
+
if ($this->_updateAddressField($address, 'telephone', $telephone)) $result = true;
|
258 |
+
if ($this->_updateAddressField($address, 'country_id', $country_id)) $result = true;
|
259 |
+
if ($this->_updateAddressField($address, 'region_id', $region_id)) $result = true;
|
260 |
if ($result) {
|
261 |
+
$quote->setTotalsCollectedFlag(false);
|
262 |
+
$quote->collectTotals();
|
263 |
$quote->save();
|
264 |
}
|
265 |
$this->getResponse()->setBody(Zend_Json::encode($result));
|
266 |
}
|
267 |
|
268 |
+
public function taxshippingupdateAction()
|
269 |
{
|
270 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
|
271 |
+
$checkoutId = $this->getRequest()->getParam('klarna_order');
|
272 |
+
Mage::helper('klarna')->logKlarnaApi('taxshippingupdate callback received for ID ' . $checkoutId);
|
273 |
+
|
274 |
+
$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
|
275 |
+
$klarna = Mage::getModel('klarna/klarnacheckout');
|
276 |
+
$klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
277 |
|
278 |
+
$post_body = file_get_contents('php://input');
|
279 |
+
$data = json_decode($post_body, true);
|
280 |
+
Mage::helper('klarna')->logDebugInfo('taxshippingupdate data', $data);
|
|
|
281 |
|
282 |
+
$result = $klarna->updateTaxAndShipping($data);
|
|
|
|
|
|
|
283 |
|
284 |
+
Mage::helper('klarna')->logDebugInfo('taxshippingupdate response', $result);
|
285 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
286 |
+
|
287 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
|
288 |
}
|
289 |
|
290 |
+
public function validateFailedAction()
|
291 |
+
{
|
292 |
+
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
|
293 |
+
|
294 |
+
$checkoutId = $this->getRequest()->getParam('klarna_order');
|
295 |
+
$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
|
296 |
+
$payment = $quote->getPayment();
|
297 |
+
$errors = $payment->getAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_VALIDATE_ERRORS);
|
298 |
+
Mage::helper('klarna')->logKlarnaApi('failedAction errors: ' . $errors);
|
299 |
+
if ($errors) {
|
300 |
+
$payment->unsAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_VALIDATE_ERRORS);
|
301 |
+
$payment->save();
|
302 |
+
$this->_getSession()->addError($errors);
|
303 |
+
}
|
304 |
+
|
305 |
+
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
|
306 |
+
|
307 |
+
$this->_redirect('checkout/cart');
|
308 |
+
return;
|
309 |
+
}
|
310 |
+
|
311 |
public function validateAction()
|
312 |
{
|
313 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_START_TAG);
|
314 |
+
|
315 |
$checkoutId = $this->getRequest()->getParam('klarna_order');
|
316 |
$quote = Mage::getModel('sales/quote')->load($checkoutId, 'klarna_checkout_id');
|
317 |
$klarna = Mage::getModel('klarna/klarnacheckout');
|
318 |
$klarna->setQuote($quote, Vaimo_Klarna_Helper_Data::KLARNA_METHOD_CHECKOUT);
|
319 |
|
|
|
|
|
|
|
320 |
Mage::helper('klarna')->logKlarnaApi('validateAction checkout id: ' . $checkoutId);
|
321 |
|
322 |
+
$result = $klarna->validateQuote();
|
|
|
323 |
|
324 |
+
Mage::helper('klarna')->logKlarnaApi('validateAction result = ' . $result);
|
325 |
Mage::helper('klarna')->logKlarnaApi(Vaimo_Klarna_Helper_Data::KLARNA_LOG_END_TAG);
|
326 |
|
327 |
if ($result !== true) {
|
328 |
+
$payment = $quote->getPayment();
|
329 |
+
|
330 |
+
if ($payment->getId()) {
|
331 |
+
$payment->setAdditionalInformation(Vaimo_Klarna_Helper_Data::KLARNA_VALIDATE_ERRORS, $result);
|
332 |
+
$payment->save();
|
333 |
+
}
|
334 |
+
|
335 |
$this->getResponse()
|
336 |
->setHttpResponseCode(303)
|
337 |
+
->setHeader('Location', Mage::getUrl('checkout/klarna/validateFailed', array('klarna_order' => $checkoutId)));
|
338 |
}
|
339 |
+
$this->getResponse()
|
340 |
+
->setHttpResponseCode(200);
|
341 |
}
|
342 |
|
343 |
public function pushAction()
|
385 |
Mage::helper('klarna')->logKlarnaApi('successAction checkout id: ' . $checkoutId);
|
386 |
|
387 |
if (!$checkoutId) {
|
388 |
+
Mage::helper('klarna')->logKlarnaApi('successAction checkout id is empty, so we do nothing');
|
389 |
+
//$this->_redirect('');
|
390 |
+
//return;
|
391 |
+
exit(1);
|
392 |
}
|
393 |
|
394 |
$status = $klarna->getCheckoutStatus($checkoutId);
|
app/code/community/Vaimo/Klarna/controllers/LoginController.php
CHANGED
@@ -60,6 +60,7 @@ class Vaimo_Klarna_LoginController extends Mage_Core_Controller_Front_Action
|
|
60 |
}
|
61 |
if ($logged_in) {
|
62 |
$r["message"] = $blk->__("Logged in");
|
|
|
63 |
} else {
|
64 |
$r["r_code"] = -3;
|
65 |
$r["message"] = $blk->__("Wrong password");
|
60 |
}
|
61 |
if ($logged_in) {
|
62 |
$r["message"] = $blk->__("Logged in");
|
63 |
+
$r["reload_checkout"] = 1;
|
64 |
} else {
|
65 |
$r["r_code"] = -3;
|
66 |
$r["message"] = $blk->__("Wrong password");
|
app/code/community/Vaimo/Klarna/etc/config.xml
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
--><config>
|
26 |
<modules>
|
27 |
<Vaimo_Klarna>
|
28 |
-
<version>5.
|
29 |
<name>Vaimo Klarna Module</name>
|
30 |
<depends>
|
31 |
<Mage_Payment/>
|
@@ -99,6 +99,14 @@
|
|
99 |
</klarna>
|
100 |
</observers>
|
101 |
</customer_address_format>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
</events>
|
103 |
|
104 |
<sales>
|
@@ -253,7 +261,7 @@
|
|
253 |
<jobs>
|
254 |
<update_transactions>
|
255 |
<schedule>
|
256 |
-
<cron_expr
|
257 |
</schedule>
|
258 |
<run>
|
259 |
<model>klarna/cron::statusUpdateOfPendingOrders</model>
|
25 |
--><config>
|
26 |
<modules>
|
27 |
<Vaimo_Klarna>
|
28 |
+
<version>5.3.1</version>
|
29 |
<name>Vaimo Klarna Module</name>
|
30 |
<depends>
|
31 |
<Mage_Payment/>
|
99 |
</klarna>
|
100 |
</observers>
|
101 |
</customer_address_format>
|
102 |
+
<sales_order_save_before>
|
103 |
+
<observers>
|
104 |
+
<klarna>
|
105 |
+
<class>klarna/observer</class>
|
106 |
+
<method>checkForKlarnaStatusChange</method>
|
107 |
+
</klarna>
|
108 |
+
</observers>
|
109 |
+
</sales_order_save_before>
|
110 |
</events>
|
111 |
|
112 |
<sales>
|
261 |
<jobs>
|
262 |
<update_transactions>
|
263 |
<schedule>
|
264 |
+
<cron_expr>0 */2 * * *</cron_expr>
|
265 |
</schedule>
|
266 |
<run>
|
267 |
<model>klarna/cron::statusUpdateOfPendingOrders</model>
|
app/code/community/Vaimo/Klarna/etc/system.xml
CHANGED
@@ -749,17 +749,35 @@
|
|
749 |
<show_in_website>1</show_in_website>
|
750 |
<show_in_store>1</show_in_store>
|
751 |
</enable_auto_focus>
|
752 |
-
|
753 |
-
|
754 |
-
<label>Enable shipping recalculate when postcode changes</label>
|
755 |
<frontend_type>select</frontend_type>
|
756 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
757 |
<sort_order>260</sort_order>
|
758 |
<show_in_default>1</show_in_default>
|
759 |
<show_in_website>1</show_in_website>
|
760 |
<show_in_store>1</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
761 |
</enable_postcode_update>
|
762 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
<heading_other_method_button translate="label">
|
764 |
<label>Support of other payment methods</label>
|
765 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
@@ -891,6 +909,16 @@
|
|
891 |
<show_in_store>1</show_in_store>
|
892 |
<comment>Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout</comment>
|
893 |
</shipping_countries>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
894 |
</fields>
|
895 |
</vaimo_klarna_checkout>
|
896 |
</groups>
|
749 |
<show_in_website>1</show_in_website>
|
750 |
<show_in_store>1</show_in_store>
|
751 |
</enable_auto_focus>
|
752 |
+
<enable_validation translate="label">
|
753 |
+
<label>Enable Validation of Order before Klarna proceeds</label>
|
|
|
754 |
<frontend_type>select</frontend_type>
|
755 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
756 |
<sort_order>260</sort_order>
|
757 |
<show_in_default>1</show_in_default>
|
758 |
<show_in_website>1</show_in_website>
|
759 |
<show_in_store>1</show_in_store>
|
760 |
+
<comment>An extra validation is made for the cart, stock levels for example, just before the order is created in Klarna. Works only if HTTPS is activated for checkout.</comment>
|
761 |
+
</enable_validation>
|
762 |
+
<enable_postcode_update translate="label">
|
763 |
+
<label>Enable tax and shipping updates</label>
|
764 |
+
<frontend_type>select</frontend_type>
|
765 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
766 |
+
<sort_order>270</sort_order>
|
767 |
+
<show_in_default>1</show_in_default>
|
768 |
+
<show_in_website>1</show_in_website>
|
769 |
+
<show_in_store>1</show_in_store>
|
770 |
+
<comment>Klarna contacts Magento to recalculate taxes and shippment amounts when address is updated. Works only if HTTPS is activated for checkout.</comment>
|
771 |
</enable_postcode_update>
|
772 |
+
<enable_trigger_changed_js>
|
773 |
+
<label>Enable javascript trigger for address update</label>
|
774 |
+
<frontend_type>select</frontend_type>
|
775 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
776 |
+
<sort_order>280</sort_order>
|
777 |
+
<show_in_default>1</show_in_default>
|
778 |
+
<show_in_website>1</show_in_website>
|
779 |
+
<show_in_store>1</show_in_store>
|
780 |
+
</enable_trigger_changed_js>
|
781 |
<heading_other_method_button translate="label">
|
782 |
<label>Support of other payment methods</label>
|
783 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
909 |
<show_in_store>1</show_in_store>
|
910 |
<comment>Specific for API V.3.1. List of allowed shipping countries. If none selected, none will be supported. List will appear in Klarna Checkout</comment>
|
911 |
</shipping_countries>
|
912 |
+
<shipping_options translate="label">
|
913 |
+
<label>Shipping Countries</label>
|
914 |
+
<frontend_type>multiselect</frontend_type>
|
915 |
+
<sort_order>930</sort_order>
|
916 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
917 |
+
<show_in_default>1</show_in_default>
|
918 |
+
<show_in_website>1</show_in_website>
|
919 |
+
<show_in_store>1</show_in_store>
|
920 |
+
<comment>Specific for API V.3.1. List of available shipping options appear in Klarna Checkout.</comment>
|
921 |
+
</shipping_options>
|
922 |
</fields>
|
923 |
</vaimo_klarna_checkout>
|
924 |
</groups>
|
app/design/frontend/base/default/template/vaimo/klarna/catalog/product/pricewidget.phtml
CHANGED
@@ -31,8 +31,7 @@ $_productPrice = $this->getProductPriceInclVat();
|
|
31 |
|
32 |
<?php // Dynamically priced products is an issue ?>
|
33 |
<?php if ($_widgetParameters): ?>
|
34 |
-
<div
|
35 |
-
class="klarna-widget klarna-part-payment"
|
36 |
data-eid="<?php echo $_widgetParameters->getMerchantId(); ?>"
|
37 |
data-locale="<?php echo strtolower($_widgetParameters->getLocaleCode()); ?>"
|
38 |
data-price="<?php echo $_productPrice ?>"
|
31 |
|
32 |
<?php // Dynamically priced products is an issue ?>
|
33 |
<?php if ($_widgetParameters): ?>
|
34 |
+
<div class="klarna-widget klarna-part-payment"
|
|
|
35 |
data-eid="<?php echo $_widgetParameters->getMerchantId(); ?>"
|
36 |
data-locale="<?php echo strtolower($_widgetParameters->getLocaleCode()); ?>"
|
37 |
data-price="<?php echo $_productPrice ?>"
|
app/design/frontend/base/default/template/vaimo/klarna/klarnacheckout/account-login.phtml
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
?>
|
26 |
|
27 |
<div class="klarna_login">
|
28 |
-
<form id="klarna_form-login" action="<?php echo Mage::getUrl('klarna/login/loginPost'); ?>" method="post">
|
29 |
<label for="login-username" class="klarna_input-label"><?php echo $this->__('E-mail'); ?></label>
|
30 |
<input class="required-entry klarna_input-text validate-email" type="email" name="email" id="login-username" placeholder="<?php echo $this->__('E-mail'); ?>">
|
31 |
|
25 |
?>
|
26 |
|
27 |
<div class="klarna_login">
|
28 |
+
<form id="klarna_form-login" action="<?php echo Mage::getUrl('klarna/login/loginPost', array('_secure' => true)); ?>" method="post">
|
29 |
<label for="login-username" class="klarna_input-label"><?php echo $this->__('E-mail'); ?></label>
|
30 |
<input class="required-entry klarna_input-text validate-email" type="email" name="email" id="login-username" placeholder="<?php echo $this->__('E-mail'); ?>">
|
31 |
|
app/design/frontend/base/default/template/vaimo/klarna/klarnacheckout/othermethod.phtml
CHANGED
@@ -24,6 +24,7 @@
|
|
24 |
*/
|
25 |
|
26 |
$button_name = $this->getOthermethodButtonName();
|
|
|
27 |
|
28 |
?>
|
29 |
|
@@ -39,9 +40,9 @@ $button_name = $this->getOthermethodButtonName();
|
|
39 |
|
40 |
<?php endif; ?>
|
41 |
|
42 |
-
<?php if ($
|
43 |
|
44 |
-
<input id="
|
45 |
|
46 |
<?php endif; ?>
|
47 |
|
24 |
*/
|
25 |
|
26 |
$button_name = $this->getOthermethodButtonName();
|
27 |
+
$changeId = $this->triggerChangedJSInputId();
|
28 |
|
29 |
?>
|
30 |
|
40 |
|
41 |
<?php endif; ?>
|
42 |
|
43 |
+
<?php if ($changeId): ?>
|
44 |
|
45 |
+
<input id="<?php echo $changeId ?>" type="hidden" value="<?php echo $this->getUrl('checkout/klarna/addressUpdate') ?>" />
|
46 |
|
47 |
<?php endif; ?>
|
48 |
|
js/vaimo/klarna/klarnacheckout.js
CHANGED
@@ -8,7 +8,55 @@ function getCookie(name) {
|
|
8 |
return (value != null) ? unescape(value[1]) : null;
|
9 |
};
|
10 |
|
11 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
var klarnaCart = document.getElementById("klarna_sidebar"), //"klarna_wrapper");
|
13 |
klarnaContainer = document.getElementById("klarna_container"),
|
14 |
klarnaLoader = document.getElementById("klarna_loader"),
|
@@ -18,9 +66,8 @@ function reloadKlarnaIFrame(results) {
|
|
18 |
klarnaHtml = document.getElementById("klarna_checkout_reload"),
|
19 |
klarnaCheckout = document.getElementById("klarna_checkout"),
|
20 |
klarnaTotals = document.getElementById("klarna_totals"),
|
21 |
-
klarnaCheckoutContainer = document.getElementById('klarna-checkout-container')
|
22 |
-
|
23 |
-
klarnaQty = typeof quantity != 'undefined' ? quantity : null;
|
24 |
var objHtml = JSON.parse(results),
|
25 |
matrixRateFeeEl = document.getElementById('s_method_matrixrate_matrixrate_free');
|
26 |
|
@@ -45,102 +92,40 @@ function reloadKlarnaIFrame(results) {
|
|
45 |
}
|
46 |
|
47 |
fadeIn(document.getElementById("klarna_totals"));
|
48 |
-
|
49 |
-
vanillaAjax ( // Refresh the Klarna iFrame
|
50 |
-
klarnaHtml.value,
|
51 |
-
'',
|
52 |
-
refreshKlarnaIFrame, '', '', false);
|
53 |
-
};
|
54 |
-
|
55 |
-
function refreshKlarnaIFrame(results) {
|
56 |
-
var klarnaCart = document.getElementById("klarna_sidebar"), //"klarna_wrapper");
|
57 |
-
klarnaContainer = document.getElementById("klarna_container"),
|
58 |
-
klarnaLoader = document.getElementById("klarna_loader"),
|
59 |
-
klarnaMsg = document.getElementById("klarna_msg"),
|
60 |
-
klarnaMsgContent = document.getElementById("klarna_msg_content"),
|
61 |
-
klarnaCartHtml = document.getElementById("klarna_cart_reload"),
|
62 |
-
klarnaHtml = document.getElementById("klarna_checkout_reload"),
|
63 |
-
klarnaCheckout = document.getElementById("klarna_checkout"),
|
64 |
-
klarnaTotals = document.getElementById("klarna_totals"),
|
65 |
-
klarnaCheckoutContainer = document.getElementById('klarna-checkout-container'),
|
66 |
-
klarnaQtyInput = typeof input != 'undefined' ? input : null,
|
67 |
-
klarnaQty = typeof quantity != 'undefined' ? quantity : null;
|
68 |
-
|
69 |
-
if (getCookie("klarnaDiscountShipping") == 1) {
|
70 |
-
document.cookie = 'klarnaDiscountShipping=0; expires=0;';
|
71 |
-
if (document.getElementById('s_method_matrixrate_matrixrate_free') && document.getElementById('s_method_matrixrate_matrixrate_free').checked){
|
72 |
-
document.getElementById('s_method_matrixrate_matrixrate_free').checked = true;
|
73 |
-
}
|
74 |
-
massUpdateCartKlarna(["shipping"], '', '');
|
75 |
-
}
|
76 |
-
|
77 |
-
fadeIn(document.getElementById("klarna_totals"));
|
78 |
-
var objKlarnaHtml = JSON.parse(results);
|
79 |
-
var evaluatedObjKlarnaHtml = objKlarnaHtml.update_sections.html;
|
80 |
-
var textNode = document.createTextNode(objKlarnaHtml.update_sections.html);
|
81 |
-
var scriptToEval = textNode.substringData(evaluatedObjKlarnaHtml.search('<script')+31, evaluatedObjKlarnaHtml.search('</script')-evaluatedObjKlarnaHtml.search('<script')-31);
|
82 |
-
var js = document.createElement('script');
|
83 |
-
js.async = true;
|
84 |
-
js.innerHTML = scriptToEval;
|
85 |
-
|
86 |
-
klarnaCheckoutContainer.innerHTML = '';//eval(scriptToEval);
|
87 |
-
klarnaCheckoutContainer.appendChild(js);
|
88 |
bindCheckoutControls();
|
89 |
-
|
90 |
};
|
91 |
|
92 |
-
function
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
if (klarnaCartValue && window.reloadKlarnaIFrameFlag) {
|
119 |
-
// Reload the Klarna iFrame.
|
120 |
-
vanillaAjax(
|
121 |
-
klarnaCartValue,
|
122 |
-
'',
|
123 |
-
reloadKlarnaIFrame, '', '', false
|
124 |
-
);
|
125 |
-
} else if (window.refreshKlarnaIFrameFlag) {
|
126 |
-
vanillaAjax( // Refresh the Klarna iFrame
|
127 |
-
klarnaHtml.value,
|
128 |
-
'',
|
129 |
-
reloadKlarnaIFrame, '', '', false
|
130 |
-
);
|
131 |
-
}
|
132 |
-
} else if (obj.error) {
|
133 |
-
klarnaMsgContent.innerHTML = obj.error;
|
134 |
-
klarnaMsg.className += "error";
|
135 |
-
fadeIn(klarnaMsg);
|
136 |
-
if (klarnaQtyInput) {
|
137 |
-
klarnaQtyInput.value = klarnaQty;
|
138 |
-
}
|
139 |
}
|
140 |
};
|
141 |
|
142 |
-
function updateCartKlarna(type
|
143 |
-
var klarnaCart = document.getElementById("klarna_sidebar"),
|
144 |
klarnaContainer = document.getElementById("klarna_container"),
|
145 |
klarnaLoader = document.getElementById("klarna_loader"),
|
146 |
klarnaMsg = document.getElementById("klarna_msg"),
|
@@ -149,9 +134,7 @@ function updateCartKlarna(type, input, quantity) {
|
|
149 |
klarnaHtml = document.getElementById("klarna_checkout_reload"),
|
150 |
klarnaCheckout = document.getElementById("klarna_checkout"),
|
151 |
klarnaTotals = document.getElementById("klarna_totals"),
|
152 |
-
klarnaCheckoutContainer = document.getElementById('klarna-checkout-container')
|
153 |
-
klarnaQtyInput = typeof input != 'undefined' ? input : null,
|
154 |
-
klarnaQty = typeof quantity != 'undefined' ? quantity : null;
|
155 |
|
156 |
klarnaMsg.style.display = 'none';
|
157 |
klarnaMsg.className = klarnaMsg.className.replace( /(?:^|\s)error(?!\S)/g , '' );
|
@@ -189,40 +172,43 @@ function updateCartKlarna(type, input, quantity) {
|
|
189 |
var ajaxUrl = formID.getAttribute("action");
|
190 |
}
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
//});
|
204 |
setTimeout(function() { // Fade out the "alert" after 3,5 seconds
|
205 |
fadeOut(klarnaMsg);
|
|
|
206 |
}, 3500)
|
207 |
};
|
208 |
|
|
|
|
|
|
|
|
|
|
|
209 |
function hideLoader() {
|
210 |
var klarnaLoader = document.getElementById("klarna_loader");
|
211 |
fadeOut(klarnaLoader);
|
212 |
}
|
213 |
|
214 |
-
function massUpdateCartKlarna(typeArray,
|
215 |
-
|
216 |
-
window.reloadKlarnaIFrameFlag =
|
217 |
-
window.
|
218 |
for (i = 0; i < typeArray.length; i++) {
|
219 |
-
if (i == typeArray.length-1) {
|
220 |
window.reloadKlarnaIFrameFlag = true;
|
221 |
-
window.refreshKlarnaIFrameFlag = true;
|
222 |
}
|
223 |
-
updateCartKlarna(typeArray[i]
|
224 |
}
|
225 |
-
klarnaCheckoutResume();
|
226 |
};
|
227 |
|
228 |
/** Bindings * */
|
@@ -261,14 +247,14 @@ function bindCheckoutControls() {
|
|
261 |
// Reward
|
262 |
if (document.getElementsByName('use_reward_points')[0]) {
|
263 |
document.getElementsByName('use_reward_points')[0].onchange = function() {
|
264 |
-
massUpdateCartKlarna(['reward']
|
265 |
};
|
266 |
};
|
267 |
|
268 |
// Store Credit
|
269 |
if (document.getElementsByName('use_customer_balance')[0]) {
|
270 |
document.getElementsByName('use_customer_balance')[0].onchange = function() {
|
271 |
-
massUpdateCartKlarna(['customer_balance']
|
272 |
};
|
273 |
};
|
274 |
|
@@ -277,7 +263,7 @@ function bindCheckoutControls() {
|
|
277 |
for (var q=0; q<shippingMethods.length; q++) {
|
278 |
shippingMethodItem = shippingMethods[q];
|
279 |
shippingMethodItem.onchange = function() {
|
280 |
-
massUpdateCartKlarna(["shipping"]
|
281 |
return false;
|
282 |
};
|
283 |
};
|
@@ -293,7 +279,7 @@ function bindCheckoutControls() {
|
|
293 |
if (this.className.match(/(?:^|\s)cancel-btn(?!\S)/)) {
|
294 |
couponRemove.value = 1;
|
295 |
document.cookie = 'klarnaDiscountShipping=1; expires=0;';
|
296 |
-
massUpdateCartKlarna(["coupon", "cart"]
|
297 |
} else if (!couponInput.value) {
|
298 |
couponInput.focus();
|
299 |
couponInput.className += " error";
|
@@ -302,7 +288,7 @@ function bindCheckoutControls() {
|
|
302 |
}, 6000)
|
303 |
} else {
|
304 |
document.cookie = 'klarnaDiscountShipping=1; expires=0;';
|
305 |
-
massUpdateCartKlarna(["coupon", "cart"]
|
306 |
}
|
307 |
};
|
308 |
}
|
@@ -311,7 +297,16 @@ function bindCheckoutControls() {
|
|
311 |
document.getElementById('coupon_code').onkeydown = function(e) {
|
312 |
if (e.which == 13) {
|
313 |
e.preventDefault();
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
}
|
316 |
};
|
317 |
}
|
@@ -334,7 +329,7 @@ function bindCheckoutControls() {
|
|
334 |
/(?:^|\s)error(?!\S)/g, '')
|
335 |
}, 6000)
|
336 |
} else {
|
337 |
-
massUpdateCartKlarna(['giftcard', 'cart']
|
338 |
}
|
339 |
};
|
340 |
}
|
@@ -343,7 +338,7 @@ function bindCheckoutControls() {
|
|
343 |
document.getElementById('giftcard_code').onkeydown = function(e) {
|
344 |
if (e.which == 13) {
|
345 |
e.preventDefault();
|
346 |
-
massUpdateCartKlarna(["giftcard"]
|
347 |
}
|
348 |
};
|
349 |
}
|
@@ -352,7 +347,7 @@ function bindCheckoutControls() {
|
|
352 |
if (document.querySelector('#applied-gift-cards .btn-remove')) {
|
353 |
document.querySelector('#applied-gift-cards .btn-remove').onclick = function(e) {
|
354 |
e.preventDefault();
|
355 |
-
massUpdateCartKlarna(['giftcard-remove', 'cart']
|
356 |
};
|
357 |
}
|
358 |
|
@@ -379,7 +374,9 @@ function bindCheckoutControls() {
|
|
379 |
if (qtyCurrent - 1 == 0) {
|
380 |
fadeOut(document.getElementById('cart_item_' + itemid));
|
381 |
}
|
382 |
-
|
|
|
|
|
383 |
return false;
|
384 |
};
|
385 |
};
|
@@ -392,26 +389,15 @@ function bindCheckoutControls() {
|
|
392 |
qtyCurrent = parseInt(qtyInput.value);
|
393 |
|
394 |
qtyInput.value = (qtyCurrent + 1);
|
395 |
-
|
|
|
|
|
396 |
return false;
|
397 |
};
|
398 |
};
|
399 |
|
400 |
for (var q=0; q<qtyInputList.length; q++) {
|
401 |
inputField = qtyInputList[q];
|
402 |
-
/*
|
403 |
-
inputField.onblur = function() {
|
404 |
-
var itemid = this.getAttribute('data-itemid'),
|
405 |
-
qtyInput = document.getElementById('cart_item_qty_' + itemid),
|
406 |
-
qtyCurrent = parseInt(qtyInput.value),
|
407 |
-
qtyOrgInput = document.getElementById('cart_item_qty_org_' + itemid),
|
408 |
-
qtyOrgCurrent = parseInt(qtyOrgInput.value);
|
409 |
-
|
410 |
-
if (qtyCurrent != qtyOrgCurrent) {
|
411 |
-
massUpdateCartKlarna(["cart"], qtyInput, qtyOrgCurrent, hideLoader);
|
412 |
-
}
|
413 |
-
};
|
414 |
-
*/
|
415 |
inputField.onkeydown = function(e) {
|
416 |
if (e.which == 13) {
|
417 |
e.preventDefault();
|
@@ -422,7 +408,9 @@ function bindCheckoutControls() {
|
|
422 |
qtyOrgCurrent = parseInt(qtyOrgInput.value);
|
423 |
|
424 |
if (qtyCurrent != qtyOrgCurrent) {
|
425 |
-
|
|
|
|
|
426 |
}
|
427 |
}
|
428 |
};
|
@@ -430,270 +418,65 @@ function bindCheckoutControls() {
|
|
430 |
|
431 |
};
|
432 |
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
this.registerListeners();
|
441 |
-
};
|
442 |
-
|
443 |
-
me.prototype.registerListeners = function () {
|
444 |
-
if(this.form) {
|
445 |
-
this.form.addEventListener('submit', this.doLogin.bind(this));
|
446 |
-
}
|
447 |
-
};
|
448 |
-
|
449 |
-
me.prototype.doLogin = function (e) {
|
450 |
-
e.preventDefault();
|
451 |
-
|
452 |
-
var form = e.target,
|
453 |
-
data = form.serialize(false),
|
454 |
-
url = form.action;
|
455 |
-
|
456 |
-
vanillaAjax(url, data, this.successCallback.bind(this), this.errorCallback.bind(this), '', true);
|
457 |
-
};
|
458 |
-
|
459 |
-
me.prototype.showMessage = function (message) {
|
460 |
-
var messageEl = document.getElementById('klarna_msg'),
|
461 |
-
messageContentEl = messageEl.querySelector('.klarna_msg-content');
|
462 |
-
|
463 |
-
messageContentEl.textContent = message;
|
464 |
-
fadeIn(messageEl);
|
465 |
-
};
|
466 |
-
|
467 |
-
me.prototype.successCallback = function (response) {
|
468 |
-
var data = JSON.parse(response),
|
469 |
-
messageEl = document.getElementById('klarna_msg');
|
470 |
-
|
471 |
-
// Show message if we get a response code
|
472 |
-
if(!isNaN(data['r_code'])) {
|
473 |
-
|
474 |
-
if (data['r_code'] < 0 || messageEl.classList.contains('error')) { // Error
|
475 |
-
messageEl.classList.add('error');
|
476 |
-
this.showMessage(data.message);
|
477 |
-
} else {
|
478 |
-
messageEl.classList.remove('error'); // Success
|
479 |
-
|
480 |
-
this.showMessage(data.message);
|
481 |
-
|
482 |
-
/**
|
483 |
-
* Reload the page so that the Klarna iframe is updated with
|
484 |
-
* the user's email, address etc.
|
485 |
-
*/
|
486 |
-
window.location.reload();
|
487 |
-
}
|
488 |
-
}
|
489 |
-
};
|
490 |
-
|
491 |
-
me.prototype.errorCallback = function (response) {
|
492 |
-
try {
|
493 |
-
var data = JSON.parse(response);
|
494 |
-
this.showMessage(data.message);
|
495 |
-
}
|
496 |
-
catch (e) {
|
497 |
-
var loginFailedText = Translator.translate("Could not log in. Please try again");
|
498 |
-
this.showMessage(loginFailedText);
|
499 |
-
}
|
500 |
-
|
501 |
-
console.log("Login failed! Here's the data:");
|
502 |
-
console.log(data);
|
503 |
-
};
|
504 |
-
|
505 |
-
return me;
|
506 |
-
})();
|
507 |
-
|
508 |
-
var KlarnaResponsive = (function () {
|
509 |
-
var me = function (config) {
|
510 |
-
var cfg = config || {};
|
511 |
-
|
512 |
-
this.element = cfg.element || document.getElementById('klarna_container');
|
513 |
-
this.isRunning = false;
|
514 |
-
this.storedSidebarEl = document.createDocumentFragment();
|
515 |
-
this.mobileBreakPoint = 992;
|
516 |
-
|
517 |
-
// Only run init functions if the site admin has set the Klarna module to use the responsive layout
|
518 |
-
if(this.getLayout() === 'two-column') {
|
519 |
-
this.registerListeners();
|
520 |
-
this.updateLayout();
|
521 |
-
}
|
522 |
-
};
|
523 |
-
|
524 |
-
me.prototype.registerListeners = function () {
|
525 |
-
window.addEventListener('resize', resize.bind(this));
|
526 |
-
};
|
527 |
-
|
528 |
-
function resize(e) {
|
529 |
-
if (!this.isRunning) {
|
530 |
-
this.isRunning = true;
|
531 |
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
}
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
if (sidebarEls.payment) {
|
566 |
-
fragmentSidebarEl.appendChild(sidebarEls.payment);
|
567 |
-
}
|
568 |
-
if (sidebarEls.shipping) {
|
569 |
-
fragmentSidebarEl.appendChild(sidebarEls.shipping);
|
570 |
-
}
|
571 |
-
if (sidebarEls.cart) {
|
572 |
-
fragmentSidebarEl.appendChild(sidebarEls.cart);
|
573 |
-
}
|
574 |
-
if (sidebarEls.discount) {
|
575 |
-
fragmentSidebarEl.appendChild(sidebarEls.discount);
|
576 |
-
}
|
577 |
-
|
578 |
-
return docFragment;
|
579 |
-
};
|
580 |
-
|
581 |
-
me.prototype.setMobileLayout = function (el) {
|
582 |
-
var groupedEls = getSidebarElements(el, true),
|
583 |
-
sidebarEls = getSidebarElements(el),
|
584 |
-
mainContentEl = document.getElementById('klarna_main'),
|
585 |
-
iframeEl = document.getElementById('klarna_checkout'),
|
586 |
-
tempEl = document.createDocumentFragment();
|
587 |
-
|
588 |
-
for(var key in groupedEls) {
|
589 |
-
if(groupedEls.hasOwnProperty(key) && groupedEls[key] != null) {
|
590 |
-
tempEl.appendChild(groupedEls[key]);
|
591 |
-
}
|
592 |
-
}
|
593 |
-
|
594 |
-
mainContentEl.insertBefore(tempEl, iframeEl);
|
595 |
-
if (sidebarEls.payment) {
|
596 |
-
mainContentEl.appendChild(sidebarEls.payment);
|
597 |
-
}
|
598 |
-
};
|
599 |
-
|
600 |
-
/**
|
601 |
-
* Gets the sidebar children elements as an object
|
602 |
-
* @param sidebarEl (optional)
|
603 |
-
* @param getGroup
|
604 |
-
* @returns {{cart: HTMLElement, shipping: HTMLElement, discount: HTMLElement}}
|
605 |
-
*/
|
606 |
-
function getSidebarElements (sidebarEl, getGroup) {
|
607 |
-
var ref = sidebarEl || document,
|
608 |
-
cartEl = document.getElementById('klarna_cart-container') ? document.getElementById('klarna_cart-container') : ref.querySelector('#klarna_cart-container'),
|
609 |
-
shippingEl = document.getElementById('klarna_shipping') ? document.getElementById('klarna_shipping') : ref.querySelector('#klarna_shipping'),
|
610 |
-
discountEl = document.getElementById('klarna_discount') ? document.getElementById('klarna_discount') : ref.querySelector('#klarna_discount'),
|
611 |
-
groupedEls = {
|
612 |
-
cart: cartEl,
|
613 |
-
shipping: shippingEl,
|
614 |
-
discount: discountEl
|
615 |
-
},
|
616 |
-
sidebarEls = groupedEls;
|
617 |
-
|
618 |
-
sidebarEls.payment = document.getElementById('klarna_methods') ? document.getElementById('klarna_methods') : ref.querySelector('#klarna_methods');
|
619 |
-
|
620 |
-
return getGroup ? groupedEls : sidebarEls;
|
621 |
}
|
622 |
|
623 |
-
|
624 |
-
* Checks if the current viewport width corresponds to the predefined mobile breakpoint
|
625 |
-
* and if so changes the layout to mobile. Otherwise the layout is set to desktop.
|
626 |
-
*/
|
627 |
-
me.prototype.updateLayout = function () {
|
628 |
-
var sidebarEl = document.getElementById('klarna_sidebar'),
|
629 |
-
klarnaContainer = document.getElementById('klarna_container'),
|
630 |
-
mainContentEl = document.getElementById('klarna_main'),
|
631 |
-
cartEl = document.getElementById('klarna_cart-container');
|
632 |
-
|
633 |
-
if(this.getMode() === 'mobile' && sidebarEl && !mainContentEl.contains(cartEl)) {
|
634 |
-
this.storedSidebarEl = sidebarEl.cloneNode(false);
|
635 |
-
|
636 |
-
this.setMobileLayout();
|
637 |
-
|
638 |
-
sidebarEl.parentNode.removeChild(sidebarEl);
|
639 |
-
}
|
640 |
-
else if(this.getMode() === 'desktop' && !sidebarEl && mainContentEl.contains(cartEl)) {
|
641 |
-
klarnaContainer.appendChild(this.getDesktopLayout());
|
642 |
-
}
|
643 |
-
|
644 |
-
this.isRunning = false;
|
645 |
-
};
|
646 |
-
|
647 |
-
me.prototype.getMode = function () {
|
648 |
-
var viewportWidth = window.innerWidth;
|
649 |
-
|
650 |
-
if(viewportWidth < this.mobileBreakPoint) {
|
651 |
-
return 'mobile';
|
652 |
-
}
|
653 |
-
else if(viewportWidth >= this.mobileBreakPoint) {
|
654 |
-
return 'desktop';
|
655 |
-
}
|
656 |
-
else {
|
657 |
-
return false;
|
658 |
-
}
|
659 |
-
};
|
660 |
-
|
661 |
-
/**
|
662 |
-
* Renders the given element as a sidebar or as a part of the main content depending
|
663 |
-
* on whether the browser window is in "mobile" or "desktop" mode. This is mostly intended to be used
|
664 |
-
* when the cart is updated through AJAX as the AJAX response will typically be an html view.
|
665 |
-
* @param el {HTMLElement}
|
666 |
-
*/
|
667 |
-
me.prototype.drawLayoutForElement = function (el) {
|
668 |
-
if(!el) {
|
669 |
-
return false;
|
670 |
-
}
|
671 |
-
|
672 |
-
var klarnaContainer = document.getElementById('klarna_container'),
|
673 |
-
mainContentEl = document.getElementById('klarna_main');
|
674 |
-
|
675 |
-
if(this.getMode() === 'mobile') {
|
676 |
-
var sidebarEls = getSidebarElements(null, true);
|
677 |
-
|
678 |
-
// Remove all the current sidebar items inside the main content area
|
679 |
-
for(var key in sidebarEls) {
|
680 |
-
if(sidebarEls.hasOwnProperty(key) && sidebarEls[key] != null) {
|
681 |
-
mainContentEl.removeChild(sidebarEls[key]);
|
682 |
-
}
|
683 |
-
}
|
684 |
-
|
685 |
-
this.setMobileLayout(el);
|
686 |
-
}
|
687 |
-
else {
|
688 |
-
var newSidebar = this.getDesktopLayout(el);
|
689 |
-
klarnaContainer.replaceChild(newSidebar, klarnaContainer.querySelector('#klarna_sidebar'));
|
690 |
-
}
|
691 |
-
};
|
692 |
-
|
693 |
-
return me;
|
694 |
-
})();
|
695 |
-
|
696 |
-
|
697 |
|
698 |
// If there's no shipping option selected when the document loads, then select
|
699 |
// the first option
|
@@ -719,34 +502,10 @@ docReady(function() {
|
|
719 |
}
|
720 |
|
721 |
bindCheckoutControls();
|
|
|
|
|
|
|
722 |
|
723 |
-
// This will trigger whenever you get out of editing the address in KCO
|
724 |
-
// We send an invisible Ajax call to Magento, updating quote, if different postcode
|
725 |
-
// If different postcode, it sends back true, which is where we need to update KCO
|
726 |
-
// Perhaps we can update shipping section in THAT ajax call, lets see...
|
727 |
-
// Using updateCartKlarna('shipping'); is NOT correct at least :)
|
728 |
-
/*
|
729 |
-
_klarnaCheckout(function(api) {
|
730 |
-
api.on({
|
731 |
-
'change': function(data) {
|
732 |
-
if (document.getElementById('klarna-checkout-shipping-update')) {
|
733 |
-
var url = document.getElementById('klarna-checkout-shipping-update').value;
|
734 |
-
vanillaAjax(url, 'email=' + data.email +
|
735 |
-
'&postcode=' + data.postal_code +
|
736 |
-
'&firstname=' + data.given_name +
|
737 |
-
'&lastname=' + data.family_name,
|
738 |
-
function(response){
|
739 |
-
var answer = JSON.parse(response);
|
740 |
-
if (answer) {
|
741 |
-
massUpdateCartKlarna(["shipping"], '', '');
|
742 |
-
}
|
743 |
-
}, '', '', true
|
744 |
-
);
|
745 |
-
}
|
746 |
-
}
|
747 |
-
});
|
748 |
-
});
|
749 |
-
*/
|
750 |
});
|
751 |
|
752 |
function klarnaCheckoutGo(url) {
|
8 |
return (value != null) ? unescape(value[1]) : null;
|
9 |
};
|
10 |
|
11 |
+
function refreshCheckout(data) {
|
12 |
+
var klarnaCart = document.getElementById("klarna_sidebar"), //"klarna_wrapper");
|
13 |
+
klarnaContainer = document.getElementById("klarna_container"),
|
14 |
+
klarnaLoader = document.getElementById("klarna_loader"),
|
15 |
+
klarnaMsg = document.getElementById("klarna_msg"),
|
16 |
+
klarnaMsgContent = document.getElementById("klarna_msg_content"),
|
17 |
+
klarnaCartHtml = document.getElementById("klarna_cart_reload"),
|
18 |
+
klarnaHtml = document.getElementById("klarna_checkout_reload"),
|
19 |
+
klarnaQtyInput = typeof window.klarnaQtyInput != 'undefined' ? window.klarnaQtyInput : null,
|
20 |
+
klarnaQty = typeof window.klarnaQtyInputQuantity != 'undefined' ? window.klarnaQtyInputQuantity : null;;
|
21 |
+
|
22 |
+
var obj = JSON.parse(data);
|
23 |
+
if (obj.redirect_url) {
|
24 |
+
window.location.href = obj.redirect_url;
|
25 |
+
} else if (obj.success) {
|
26 |
+
if (getCookie("klarnaAddShipping") != 1) {
|
27 |
+
//klarnaMsgContent.innerHTML = obj.success;
|
28 |
+
//fadeIn(klarnaMsg);
|
29 |
+
console.log(obj.success);
|
30 |
+
} else {
|
31 |
+
document.cookie = 'klarnaAddShipping=0; expires=-1;';
|
32 |
+
}
|
33 |
+
|
34 |
+
var klarnaCartValue = '';
|
35 |
+
if (klarnaCartHtml) {
|
36 |
+
klarnaCartValue = klarnaCartHtml.value;
|
37 |
+
}
|
38 |
+
|
39 |
+
vanillaAjax(
|
40 |
+
klarnaCartValue,
|
41 |
+
'',
|
42 |
+
updateSections, '', '', false
|
43 |
+
);
|
44 |
+
} else if (obj.error) {
|
45 |
+
window.reloadKlarnaIFrameFlag = false;
|
46 |
+
klarnaMsgContent.innerHTML = obj.error;
|
47 |
+
klarnaMsg.className += " error";
|
48 |
+
fadeIn(klarnaMsg);
|
49 |
+
klarnaMsg.focus();
|
50 |
+
if (klarnaQtyInput) {
|
51 |
+
klarnaQtyInput.value = klarnaQty;
|
52 |
+
delete(window.klarnaQtyInput);
|
53 |
+
delete(window.klarnaQtyInputQuantity);
|
54 |
+
}
|
55 |
+
hideLoader();
|
56 |
+
}
|
57 |
+
};
|
58 |
+
|
59 |
+
function updateSections(results) {
|
60 |
var klarnaCart = document.getElementById("klarna_sidebar"), //"klarna_wrapper");
|
61 |
klarnaContainer = document.getElementById("klarna_container"),
|
62 |
klarnaLoader = document.getElementById("klarna_loader"),
|
66 |
klarnaHtml = document.getElementById("klarna_checkout_reload"),
|
67 |
klarnaCheckout = document.getElementById("klarna_checkout"),
|
68 |
klarnaTotals = document.getElementById("klarna_totals"),
|
69 |
+
klarnaCheckoutContainer = document.getElementById('klarna-checkout-container');
|
70 |
+
|
|
|
71 |
var objHtml = JSON.parse(results),
|
72 |
matrixRateFeeEl = document.getElementById('s_method_matrixrate_matrixrate_free');
|
73 |
|
92 |
}
|
93 |
|
94 |
fadeIn(document.getElementById("klarna_totals"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
bindCheckoutControls();
|
96 |
+
reloadKlarnaIFrame();
|
97 |
};
|
98 |
|
99 |
+
function reloadKlarnaIFrame(results) {
|
100 |
+
if (window.reloadKlarnaIFrameRequested == false) {
|
101 |
+
window.reloadKlarnaIFrameRequested = true;
|
102 |
+
var klarnaHtml = document.getElementById("klarna_checkout_reload");
|
103 |
+
var endReload = setInterval(function(){
|
104 |
+
if (window.klarnaAjaxRunning == 0 && window.klarnaAjaxArray.length == 0 && window.reloadKlarnaIFrameRequested) {
|
105 |
+
if (window.reloadKlarnaIFrameFlag) {
|
106 |
+
vanillaAjax(klarnaHtml.getAttribute('value'), dataString,
|
107 |
+
function(data) {
|
108 |
+
klarnaCheckoutResume();
|
109 |
+
hideLoader();
|
110 |
+
window.clearInterval(endReload);
|
111 |
+
},
|
112 |
+
function(data) {
|
113 |
+
window.clearInterval(endReload);
|
114 |
+
alert("The checkout could not be properly updated. Please reload the page.");
|
115 |
+
},
|
116 |
+
function(data) {
|
117 |
+
window.clearInterval(endReload);
|
118 |
+
alert("The checkout could not be properly updated or got no response from the server. Please reload the page.");
|
119 |
+
}
|
120 |
+
);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}, 500);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
};
|
126 |
|
127 |
+
function updateCartKlarna(type) {
|
128 |
+
var klarnaCart = document.getElementById("klarna_sidebar"),
|
129 |
klarnaContainer = document.getElementById("klarna_container"),
|
130 |
klarnaLoader = document.getElementById("klarna_loader"),
|
131 |
klarnaMsg = document.getElementById("klarna_msg"),
|
134 |
klarnaHtml = document.getElementById("klarna_checkout_reload"),
|
135 |
klarnaCheckout = document.getElementById("klarna_checkout"),
|
136 |
klarnaTotals = document.getElementById("klarna_totals"),
|
137 |
+
klarnaCheckoutContainer = document.getElementById('klarna-checkout-container');
|
|
|
|
|
138 |
|
139 |
klarnaMsg.style.display = 'none';
|
140 |
klarnaMsg.className = klarnaMsg.className.replace( /(?:^|\s)error(?!\S)/g , '' );
|
172 |
var ajaxUrl = formID.getAttribute("action");
|
173 |
}
|
174 |
|
175 |
+
vanillaAjax(ajaxUrl, dataString,
|
176 |
+
refreshCheckout,
|
177 |
+
function(data) {
|
178 |
+
alert(data);
|
179 |
+
},
|
180 |
+
function(data) {
|
181 |
+
alert(data);
|
182 |
+
},
|
183 |
+
false
|
184 |
+
);
|
185 |
+
|
|
|
186 |
setTimeout(function() { // Fade out the "alert" after 3,5 seconds
|
187 |
fadeOut(klarnaMsg);
|
188 |
+
klarnaMsg.className = klarnaMsg.className.replace( /(?:^|\s)error(?!\S)/g , '' );
|
189 |
}, 3500)
|
190 |
};
|
191 |
|
192 |
+
function showLoader() {
|
193 |
+
var klarnaLoader = document.getElementById("klarna_loader");
|
194 |
+
fadeIn(klarnaLoader);
|
195 |
+
}
|
196 |
+
|
197 |
function hideLoader() {
|
198 |
var klarnaLoader = document.getElementById("klarna_loader");
|
199 |
fadeOut(klarnaLoader);
|
200 |
}
|
201 |
|
202 |
+
function massUpdateCartKlarna(typeArray, reloadIFrame) {
|
203 |
+
showLoader();
|
204 |
+
window.reloadKlarnaIFrameFlag = true;
|
205 |
+
window.reloadKlarnaIFrameRequested = false;
|
206 |
for (i = 0; i < typeArray.length; i++) {
|
207 |
+
if (i == typeArray.length-1 && reloadIFrame) {
|
208 |
window.reloadKlarnaIFrameFlag = true;
|
|
|
209 |
}
|
210 |
+
updateCartKlarna(typeArray[i]);
|
211 |
}
|
|
|
212 |
};
|
213 |
|
214 |
/** Bindings * */
|
247 |
// Reward
|
248 |
if (document.getElementsByName('use_reward_points')[0]) {
|
249 |
document.getElementsByName('use_reward_points')[0].onchange = function() {
|
250 |
+
massUpdateCartKlarna(['reward']);
|
251 |
};
|
252 |
};
|
253 |
|
254 |
// Store Credit
|
255 |
if (document.getElementsByName('use_customer_balance')[0]) {
|
256 |
document.getElementsByName('use_customer_balance')[0].onchange = function() {
|
257 |
+
massUpdateCartKlarna(['customer_balance']);
|
258 |
};
|
259 |
};
|
260 |
|
263 |
for (var q=0; q<shippingMethods.length; q++) {
|
264 |
shippingMethodItem = shippingMethods[q];
|
265 |
shippingMethodItem.onchange = function() {
|
266 |
+
massUpdateCartKlarna(["shipping"]); // ,"cart"
|
267 |
return false;
|
268 |
};
|
269 |
};
|
279 |
if (this.className.match(/(?:^|\s)cancel-btn(?!\S)/)) {
|
280 |
couponRemove.value = 1;
|
281 |
document.cookie = 'klarnaDiscountShipping=1; expires=0;';
|
282 |
+
massUpdateCartKlarna(["coupon", "cart"]);
|
283 |
} else if (!couponInput.value) {
|
284 |
couponInput.focus();
|
285 |
couponInput.className += " error";
|
288 |
}, 6000)
|
289 |
} else {
|
290 |
document.cookie = 'klarnaDiscountShipping=1; expires=0;';
|
291 |
+
massUpdateCartKlarna(["coupon", "cart"]);
|
292 |
}
|
293 |
};
|
294 |
}
|
297 |
document.getElementById('coupon_code').onkeydown = function(e) {
|
298 |
if (e.which == 13) {
|
299 |
e.preventDefault();
|
300 |
+
if (!this.value) {
|
301 |
+
this.focus();
|
302 |
+
this.className += " error";
|
303 |
+
setTimeout(function() {
|
304 |
+
this.className = this.className.replace( /(?:^|\s)error(?!\S)/g , '' )
|
305 |
+
}, 6000)
|
306 |
+
} else {
|
307 |
+
document.cookie = 'klarnaDiscountShipping=1; expires=0;';
|
308 |
+
massUpdateCartKlarna(["coupon", "cart"]);
|
309 |
+
}
|
310 |
}
|
311 |
};
|
312 |
}
|
329 |
/(?:^|\s)error(?!\S)/g, '')
|
330 |
}, 6000)
|
331 |
} else {
|
332 |
+
massUpdateCartKlarna(['giftcard', 'cart']);
|
333 |
}
|
334 |
};
|
335 |
}
|
338 |
document.getElementById('giftcard_code').onkeydown = function(e) {
|
339 |
if (e.which == 13) {
|
340 |
e.preventDefault();
|
341 |
+
massUpdateCartKlarna(["giftcard"]);
|
342 |
}
|
343 |
};
|
344 |
}
|
347 |
if (document.querySelector('#applied-gift-cards .btn-remove')) {
|
348 |
document.querySelector('#applied-gift-cards .btn-remove').onclick = function(e) {
|
349 |
e.preventDefault();
|
350 |
+
massUpdateCartKlarna(['giftcard-remove', 'cart']);
|
351 |
};
|
352 |
}
|
353 |
|
374 |
if (qtyCurrent - 1 == 0) {
|
375 |
fadeOut(document.getElementById('cart_item_' + itemid));
|
376 |
}
|
377 |
+
window.klarnaQtyInput = qtyInput;
|
378 |
+
window.klarnaQtyInputQuantity = qtyCurrent;
|
379 |
+
massUpdateCartKlarna(["cart"]);
|
380 |
return false;
|
381 |
};
|
382 |
};
|
389 |
qtyCurrent = parseInt(qtyInput.value);
|
390 |
|
391 |
qtyInput.value = (qtyCurrent + 1);
|
392 |
+
window.klarnaQtyInput = qtyInput;
|
393 |
+
window.klarnaQtyInputQuantity = qtyCurrent;
|
394 |
+
massUpdateCartKlarna(["cart"]);
|
395 |
return false;
|
396 |
};
|
397 |
};
|
398 |
|
399 |
for (var q=0; q<qtyInputList.length; q++) {
|
400 |
inputField = qtyInputList[q];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
inputField.onkeydown = function(e) {
|
402 |
if (e.which == 13) {
|
403 |
e.preventDefault();
|
408 |
qtyOrgCurrent = parseInt(qtyOrgInput.value);
|
409 |
|
410 |
if (qtyCurrent != qtyOrgCurrent) {
|
411 |
+
window.klarnaQtyInput = qtyInput;
|
412 |
+
window.klarnaQtyInputQuantity = qtyCurrent;
|
413 |
+
massUpdateCartKlarna(["cart"]);
|
414 |
}
|
415 |
}
|
416 |
};
|
418 |
|
419 |
};
|
420 |
|
421 |
+
function registerKlarnaApiChange()
|
422 |
+
{
|
423 |
+
// This will trigger whenever you get out of editing the address in KCO
|
424 |
+
// We send an invisible Ajax call to Magento, updating quote, if different postcode
|
425 |
+
// If different postcode, it sends back true, which is where we need to update KCO
|
426 |
+
// Perhaps we can update shipping section in THAT ajax call, lets see...
|
427 |
+
// Using updateCartKlarna('shipping'); is NOT correct at least :)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
|
429 |
+
if (document.getElementById('klarna-checkout-shipping-update')) {
|
430 |
+
_klarnaCheckout(function(api) {
|
431 |
+
api.on({
|
432 |
+
'change': function(data) {
|
433 |
+
showLoader();
|
434 |
+
var url = document.getElementById('klarna-checkout-shipping-update').value;
|
435 |
+
vanillaAjax(url, 'email=' + data.email +
|
436 |
+
'&firstname=' + data.given_name +
|
437 |
+
'&lastname=' + data.family_name +
|
438 |
+
'&postcode=' + data.postal_code,
|
439 |
+
function(response){
|
440 |
+
console.log('API change');
|
441 |
+
var answer = JSON.parse(response);
|
442 |
+
if (answer) {
|
443 |
+
massUpdateCartKlarna(["shipping"], false);
|
444 |
+
}
|
445 |
+
hideLoader();
|
446 |
+
}, '', '', true);
|
447 |
+
}
|
448 |
+
});
|
449 |
+
});
|
450 |
}
|
451 |
+
if (document.getElementById('klarna-checkout-shipping-update-postcode')) {
|
452 |
+
_klarnaCheckout(function(api) {
|
453 |
+
api.on({
|
454 |
+
'shipping_address_change': function(data) {
|
455 |
+
showLoader();
|
456 |
+
var url = document.getElementById('klarna-checkout-shipping-update-postcode').value;
|
457 |
+
vanillaAjax(url, 'email=' + data.email +
|
458 |
+
'&firstname=' + data.given_name +
|
459 |
+
'&lastname=' + data.family_name +
|
460 |
+
'&street=' + data.street_address +
|
461 |
+
'&postcode=' + data.postal_code +
|
462 |
+
'&city=' + data.city +
|
463 |
+
'®ion=' + data.region +
|
464 |
+
'&telephone=' + data.phone +
|
465 |
+
'&country=' + data.country,
|
466 |
+
function(response){
|
467 |
+
console.log('API Shipping Address Change');
|
468 |
+
var answer = JSON.parse(response);
|
469 |
+
if (answer) {
|
470 |
+
massUpdateCartKlarna(["cart", "shipping"], false);
|
471 |
+
}
|
472 |
+
hideLoader();
|
473 |
+
}, '', '', true);
|
474 |
+
}
|
475 |
+
});
|
476 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
}
|
478 |
|
479 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
|
481 |
// If there's no shipping option selected when the document loads, then select
|
482 |
// the first option
|
502 |
}
|
503 |
|
504 |
bindCheckoutControls();
|
505 |
+
registerKlarnaApiChange();
|
506 |
+
window.klarnaAjaxRunning = 0;
|
507 |
+
window.klarnaAjaxArray = new Array();
|
508 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
});
|
510 |
|
511 |
function klarnaCheckoutGo(url) {
|
js/vaimo/klarna/klarnautils.js
CHANGED
@@ -59,8 +59,6 @@ function _klarnaCheckoutWrapper(callback) {
|
|
59 |
|
60 |
// Helpers for Klarna: Suspend and resume
|
61 |
function klarnaCheckoutSuspend() {
|
62 |
-
var klarnaLoader = document.getElementById("klarna_loader");
|
63 |
-
fadeIn(klarnaLoader);
|
64 |
_klarnaCheckout(function(api) {
|
65 |
api.suspend();
|
66 |
});
|
@@ -72,18 +70,41 @@ function klarnaCheckoutResume() {
|
|
72 |
});
|
73 |
};
|
74 |
|
75 |
-
function
|
76 |
-
|
77 |
-
|
78 |
-
// code for IE7+, Firefox, Chrome, Opera, Safari
|
79 |
-
xmlhttp = new XMLHttpRequest();
|
80 |
-
} else {
|
81 |
-
// code for IE6, IE5
|
82 |
-
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
83 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
-
|
86 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
xmlhttp.onreadystatechange = function() {
|
88 |
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
|
89 |
var response = xmlhttp.responseText;
|
@@ -94,27 +115,19 @@ function vanillaAjax(url, dataString, callbackOnSuccess, callbackOnError, callba
|
|
94 |
} else if (callbackOnOther != '') {
|
95 |
callbackOnOther(response);
|
96 |
}
|
|
|
|
|
|
|
97 |
}
|
98 |
}
|
99 |
-
|
100 |
-
//
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
-
|
103 |
-
xmlhttp.open("POST", url, async);
|
104 |
-
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
105 |
-
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
106 |
-
xmlhttp.send(dataString);
|
107 |
-
|
108 |
-
/*if (!async) {
|
109 |
-
var response = xmlhttp.responseText;
|
110 |
-
if (xmlhttp.status == 200 && callbackOnSuccess != ''){
|
111 |
-
callbackOnSuccess(response);
|
112 |
-
} else if (xmlhttp.status == 400 && callbackOnError != '') {
|
113 |
-
callbackOnError(response);
|
114 |
-
} else if (callbackOnOther != '') {
|
115 |
-
callbackOnOther(response);
|
116 |
-
}
|
117 |
-
}*/
|
118 |
};
|
119 |
|
120 |
// fade out
|
@@ -266,4 +279,270 @@ HTMLFormElement.prototype.serialize = function(asObject) {
|
|
266 |
}
|
267 |
|
268 |
return elements.join('&');
|
269 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
// Helpers for Klarna: Suspend and resume
|
61 |
function klarnaCheckoutSuspend() {
|
|
|
|
|
62 |
_klarnaCheckout(function(api) {
|
63 |
api.suspend();
|
64 |
});
|
70 |
});
|
71 |
};
|
72 |
|
73 |
+
function initiateFromKlarnaAjaxArray() {
|
74 |
+
if (window.klarnaAjaxArray.length == 0) {
|
75 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
+
url = window.klarnaAjaxArray[0].url;
|
78 |
+
dataString = window.klarnaAjaxArray[0].dataString;
|
79 |
+
callbackOnSuccess = window.klarnaAjaxArray[0].callbackOnSuccess;
|
80 |
+
callbackOnError = window.klarnaAjaxArray[0].callbackOnError;
|
81 |
+
callbackOnOther = window.klarnaAjaxArray[0].callbackOnOther;
|
82 |
+
async = window.klarnaAjaxArray[0].async;
|
83 |
+
window.klarnaAjaxArray.splice(0, 1);
|
84 |
+
vanillaAjax(url, dataString, callbackOnSuccess, callbackOnError, callbackOnOther, async);
|
85 |
+
|
86 |
+
}
|
87 |
|
88 |
+
function vanillaAjax(url, dataString, callbackOnSuccess, callbackOnError, callbackOnOther, async) {
|
89 |
+
if (window.klarnaAjaxRunning == 1) {
|
90 |
+
window.klarnaAjaxArray[klarnaAjaxArray.length] = {};
|
91 |
+
var index = klarnaAjaxArray.length - 1;
|
92 |
+
window.klarnaAjaxArray[index].url = url;
|
93 |
+
window.klarnaAjaxArray[index].dataString = dataString;
|
94 |
+
window.klarnaAjaxArray[index].callbackOnSuccess = callbackOnSuccess;
|
95 |
+
window.klarnaAjaxArray[index].callbackOnError = callbackOnError;
|
96 |
+
window.klarnaAjaxArray[index].callbackOnOther = callbackOnOther;
|
97 |
+
window.klarnaAjaxArray[index].async = async
|
98 |
+
} else {
|
99 |
+
var xmlhttp;
|
100 |
+
if (window.XMLHttpRequest) {
|
101 |
+
// code for IE7+, Firefox, Chrome, Opera, Safari
|
102 |
+
xmlhttp = new XMLHttpRequest();
|
103 |
+
} else {
|
104 |
+
// code for IE6, IE5
|
105 |
+
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
106 |
+
}
|
107 |
+
|
108 |
xmlhttp.onreadystatechange = function() {
|
109 |
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
|
110 |
var response = xmlhttp.responseText;
|
115 |
} else if (callbackOnOther != '') {
|
116 |
callbackOnOther(response);
|
117 |
}
|
118 |
+
window.klarnaAjaxRunning = 0;
|
119 |
+
//console.log("The request is done : " + url);
|
120 |
+
initiateFromKlarnaAjaxArray();
|
121 |
}
|
122 |
}
|
123 |
+
|
124 |
+
//console.log("The request is starting : " + url);
|
125 |
+
window.klarnaAjaxRunning = 1;
|
126 |
+
xmlhttp.open("POST", url);
|
127 |
+
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
128 |
+
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
129 |
+
xmlhttp.send(dataString);
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
};
|
132 |
|
133 |
// fade out
|
279 |
}
|
280 |
|
281 |
return elements.join('&');
|
282 |
+
};
|
283 |
+
|
284 |
+
var KlarnaLogin = (function () {
|
285 |
+
"use strict";
|
286 |
+
|
287 |
+
var me = function (config) {
|
288 |
+
var cfg = config || {};
|
289 |
+
|
290 |
+
this.form = cfg.form || document.getElementById('klarna_form-login');
|
291 |
+
this.registerListeners();
|
292 |
+
};
|
293 |
+
|
294 |
+
me.prototype.registerListeners = function () {
|
295 |
+
if(this.form) {
|
296 |
+
this.form.addEventListener('submit', this.doLogin.bind(this));
|
297 |
+
}
|
298 |
+
};
|
299 |
+
|
300 |
+
me.prototype.doLogin = function (e) {
|
301 |
+
e.preventDefault();
|
302 |
+
|
303 |
+
var form = e.target,
|
304 |
+
data = form.serialize(false),
|
305 |
+
url = form.action;
|
306 |
+
|
307 |
+
vanillaAjax(url, data, this.successCallback.bind(this), this.errorCallback.bind(this), '', true);
|
308 |
+
};
|
309 |
+
|
310 |
+
me.prototype.showMessage = function (message) {
|
311 |
+
var messageEl = document.getElementById('klarna_msg'),
|
312 |
+
messageContentEl = messageEl.querySelector('.klarna_msg-content');
|
313 |
+
|
314 |
+
messageContentEl.textContent = message;
|
315 |
+
fadeIn(messageEl);
|
316 |
+
};
|
317 |
+
|
318 |
+
me.prototype.successCallback = function (response) {
|
319 |
+
var data = JSON.parse(response),
|
320 |
+
messageEl = document.getElementById('klarna_msg');
|
321 |
+
|
322 |
+
// Show message if we get a response code
|
323 |
+
if(!isNaN(data['r_code'])) {
|
324 |
+
|
325 |
+
if (data['r_code'] < 0) { // Error
|
326 |
+
if (!messageEl.classList.contains('error')) {
|
327 |
+
messageEl.classList.add('error');
|
328 |
+
}
|
329 |
+
this.showMessage(data.message);
|
330 |
+
} else {
|
331 |
+
messageEl.classList.remove('error'); // Success
|
332 |
+
this.showMessage(data.message);
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
if (typeof data.reload_checkout !== "undefined" && data.reload_checkout == 1) {
|
337 |
+
window.location.reload();
|
338 |
+
}
|
339 |
+
};
|
340 |
+
|
341 |
+
me.prototype.errorCallback = function (response) {
|
342 |
+
try {
|
343 |
+
var data = JSON.parse(response);
|
344 |
+
this.showMessage(data.message);
|
345 |
+
}
|
346 |
+
catch (e) {
|
347 |
+
var loginFailedText = Translator.translate("Could not log in. Please try again");
|
348 |
+
this.showMessage(loginFailedText);
|
349 |
+
}
|
350 |
+
|
351 |
+
console.log("Login failed! Here's the data:");
|
352 |
+
console.log(data);
|
353 |
+
};
|
354 |
+
|
355 |
+
return me;
|
356 |
+
})();
|
357 |
+
|
358 |
+
var KlarnaResponsive = (function () {
|
359 |
+
var me = function (config) {
|
360 |
+
var cfg = config || {};
|
361 |
+
|
362 |
+
this.element = cfg.element || document.getElementById('klarna_container');
|
363 |
+
this.isRunning = false;
|
364 |
+
this.storedSidebarEl = document.createDocumentFragment();
|
365 |
+
this.mobileBreakPoint = 992;
|
366 |
+
|
367 |
+
// Only run init functions if the site admin has set the Klarna module to use the responsive layout
|
368 |
+
if(this.getLayout() === 'two-column') {
|
369 |
+
this.registerListeners();
|
370 |
+
this.updateLayout();
|
371 |
+
}
|
372 |
+
};
|
373 |
+
|
374 |
+
me.prototype.registerListeners = function () {
|
375 |
+
window.addEventListener('resize', resize.bind(this));
|
376 |
+
};
|
377 |
+
|
378 |
+
function resize(e) {
|
379 |
+
if (!this.isRunning) {
|
380 |
+
this.isRunning = true;
|
381 |
+
|
382 |
+
if (window.requestAnimationFrame) {
|
383 |
+
window.requestAnimationFrame(this.updateLayout.bind(this));
|
384 |
+
} else {
|
385 |
+
setTimeout(this.updateLayout.bind(this), 66);
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
|
390 |
+
me.prototype.getLayout = function () {
|
391 |
+
var layoutVal = parseInt(this.element.getAttribute('data-layout'));
|
392 |
+
|
393 |
+
if(layoutVal === 0) {
|
394 |
+
return 'default';
|
395 |
+
}
|
396 |
+
else if (layoutVal === 1) {
|
397 |
+
return 'two-column';
|
398 |
+
}
|
399 |
+
|
400 |
+
return '';
|
401 |
+
};
|
402 |
+
|
403 |
+
me.prototype.getDesktopLayout = function (el) {
|
404 |
+
var sidebarEls = getSidebarElements(el),
|
405 |
+
docFragment = document.createDocumentFragment(),
|
406 |
+
fragmentSidebarEl,
|
407 |
+
sidebarEl = el || this.storedSidebarEl;
|
408 |
+
|
409 |
+
if (el !== "undefined") {
|
410 |
+
docFragment.appendChild(sidebarEl);
|
411 |
+
} else {
|
412 |
+
if (sidebarEl) {
|
413 |
+
docFragment.appendChild(sidebarEl);
|
414 |
+
}
|
415 |
+
fragmentSidebarEl = docFragment.querySelector('#klarna_sidebar');
|
416 |
+
|
417 |
+
// Add all sidebar items to the temporary sidebar fragment
|
418 |
+
if (sidebarEls.payment) {
|
419 |
+
fragmentSidebarEl.appendChild(sidebarEls.payment);
|
420 |
+
}
|
421 |
+
if (sidebarEls.shipping) {
|
422 |
+
fragmentSidebarEl.appendChild(sidebarEls.shipping);
|
423 |
+
}
|
424 |
+
if (sidebarEls.cart) {
|
425 |
+
fragmentSidebarEl.appendChild(sidebarEls.cart);
|
426 |
+
}
|
427 |
+
if (sidebarEls.discount) {
|
428 |
+
fragmentSidebarEl.appendChild(sidebarEls.discount);
|
429 |
+
}
|
430 |
+
}
|
431 |
+
|
432 |
+
return docFragment;
|
433 |
+
};
|
434 |
+
|
435 |
+
me.prototype.setMobileLayout = function (el) {
|
436 |
+
var groupedEls = getSidebarElements(el, true),
|
437 |
+
sidebarEls = getSidebarElements(el),
|
438 |
+
mainContentEl = document.getElementById('klarna_main'),
|
439 |
+
iframeEl = document.getElementById('klarna_checkout'),
|
440 |
+
tempEl = document.createDocumentFragment();
|
441 |
+
|
442 |
+
for(var key in groupedEls) {
|
443 |
+
if(groupedEls.hasOwnProperty(key) && groupedEls[key] != null) {
|
444 |
+
tempEl.appendChild(groupedEls[key]);
|
445 |
+
}
|
446 |
+
}
|
447 |
+
|
448 |
+
mainContentEl.insertBefore(tempEl, iframeEl);
|
449 |
+
if (sidebarEls.payment) {
|
450 |
+
mainContentEl.appendChild(sidebarEls.payment);
|
451 |
+
}
|
452 |
+
};
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Gets the sidebar children elements as an object
|
456 |
+
* @param sidebarEl (optional)
|
457 |
+
* @param getGroup
|
458 |
+
* @returns {{cart: HTMLElement, shipping: HTMLElement, discount: HTMLElement}}
|
459 |
+
*/
|
460 |
+
function getSidebarElements (sidebarEl, getGroup) {
|
461 |
+
var ref = sidebarEl || document,
|
462 |
+
cartEl = document.getElementById('klarna_cart-container') ? document.getElementById('klarna_cart-container') : ref.querySelector('#klarna_cart-container'),
|
463 |
+
shippingEl = document.getElementById('klarna_shipping') ? document.getElementById('klarna_shipping') : ref.querySelector('#klarna_shipping'),
|
464 |
+
discountEl = document.getElementById('klarna_discount') ? document.getElementById('klarna_discount') : ref.querySelector('#klarna_discount'),
|
465 |
+
groupedEls = {
|
466 |
+
cart: cartEl,
|
467 |
+
shipping: shippingEl,
|
468 |
+
discount: discountEl
|
469 |
+
},
|
470 |
+
sidebarEls = groupedEls;
|
471 |
+
|
472 |
+
sidebarEls.payment = document.getElementById('klarna_methods') ? document.getElementById('klarna_methods') : ref.querySelector('#klarna_methods');
|
473 |
+
|
474 |
+
return getGroup ? groupedEls : sidebarEls;
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Checks if the current viewport width corresponds to the predefined mobile breakpoint
|
479 |
+
* and if so changes the layout to mobile. Otherwise the layout is set to desktop.
|
480 |
+
*/
|
481 |
+
me.prototype.updateLayout = function () {
|
482 |
+
var sidebarEl = document.getElementById('klarna_sidebar'),
|
483 |
+
klarnaContainer = document.getElementById('klarna_container'),
|
484 |
+
mainContentEl = document.getElementById('klarna_main'),
|
485 |
+
cartEl = document.getElementById('klarna_cart-container');
|
486 |
+
|
487 |
+
if(this.getMode() === 'mobile' && sidebarEl && !mainContentEl.contains(cartEl)) {
|
488 |
+
this.storedSidebarEl = sidebarEl.cloneNode(false);
|
489 |
+
|
490 |
+
this.setMobileLayout();
|
491 |
+
|
492 |
+
sidebarEl.parentNode.removeChild(sidebarEl);
|
493 |
+
}
|
494 |
+
else if(this.getMode() === 'desktop' && !sidebarEl && mainContentEl.contains(cartEl)) {
|
495 |
+
klarnaContainer.appendChild(this.getDesktopLayout());
|
496 |
+
}
|
497 |
+
|
498 |
+
this.isRunning = false;
|
499 |
+
};
|
500 |
+
|
501 |
+
me.prototype.getMode = function () {
|
502 |
+
var viewportWidth = window.innerWidth;
|
503 |
+
|
504 |
+
if(viewportWidth < this.mobileBreakPoint) {
|
505 |
+
return 'mobile';
|
506 |
+
}
|
507 |
+
else if(viewportWidth >= this.mobileBreakPoint) {
|
508 |
+
return 'desktop';
|
509 |
+
}
|
510 |
+
else {
|
511 |
+
return false;
|
512 |
+
}
|
513 |
+
};
|
514 |
+
|
515 |
+
/**
|
516 |
+
* Renders the given element as a sidebar or as a part of the main content depending
|
517 |
+
* on whether the browser window is in "mobile" or "desktop" mode. This is mostly intended to be used
|
518 |
+
* when the cart is updated through AJAX as the AJAX response will typically be an html view.
|
519 |
+
* @param el {HTMLElement}
|
520 |
+
*/
|
521 |
+
me.prototype.drawLayoutForElement = function (el) {
|
522 |
+
if(!el) {
|
523 |
+
return false;
|
524 |
+
}
|
525 |
+
|
526 |
+
var klarnaContainer = document.getElementById('klarna_container'),
|
527 |
+
mainContentEl = document.getElementById('klarna_main');
|
528 |
+
|
529 |
+
if(this.getMode() === 'mobile') {
|
530 |
+
var sidebarEls = getSidebarElements(null, true);
|
531 |
+
|
532 |
+
// Remove all the current sidebar items inside the main content area
|
533 |
+
for(var key in sidebarEls) {
|
534 |
+
if(sidebarEls.hasOwnProperty(key) && sidebarEls[key] != null) {
|
535 |
+
mainContentEl.removeChild(sidebarEls[key]);
|
536 |
+
}
|
537 |
+
}
|
538 |
+
|
539 |
+
this.setMobileLayout(el);
|
540 |
+
}
|
541 |
+
else {
|
542 |
+
var newSidebar = this.getDesktopLayout(el);
|
543 |
+
klarnaContainer.replaceChild(newSidebar, klarnaContainer.querySelector('#klarna_sidebar'));
|
544 |
+
}
|
545 |
+
};
|
546 |
+
|
547 |
+
return me;
|
548 |
+
})();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>klarnapayments</name>
|
4 |
-
<version>5.
|
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>2015-
|
14 |
-
<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="744b3c349a84d348f0571852888dee8e"/></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="473e03908fdb841f7152ed78671fcef0"/></dir><file name="checkout.phtml" hash="fe86056c73f86d53a73ebda5c5f3547c"/><dir name="children"><file name="addressresult.phtml" hash="4bb8fd4309c9b4012bfeb2d31c90076a"/><file name="checkoutservice.phtml" hash="3ae5ecf2420cb457304ef0b9f4227b9c"/><file name="consent.phtml" hash="a4f446258fa20a453d3566cffc20085d"/><file name="dateofbirth.phtml" hash="e1dbe367ce43029d671dae6f7d3ca956"/><file name="gender.phtml" hash="c8428e9b76db957a866cfc109d7a0c09"/><file name="notifications.phtml" hash="485d9f8e90ca6ff3c8152d2c3a0ee138"/><file name="paymentplan_information.phtml" hash="8f28c418c08df3e664744ef28bc283c3"/><file name="pclass.phtml" hash="848a7e485badbdf11d10628c93906b21"/><file name="personalnumber.phtml" hash="dcea08f692ed978689242ba8309f3cdb"/><file name="phonenumber.phtml" hash="6348b12795e073d8881ab0b74d7df175"/></dir><file name="invoice.phtml" hash="96495650061287f034fd789a372359a2"/><dir name="paymentplan"><file name="information.phtml" hash="d013f147f38502cb4baf591d56d177d9"/></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="account-login.phtml" hash="08279a9c8ecb32c4b7de2fe643aacb61"/><file name="autofill.phtml" hash="6bdd6c22fd1771106f52876e66d7f4de"/><dir name="cart"><dir name="item"><file name="default.phtml" hash="cb76c84ce20dbd391a1615756f2d72d7"/></dir><file name="totals.phtml" hash="a8496f65d2bd8390cee2bb5c89bad555"/></dir><file name="cart.phtml" hash="f81a950407bd23fe476e03854fe4928b"/><file name="checkout.phtml" hash="c71826694ac6270f82a05e69a896d66b"/><dir name="customer"><file name="balance.phtml" hash="af890728b26b0808c299ab199bc5f4c0"/></dir><file name="default.phtml" hash="357abf99f4cb926d728c7c5253ea4b1e"/><dir name="discount"><file name="coupon.phtml" hash="0e4c2c52f677212b2071e3acddcc217a"/><file name="giftcardaccount.phtml" hash="8895e32abbc97d84fce366221637a1d9"/></dir><file name="discount.phtml" hash="7ce3289506c3e8abdd4af610e0f7f273"/><file name="header.phtml" hash="72a8383c77bbdcbf0b7ecbbc98098cf7"/><file name="klarnacheckout.phtml" hash="a51ee31586f4cbeb5bfe0ffe1ca32c84"/><file name="main.phtml" hash="079d3162d46b762574eb2cd4641c14c2"/><file name="msg.phtml" hash="d716a2a466835c99f71bea1742533cc0"/><file name="newsletter.phtml" hash="34e007c7bd516cd37e93cb5bd9f19478"/><file name="othermethod.phtml" hash="ae8ab1ec8ec3de1546cb5bafcf34fcc4"/><file name="reward.phtml" hash="0e1d0a7d42738662fddd04dab09f5765"/><dir name="shipping_method"><file name="available.phtml" hash="62991e138e2a296fc0aff83ebfae2aea"/></dir><file name="shipping_method.phtml" hash="78afd96ad7c9facd083673c1122e6d42"/><file name="sidebar.phtml" hash="a8c13bf43d0c415f153d198a2bb6fa1f"/><file name="success.phtml" hash="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="64cfdbb02d0246455199fdc9e8102229"/></dir><dir name="de_AT"><file name="Vaimo_Klarna.csv" hash="55154195257090edded254824700bf77"/></dir><dir name="de_DE"><file name="Vaimo_Klarna.csv" hash="b92f42663b4ba46b0d4a2b1c25ff4bac"/></dir><dir name="fi_FI"><file name="Vaimo_Klarna.csv" hash="5314f647852b0fef0e4dbe6c0f03bae0"/></dir><dir name="nb_NO"><file name="Vaimo_Klarna.csv" hash="151680993f4a94d14f661c485b0cb3f1"/></dir><dir name="nl_NL"><file name="Vaimo_Klarna.csv" hash="382ee1100c720d8d0019618fd37ce1c5"/></dir><dir name="nn_NO"><file name="Vaimo_Klarna.csv" hash="7b78711096873772f9c7d2389319cc1d"/></dir><dir name="sv_SE"><file name="Vaimo_Klarna.csv" hash="02f679cc801f247f0a7b01ff94c62974"/></dir></target><target name="mage"><dir name="js"><dir name="vaimo"><dir name="klarna"><file name="klarna.js" hash="9462fee4ca415ee3d11a00d8b85548ec"/><file name="klarnacheckout.js" hash="fe1c1d0d6d453a9cfa423276345391d7"/><file name="klarnautils.js" hash="63e9ee0cdeaf24a0c3498c65f8377a3e"/></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="7d7fe12675f4ba51ad1fd608849f06ce"/><file name="checkout_osc.css" hash="126a8d2869872306ded4aef943db809c"/><file name="global.css" hash="22b6a446e6e874e6a95608f7046eac2a"/><file name="klarnacheckout.css" hash="00c9b9ec2e2458207a7e6a8fe061529a"/><file name="klarnadefault.css" hash="30bff2ef19a5a70b4ee9a458c504870c"/><file name="product.css" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="vendor"><file name="bootstrap-grid.css" hash="093d2cb25f2e4d0bc80233ed70cbcb9a"/><file name="bootstrap-grid.min.css" hash="9087d9a8c2457c96b6c216fea959b298"/><file name="fontawesome.css" hash="76ca4ed8592634fb5c421b4e19c35918"/><file name="fontawesome.min.css" hash="7b7b345da453c034563dd2ac7ca9666b"/><dir name="fonts"><file name="FontAwesome.otf" hash="19231917733e2bcdf257c9be99cdbaf1"/><file name="fontawesome-webfont.eot" hash="7149833697a959306ec3012a8588dcfa"/><file name="fontawesome-webfont.svg" hash="65bcbc899f379216109acd0b6c494618"/><file name="fontawesome-webfont.ttf" hash="c4668ed2440df82d3fd2f8be9d31d07d"/><file name="fontawesome-webfont.woff" hash="d95d6f5d5ab7cfefd09651800b69bd54"/></dir></dir></dir></dir></dir><dir name="images"><dir name="vaimo"><dir name="klarna"><file name="balk_afm3.jpg" hash="8855567960bff35b1e3ba486670b5878"/><file name="icons.png" hash="7f0808d4cf63c3d43637d40a703f30fe"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Vaimo"><dir name="Klarna"><dir name="Block"><dir name="Adminhtml"><dir name="Pclass"><file name="List.php" hash="7c68e3ec74e5cea1b62bb0218d297089"/><file name="Update.php" hash="fd444645b9f78fc4ea65c91ee3fc0044"/></dir><dir name="Sales"><dir name="Creditmemo"><dir name="Create"><file name="Adjustments.php" hash="12074f6aabbe90f14b8d30b7f65da9dc"/></dir><file name="Totals.php" hash="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="a77d8ca953136f3fe9797166f8a51e93"/></dir></dir><dir name="Checkout"><file name="Fee.php" hash="1ffae1896b12e6d87fbbd2d3843fef75"/><file name="Top.php" hash="a8f9084322c1f924ef6fb4802908019d"/></dir><dir name="Form"><file name="Abstract.php" hash="da5fa0957ab2b1e3b57ca99a9323fadb"/><file name="Account.php" hash="f6bf008c1af0b93ead5b5a2577b59ea5"/><dir name="Address"><file name="Search.php" hash="439e9f9a5d9480a4356043bb73f9c9c7"/></dir><file name="Checkout.php" hash="a7e6876317a29184f07040b646b84ec7"/><file name="Invoice.php" hash="105a41b84e52b45f26f3c5de2d4bdd4a"/><dir name="Paymentplan"><file name="Information.php" hash="7c66acd887a1e3a165e3cd967d0f3331"/></dir><file name="Special.php" hash="8db5a5f33510cd32d724c6ecd6368aa2"/></dir><dir name="Info"><file name="Abstract.php" hash="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="4fb4d1c806c2224d20a388b62f027e33"/><dir name="Customer"><file name="Balance.php" hash="e35153845d979d91ff79d0558e7b6c0b"/></dir><file name="Discount.php" hash="d56512c70315f0ad2ee1f8b857f30c78"/><file name="Ga.php" hash="e69dc6575162c137669bc6fba3d854cd"/><file name="Klarnacheckout.php" hash="ee3f18170c2fcb885076b36d06c8db5e"/><file name="Newsletter.php" hash="ce97e11c097b0cd9696919936fa59dc6"/><file name="Othermethod.php" hash="09155e9bd989e68ba6bcaa81ae359dd8"/><file name="Reward.php" hash="98d72b6cf65070dcb4cc87a303cd8b54"/><file name="Success.php" hash="88e538e4c165142c55d74a3efecebef6"/></dir><dir name="Order"><file name="Totals.php" hash="2e56335ff1b4a1d6752e7336b107bd13"/></dir><dir name="Page"><dir name="Html"><file name="Logo.php" hash="fda8fc32997328feb9c7ebf15c8a51fa"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Position"><dir name="Attribute"><file name="Set.php" hash="b47d1dff880be4e0d22f8f169f180bc3"/></dir></dir><file name="Position.php" hash="469a02a99354ae219f5b744b248c76b8"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AddressController.php" hash="e3272d6463e7ea0082c249924c31e34b"/><dir name="Adminhtml"><dir name="Klarna"><file name="MassactionController.php" hash="e182c149c750934ae4463efb96f5091c"/><file name="PclassController.php" hash="3a83e55251281b4414d7099b4481e245"/></dir></dir><dir name="Checkout"><file name="KlarnaController.php" hash="6390738fca94bf31d4ba9c7a0233eebf"/></dir><file name="LoginController.php" hash="3c7e56482f9af9ed0696fb0507cc5444"/><file name="PaymentplanController.php" hash="fea9d33a5dbd5d4858ef174569dae636"/></dir><dir name="etc"><file name="config.xml" hash="b8e70499a2d7b547dec06f114f072d37"/><file name="system.xml" hash="4eb8cb1423fd87a85471e7e9d21b68d1"/></dir><dir name="Helper"><file name="Data.php" hash="d8e90a724272fbd006a57308115c9cf2"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Admin"><file name="Json.php" hash="e6413eca01dc9e4e6715e518ffa59eae"/></dir></dir></dir></dir></dir><dir name="Api"><file name="Abstract.php" hash="83e5d60fee0d104ef283a6abcba6d391"/><file name="Kco.php" hash="566451bf8c3299037cb51c8b5f9710bf"/><file name="Rest.php" hash="893619071a40809c4887b4aaca32a6ee"/><file name="Xmlrpc.php" hash="37696a1c20760e3aef620a392ca0bfe8"/></dir><file name="Api.php" hash="aea682b90c3c046515808ab8d444eecc"/><dir name="Creditmemo"><file name="Tax.php" hash="c3d5162de38f5ef2075bca483085e5d0"/><file name="Total.php" hash="8da0e6596826ba5fc03695e7834734f0"/></dir><file name="Cron.php" hash="ce9f0c59c6772af96f0132335dc3a194"/><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="06412f97df9ac6a1854978b61f68fb36"/></dir><file name="Tax.php" hash="b2203547b3f05d6179e7307d14b55c6d"/><file name="Total.php" hash="c2f4a2207550915e1aaa9868e6759f94"/></dir><dir name="Klarna"><file name="Abstract.php" hash="bbe5b02445fba6bd26222a638bfd0f75"/></dir><file name="Klarna.php" hash="9638b2c470b2908072b50709556198ee"/><dir name="Klarnacheckout"><file name="Abstract.php" hash="adff3707bf6b3c9bed26282ed67e3afc"/></dir><file name="Klarnacheckout.php" hash="e301e30f62582c6c4a6e6cfc2f6aa015"/><file name="Observer.php" hash="91642cabebb5846e5bfcb1b251de89c9"/><dir name="Payment"><file name="Abstract.php" hash="2e1cc5592202e53fcbe9354da156e450"/><file name="Account.php" hash="95931980dba66fc274f3acfa4df2b91a"/><file name="Checkout.php" hash="d8fb8bbadb12a901f782ed7067d12bc2"/><file name="Invoice.php" hash="eef0e5ea5466469942a14d28e8507333"/><file name="Special.php" hash="53754f59a474e32f168220c795b80c2f"/></dir><dir name="Quote"><file name="Tax.php" hash="b53f4a52d0f09afc7daeb094d6e30881"/><file name="Total.php" hash="a1442ecba3f2c49a42ff43e006057878"/></dir><dir name="Resource"><dir name="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="64c78e105f7934dca2f59da41ef137d4"/><file name="Capture.php" hash="c2d31ebb607202555e9905e439dbe86d"/><file name="Country.php" hash="2444140a6155e42d2e4909ae150037b7"/><file name="Customergroup.php" hash="01c6e41abac6e7105e4d290f53f68733"/><file name="Klarnalayout.php" hash="6c7b9d3a871d8cdb2a11a0cadde83f4a"/><file name="Language.php" hash="530e4780b702f641f993ba0e49382d5d"/><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="6473d1e8fe180f55c0b3a461a16c3383"/></dir></dir><dir name="sql"><dir name="klarna_setup"><file name="mysql4-install-0.1.0.php" hash="d36b51433fd28241386594f39def3080"/><file name="mysql4-upgrade-5.1.6-5.1.7.php" hash="014a7b827a8958a94c57a0229127a427"/><file name="mysql4-upgrade-5.2.5-5.2.6.php" hash="1dd874e1a94730ab976b6187a34e6c77"/></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.3.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Klarna payment module for Klarna Checkout, invoice and part payments. This module works for all countries were Klarna's product offering is applicable. To use this module requires that you have a contract with Klarna.</description>
|
11 |
<notes>This version is not compatible with any Klarna module version of 4.x or earlier.</notes>
|
12 |
<authors><author><name>Klarna</name><user>Klarna</user><email>magento@klarna.com</email></author><author><name>Vaimo</name><user>VAIMO</user><email>info@vaimo.com</email></author></authors>
|
13 |
+
<date>2015-06-17</date>
|
14 |
+
<time>15:12:58</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="744b3c349a84d348f0571852888dee8e"/></dir><dir name="template"><dir name="vaimo"><dir name="klarna"><dir name="catalog"><dir name="product"><file name="pricewidget.phtml" hash="ade52495b519d3cfd6f53a4285be895f"/></dir></dir><dir name="checkout"><file name="fee.phtml" hash="3a58d7e7278bf9fcae1cdb9d836d4ff3"/><file name="header.phtml" hash="51a7f95f2fcb5f7b02e19b13690631a8"/><file name="top.phtml" hash="9cc1ce32346bd6ed7c16139f3f960a95"/></dir><dir name="form"><file name="account.phtml" hash="78ec2685231b4664ec9106be2fb1b847"/><dir name="address"><file name="search.phtml" hash="473e03908fdb841f7152ed78671fcef0"/></dir><file name="checkout.phtml" hash="fe86056c73f86d53a73ebda5c5f3547c"/><dir name="children"><file name="addressresult.phtml" hash="4bb8fd4309c9b4012bfeb2d31c90076a"/><file name="checkoutservice.phtml" hash="3ae5ecf2420cb457304ef0b9f4227b9c"/><file name="consent.phtml" hash="a4f446258fa20a453d3566cffc20085d"/><file name="dateofbirth.phtml" hash="e1dbe367ce43029d671dae6f7d3ca956"/><file name="gender.phtml" hash="c8428e9b76db957a866cfc109d7a0c09"/><file name="notifications.phtml" hash="485d9f8e90ca6ff3c8152d2c3a0ee138"/><file name="paymentplan_information.phtml" hash="8f28c418c08df3e664744ef28bc283c3"/><file name="pclass.phtml" hash="848a7e485badbdf11d10628c93906b21"/><file name="personalnumber.phtml" hash="dcea08f692ed978689242ba8309f3cdb"/><file name="phonenumber.phtml" hash="6348b12795e073d8881ab0b74d7df175"/></dir><file name="invoice.phtml" hash="96495650061287f034fd789a372359a2"/><dir name="paymentplan"><file name="information.phtml" hash="d013f147f38502cb4baf591d56d177d9"/></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="account-login.phtml" hash="487de8f489b7e65416bf3559e1819abd"/><file name="autofill.phtml" hash="6bdd6c22fd1771106f52876e66d7f4de"/><dir name="cart"><dir name="item"><file name="default.phtml" hash="cb76c84ce20dbd391a1615756f2d72d7"/></dir><file name="totals.phtml" hash="a8496f65d2bd8390cee2bb5c89bad555"/></dir><file name="cart.phtml" hash="f81a950407bd23fe476e03854fe4928b"/><file name="checkout.phtml" hash="c71826694ac6270f82a05e69a896d66b"/><dir name="customer"><file name="balance.phtml" hash="af890728b26b0808c299ab199bc5f4c0"/></dir><file name="default.phtml" hash="357abf99f4cb926d728c7c5253ea4b1e"/><dir name="discount"><file name="coupon.phtml" hash="0e4c2c52f677212b2071e3acddcc217a"/><file name="giftcardaccount.phtml" hash="8895e32abbc97d84fce366221637a1d9"/></dir><file name="discount.phtml" hash="7ce3289506c3e8abdd4af610e0f7f273"/><file name="header.phtml" hash="72a8383c77bbdcbf0b7ecbbc98098cf7"/><file name="klarnacheckout.phtml" hash="a51ee31586f4cbeb5bfe0ffe1ca32c84"/><file name="main.phtml" hash="079d3162d46b762574eb2cd4641c14c2"/><file name="msg.phtml" hash="d716a2a466835c99f71bea1742533cc0"/><file name="newsletter.phtml" hash="34e007c7bd516cd37e93cb5bd9f19478"/><file name="othermethod.phtml" hash="f619075a30bf6240753a186636b5c2f4"/><file name="reward.phtml" hash="0e1d0a7d42738662fddd04dab09f5765"/><dir name="shipping_method"><file name="available.phtml" hash="62991e138e2a296fc0aff83ebfae2aea"/></dir><file name="shipping_method.phtml" hash="78afd96ad7c9facd083673c1122e6d42"/><file name="sidebar.phtml" hash="a8c13bf43d0c415f153d198a2bb6fa1f"/><file name="success.phtml" hash="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="64cfdbb02d0246455199fdc9e8102229"/></dir><dir name="de_AT"><file name="Vaimo_Klarna.csv" hash="55154195257090edded254824700bf77"/></dir><dir name="de_DE"><file name="Vaimo_Klarna.csv" hash="b92f42663b4ba46b0d4a2b1c25ff4bac"/></dir><dir name="fi_FI"><file name="Vaimo_Klarna.csv" hash="5314f647852b0fef0e4dbe6c0f03bae0"/></dir><dir name="nb_NO"><file name="Vaimo_Klarna.csv" hash="151680993f4a94d14f661c485b0cb3f1"/></dir><dir name="nl_NL"><file name="Vaimo_Klarna.csv" hash="382ee1100c720d8d0019618fd37ce1c5"/></dir><dir name="nn_NO"><file name="Vaimo_Klarna.csv" hash="7b78711096873772f9c7d2389319cc1d"/></dir><dir name="sv_SE"><file name="Vaimo_Klarna.csv" hash="02f679cc801f247f0a7b01ff94c62974"/></dir></target><target name="mage"><dir name="js"><dir name="vaimo"><dir name="klarna"><file name="klarna.js" hash="9462fee4ca415ee3d11a00d8b85548ec"/><file name="klarnacheckout.js" hash="ff4dd375e6bcd9ae0a27e53fb7799825"/><file name="klarnautils.js" hash="d7cea514ef3e9adc4f7d9a107b1a838f"/></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="7d7fe12675f4ba51ad1fd608849f06ce"/><file name="checkout_osc.css" hash="126a8d2869872306ded4aef943db809c"/><file name="global.css" hash="22b6a446e6e874e6a95608f7046eac2a"/><file name="klarnacheckout.css" hash="00c9b9ec2e2458207a7e6a8fe061529a"/><file name="klarnadefault.css" hash="30bff2ef19a5a70b4ee9a458c504870c"/><file name="product.css" hash="ef6a838858ceb0c1ef6364bb089273c0"/><dir name="vendor"><file name="bootstrap-grid.css" hash="093d2cb25f2e4d0bc80233ed70cbcb9a"/><file name="bootstrap-grid.min.css" hash="9087d9a8c2457c96b6c216fea959b298"/><file name="fontawesome.css" hash="76ca4ed8592634fb5c421b4e19c35918"/><file name="fontawesome.min.css" hash="7b7b345da453c034563dd2ac7ca9666b"/><dir name="fonts"><file name="FontAwesome.otf" hash="19231917733e2bcdf257c9be99cdbaf1"/><file name="fontawesome-webfont.eot" hash="7149833697a959306ec3012a8588dcfa"/><file name="fontawesome-webfont.svg" hash="65bcbc899f379216109acd0b6c494618"/><file name="fontawesome-webfont.ttf" hash="c4668ed2440df82d3fd2f8be9d31d07d"/><file name="fontawesome-webfont.woff" hash="d95d6f5d5ab7cfefd09651800b69bd54"/></dir></dir></dir></dir></dir><dir name="images"><dir name="vaimo"><dir name="klarna"><file name="balk_afm3.jpg" hash="8855567960bff35b1e3ba486670b5878"/><file name="icons.png" hash="7f0808d4cf63c3d43637d40a703f30fe"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Vaimo"><dir name="Klarna"><dir name="Block"><dir name="Adminhtml"><dir name="Pclass"><file name="List.php" hash="7c68e3ec74e5cea1b62bb0218d297089"/><file name="Update.php" hash="fd444645b9f78fc4ea65c91ee3fc0044"/></dir><dir name="Sales"><dir name="Creditmemo"><dir name="Create"><file name="Adjustments.php" hash="12074f6aabbe90f14b8d30b7f65da9dc"/></dir><file name="Totals.php" hash="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="a77d8ca953136f3fe9797166f8a51e93"/></dir></dir><dir name="Checkout"><file name="Fee.php" hash="1ffae1896b12e6d87fbbd2d3843fef75"/><file name="Top.php" hash="a8f9084322c1f924ef6fb4802908019d"/></dir><dir name="Form"><file name="Abstract.php" hash="da5fa0957ab2b1e3b57ca99a9323fadb"/><file name="Account.php" hash="f6bf008c1af0b93ead5b5a2577b59ea5"/><dir name="Address"><file name="Search.php" hash="439e9f9a5d9480a4356043bb73f9c9c7"/></dir><file name="Checkout.php" hash="a7e6876317a29184f07040b646b84ec7"/><file name="Invoice.php" hash="105a41b84e52b45f26f3c5de2d4bdd4a"/><dir name="Paymentplan"><file name="Information.php" hash="7c66acd887a1e3a165e3cd967d0f3331"/></dir><file name="Special.php" hash="8db5a5f33510cd32d724c6ecd6368aa2"/></dir><dir name="Info"><file name="Abstract.php" hash="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="4fb4d1c806c2224d20a388b62f027e33"/><dir name="Customer"><file name="Balance.php" hash="e35153845d979d91ff79d0558e7b6c0b"/></dir><file name="Discount.php" hash="d56512c70315f0ad2ee1f8b857f30c78"/><file name="Ga.php" hash="e69dc6575162c137669bc6fba3d854cd"/><file name="Klarnacheckout.php" hash="ee3f18170c2fcb885076b36d06c8db5e"/><file name="Newsletter.php" hash="ce97e11c097b0cd9696919936fa59dc6"/><file name="Othermethod.php" hash="48594b48a64dc1116e3eef44a742e472"/><file name="Reward.php" hash="98d72b6cf65070dcb4cc87a303cd8b54"/><file name="Success.php" hash="88e538e4c165142c55d74a3efecebef6"/></dir><dir name="Order"><file name="Totals.php" hash="2e56335ff1b4a1d6752e7336b107bd13"/></dir><dir name="Page"><dir name="Html"><file name="Logo.php" hash="fda8fc32997328feb9c7ebf15c8a51fa"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Position"><dir name="Attribute"><file name="Set.php" hash="b47d1dff880be4e0d22f8f169f180bc3"/></dir></dir><file name="Position.php" hash="469a02a99354ae219f5b744b248c76b8"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AddressController.php" hash="e3272d6463e7ea0082c249924c31e34b"/><dir name="Adminhtml"><dir name="Klarna"><file name="MassactionController.php" hash="e182c149c750934ae4463efb96f5091c"/><file name="PclassController.php" hash="3a83e55251281b4414d7099b4481e245"/></dir></dir><dir name="Checkout"><file name="KlarnaController.php" hash="083176de18ddace804584806e8bcdfe5"/></dir><file name="LoginController.php" hash="bc5e1832feaa3401f553c62d7473155b"/><file name="PaymentplanController.php" hash="fea9d33a5dbd5d4858ef174569dae636"/></dir><dir name="etc"><file name="config.xml" hash="069a9a452cbddd7ef36233244dbb69df"/><file name="system.xml" hash="c7790aeda2d2a2ec059de9d5c882cd06"/></dir><dir name="Helper"><file name="Data.php" hash="37d84e62d8e7bc3153b8a6213b00826d"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Admin"><file name="Json.php" hash="e6413eca01dc9e4e6715e518ffa59eae"/></dir></dir></dir></dir></dir><dir name="Api"><file name="Abstract.php" hash="83e5d60fee0d104ef283a6abcba6d391"/><file name="Kco.php" hash="a63eb99e4cc5d9abd23d2424fb01a1d2"/><file name="Rest.php" hash="bf1b9743df4dd991d78ccde1be085317"/><file name="Xmlrpc.php" hash="37696a1c20760e3aef620a392ca0bfe8"/></dir><file name="Api.php" hash="aea682b90c3c046515808ab8d444eecc"/><dir name="Creditmemo"><file name="Tax.php" hash="c3d5162de38f5ef2075bca483085e5d0"/><file name="Total.php" hash="8da0e6596826ba5fc03695e7834734f0"/></dir><file name="Cron.php" hash="ce9f0c59c6772af96f0132335dc3a194"/><dir name="Invoice"><dir name="Pdf"><file name="Total.php" hash="06412f97df9ac6a1854978b61f68fb36"/></dir><file name="Tax.php" hash="b2203547b3f05d6179e7307d14b55c6d"/><file name="Total.php" hash="c2f4a2207550915e1aaa9868e6759f94"/></dir><dir name="Klarna"><file name="Abstract.php" hash="bbe5b02445fba6bd26222a638bfd0f75"/></dir><file name="Klarna.php" hash="9638b2c470b2908072b50709556198ee"/><dir name="Klarnacheckout"><file name="Abstract.php" hash="adff3707bf6b3c9bed26282ed67e3afc"/></dir><file name="Klarnacheckout.php" hash="5d7377da11ad7cbd26a8c6f14d24bbe2"/><file name="Observer.php" hash="f44cdd7b899c5eceb12da74ab80937d1"/><dir name="Payment"><file name="Abstract.php" hash="2e1cc5592202e53fcbe9354da156e450"/><file name="Account.php" hash="95931980dba66fc274f3acfa4df2b91a"/><file name="Checkout.php" hash="d8fb8bbadb12a901f782ed7067d12bc2"/><file name="Invoice.php" hash="eef0e5ea5466469942a14d28e8507333"/><file name="Special.php" hash="53754f59a474e32f168220c795b80c2f"/></dir><dir name="Quote"><file name="Tax.php" hash="b53f4a52d0f09afc7daeb094d6e30881"/><file name="Total.php" hash="a1442ecba3f2c49a42ff43e006057878"/></dir><dir name="Resource"><dir name="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="64c78e105f7934dca2f59da41ef137d4"/><file name="Capture.php" hash="c2d31ebb607202555e9905e439dbe86d"/><file name="Country.php" hash="2444140a6155e42d2e4909ae150037b7"/><file name="Customergroup.php" hash="01c6e41abac6e7105e4d290f53f68733"/><file name="Klarnalayout.php" hash="6c7b9d3a871d8cdb2a11a0cadde83f4a"/><file name="Language.php" hash="530e4780b702f641f993ba0e49382d5d"/><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="6473d1e8fe180f55c0b3a461a16c3383"/></dir></dir><dir name="sql"><dir name="klarna_setup"><file name="mysql4-install-0.1.0.php" hash="d36b51433fd28241386594f39def3080"/><file name="mysql4-upgrade-5.1.6-5.1.7.php" hash="014a7b827a8958a94c57a0229127a427"/><file name="mysql4-upgrade-5.2.5-5.2.6.php" hash="1dd874e1a94730ab976b6187a34e6c77"/></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/product.css
CHANGED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.catalog-product-view .klarna-widget.klarna-part-payment {
|
2 |
+
width:160px;
|
3 |
+
height:64px
|
4 |
+
}
|