Version Notes
Klarna Checkout module
Download this release
Release Info
Developer | Avenla Oy |
Extension | Avenla_KlarnaCheckout |
Version | 1.0.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.7 to 1.0.8
- app/code/community/Avenla/KlarnaCheckout/Block/Adminhtml/System/Config/Field/Pclass.php +63 -0
- app/code/community/Avenla/KlarnaCheckout/Block/Catalog/Product/Ppwidget.php +0 -58
- app/code/community/Avenla/KlarnaCheckout/Block/Catalog/Product/Price.php +130 -0
- app/code/community/Avenla/KlarnaCheckout/Block/KCO/Confirmation.php +0 -2
- app/code/community/Avenla/KlarnaCheckout/Helper/Data.php +1 -1
- app/code/community/Avenla/KlarnaCheckout/Model/Api.php +118 -23
- app/code/community/Avenla/KlarnaCheckout/Model/Config.php +11 -1
- app/code/community/Avenla/KlarnaCheckout/Model/KCO.php +1 -1
- app/code/community/Avenla/KlarnaCheckout/Model/Order.php +34 -18
- app/code/community/Avenla/KlarnaCheckout/Model/Source/Ppwidget.php +46 -0
- app/{design/frontend/base/default/template/KCO/catalog/product/ppwidget.phtml → code/community/Avenla/KlarnaCheckout/controllers/Adminhtml/KCOController.php} +12 -11
- app/code/community/Avenla/KlarnaCheckout/controllers/KCOController.php +36 -3
- app/code/community/Avenla/KlarnaCheckout/etc/config.xml +20 -2
- app/code/community/Avenla/KlarnaCheckout/etc/system.xml +21 -2
- app/design/adminhtml/default/default/template/KCO/system/config/field/pclass.phtml +37 -0
- app/design/frontend/base/default/layout/KCO.xml +19 -9
- app/design/frontend/base/default/template/KCO/KCO.phtml +37 -5
- app/design/frontend/base/default/template/KCO/cart.phtml +5 -2
- app/design/frontend/base/default/template/KCO/cart/giftmessage.phtml +127 -0
- app/design/frontend/base/default/template/KCO/cart/shipping.phtml +18 -2
- app/design/frontend/base/default/template/KCO/cart_twocolumns.phtml +3 -0
- app/design/frontend/base/default/template/KCO/catalog/product/price.phtml +38 -0
- app/design/frontend/base/default/template/KCO/link.phtml +2 -2
- app/locale/fi_FI/Avenla_KlarnaCheckout.csv +15 -2
- lib/Klarna/Klarna.php +2 -2
- lib/KlarnaCheckout/Checkout.php +2 -2
- lib/KlarnaCheckout/Checkout/BasicConnector.php +2 -3
- lib/KlarnaCheckout/Checkout/ConnectionErrorException.php +2 -2
- lib/KlarnaCheckout/Checkout/Connector.php +2 -2
- lib/KlarnaCheckout/Checkout/ConnectorException.php +2 -2
- lib/KlarnaCheckout/Checkout/ConnectorInterface.php +2 -2
- lib/KlarnaCheckout/Checkout/Digest.php +2 -2
- lib/KlarnaCheckout/Checkout/Exception.php +2 -2
- lib/KlarnaCheckout/Checkout/HTTP/CURLFactory.php +2 -2
- lib/KlarnaCheckout/Checkout/HTTP/CURLHandle.php +12 -2
- lib/KlarnaCheckout/Checkout/HTTP/CURLHandleInterface.php +9 -2
- lib/KlarnaCheckout/Checkout/HTTP/CURLHeaders.php +2 -2
- lib/KlarnaCheckout/Checkout/HTTP/CURLTransport.php +34 -6
- lib/KlarnaCheckout/Checkout/HTTP/Request.php +2 -2
- lib/KlarnaCheckout/Checkout/HTTP/Response.php +2 -2
- lib/KlarnaCheckout/Checkout/HTTP/Transport.php +2 -2
- lib/KlarnaCheckout/Checkout/HTTP/TransportInterface.php +2 -2
- lib/KlarnaCheckout/Checkout/Order.php +2 -2
- lib/KlarnaCheckout/Checkout/ResourceInterface.php +2 -2
- lib/KlarnaCheckout/Checkout/UserAgent.php +6 -7
- package.xml +5 -5
- skin/frontend/base/default/KCO/kco.css +6 -1
app/code/community/Avenla/KlarnaCheckout/Block/Adminhtml/System/Config/Field/Pclass.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
class Avenla_KlarnaCheckout_Block_Adminhtml_System_Config_Field_Pclass extends Mage_Adminhtml_Block_System_Config_Form_Field
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Set template
|
25 |
+
*/
|
26 |
+
public function __construct()
|
27 |
+
{
|
28 |
+
parent::__construct();
|
29 |
+
$this->setTemplate('KCO/system/config/field/pclass.phtml');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getButtonHtml()
|
33 |
+
{
|
34 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
35 |
+
->setType('button')
|
36 |
+
->setLabel(Mage::helper('klarnaCheckout')->__('Update PClasses'))
|
37 |
+
->setOnClick("javascript:updatePClasses(); return false;")
|
38 |
+
->toHtml();
|
39 |
+
|
40 |
+
return $html;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Return element html
|
45 |
+
*
|
46 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
50 |
+
{
|
51 |
+
return $this->_toHtml();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get url for update action
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function getAjaxUpdateUrl()
|
60 |
+
{
|
61 |
+
return Mage::getUrl('klarnaCheckout/adminhtml_KCO/updatePClasses/');
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Avenla/KlarnaCheckout/Block/Catalog/Product/Ppwidget.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* This file is released under a custom license by Avenla Oy.
|
4 |
-
* All rights reserved
|
5 |
-
*
|
6 |
-
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
-
* For questions and support - klarna-support@avenla.com
|
8 |
-
*
|
9 |
-
* @category Avenla
|
10 |
-
* @package Avenla_KlarnaCheckout
|
11 |
-
* @copyright Copyright (c) Avenla Oy
|
12 |
-
* @link http://www.avenla.fi
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Avenla KlarnaCheckout
|
17 |
-
*
|
18 |
-
* @category Avenla
|
19 |
-
* @package Avenla_KlarnaCheckout
|
20 |
-
*/
|
21 |
-
|
22 |
-
class Avenla_KlarnaCheckout_Block_Catalog_Product_Ppwidget extends Mage_Core_Block_Template
|
23 |
-
{
|
24 |
-
protected $_product = null;
|
25 |
-
private $config;
|
26 |
-
|
27 |
-
public function __construct()
|
28 |
-
{
|
29 |
-
$this->getProduct();
|
30 |
-
$this->config = Mage::getSingleton('klarnaCheckout/KCO')->getConfig();
|
31 |
-
|
32 |
-
return parent::_construct();
|
33 |
-
}
|
34 |
-
|
35 |
-
public function getWidgetParams()
|
36 |
-
{
|
37 |
-
return array(
|
38 |
-
'width' => 210,
|
39 |
-
'height' => 70,
|
40 |
-
'eid' => $this->config->getKlarnaEid(),
|
41 |
-
'locale' => Mage::app()->getLocale()->getLocaleCode(),
|
42 |
-
'price' => $this->getPrice(),
|
43 |
-
'layout' => $this->config->getPpWidgetLayout()
|
44 |
-
);
|
45 |
-
}
|
46 |
-
|
47 |
-
public function getProduct()
|
48 |
-
{
|
49 |
-
if (!$this->_product) {
|
50 |
-
$this->_product = Mage::registry('product');
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
private function getPrice()
|
55 |
-
{
|
56 |
-
return $this->_product->getFinalPrice();
|
57 |
-
}
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Avenla/KlarnaCheckout/Block/Catalog/Product/Price.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Avenla_KlarnaCheckout_Block_Catalog_Product_Price extends Mage_Bundle_Block_Catalog_Product_Price
|
23 |
+
{
|
24 |
+
private $config;
|
25 |
+
|
26 |
+
public function __construct()
|
27 |
+
{
|
28 |
+
$this->config = Mage::getSingleton('klarnaCheckout/KCO')->getConfig();
|
29 |
+
return parent::_construct();
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _toHtml()
|
33 |
+
{
|
34 |
+
$html = parent::_toHtml();
|
35 |
+
if($this->getLayout()->getBlock('klarnaCheckout_price') && $this->getRequest()->getControllerName() == 'product')
|
36 |
+
return $html;
|
37 |
+
|
38 |
+
if($type = $this->getWidgetType()){
|
39 |
+
if($this->getRequest()->getControllerName()=='category' && $this->config->getPpWidgetSelection() != "product_list")
|
40 |
+
return $html;
|
41 |
+
|
42 |
+
$html .= $this->getLayout()->createBlock('core/template', 'klarnaCheckout_price')
|
43 |
+
->setWidgetType($this->getWidgetType())
|
44 |
+
->setWidgetData($this->getWidgetData())
|
45 |
+
->setTemplate('KCO/catalog/product/price.phtml')->toHtml();
|
46 |
+
}
|
47 |
+
|
48 |
+
return $html;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Get widget type
|
53 |
+
*
|
54 |
+
* @return string | false
|
55 |
+
*/
|
56 |
+
public function getWidgetType()
|
57 |
+
{
|
58 |
+
$selection = $this->config->getPpWidgetSelection();
|
59 |
+
if($selection == 'product' || $selection == 'product_list'){
|
60 |
+
return "product";
|
61 |
+
}
|
62 |
+
else if($selection == 'klarna'){
|
63 |
+
return $selection;
|
64 |
+
}
|
65 |
+
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Get widget data
|
71 |
+
*
|
72 |
+
* @return mixed | false
|
73 |
+
*/
|
74 |
+
public function getWidgetData()
|
75 |
+
{
|
76 |
+
$price = $this->_getPrice();
|
77 |
+
|
78 |
+
if($price < 0.1)
|
79 |
+
return false;
|
80 |
+
|
81 |
+
if($this->getWidgetType() == "product"){
|
82 |
+
if($widgetText = Mage::getModel('klarnaCheckout/api')->getMonthlyPrice($price)){
|
83 |
+
return $this->__("From %s/mo.", $widgetText);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
else if($this->getWidgetType() == "klarna"){
|
87 |
+
return array(
|
88 |
+
'width' => 210,
|
89 |
+
'height' => 70,
|
90 |
+
'eid' => $this->config->getKlarnaEid(),
|
91 |
+
'locale' => Mage::app()->getLocale()->getLocaleCode(),
|
92 |
+
'price' => $price,
|
93 |
+
'layout' => $this->config->getPpWidgetLayout()
|
94 |
+
);
|
95 |
+
}
|
96 |
+
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get product price
|
102 |
+
*
|
103 |
+
* @return float
|
104 |
+
*/
|
105 |
+
private function _getPrice()
|
106 |
+
{
|
107 |
+
if($this->getDisplayMinimalPrice()){
|
108 |
+
$price = $this->getProduct()->getMinimalPrice();
|
109 |
+
}
|
110 |
+
else{
|
111 |
+
$price = $this->getProduct()->getFinalPrice();
|
112 |
+
}
|
113 |
+
|
114 |
+
$c = Mage::app()->getStore()->getCurrentCurrencyCode();
|
115 |
+
$bc = Mage::app()->getStore()->getBaseCurrencyCode();
|
116 |
+
$rate = 1;
|
117 |
+
|
118 |
+
if ($bc != $c) {
|
119 |
+
$currency = Mage::getModel('directory/currency');
|
120 |
+
$currency->load($bc);
|
121 |
+
$rate = $currency->getRate($c);
|
122 |
+
}
|
123 |
+
|
124 |
+
return $this->helper('tax')->getPrice(
|
125 |
+
$this->getProduct(),
|
126 |
+
$price,
|
127 |
+
true
|
128 |
+
) * $rate;
|
129 |
+
}
|
130 |
+
}
|
app/code/community/Avenla/KlarnaCheckout/Block/KCO/Confirmation.php
CHANGED
@@ -70,8 +70,6 @@ class Avenla_KlarnaCheckout_Block_KCO_Confirmation extends Mage_Core_Block_Templ
|
|
70 |
$shipping_fee = $p['total_price_including_tax'];
|
71 |
}
|
72 |
|
73 |
-
$gc = '<script type="text/javascript">';
|
74 |
-
$gc .= "//<![CDATA[\n";
|
75 |
$gc .= 'var _gaq = _gaq || [];';
|
76 |
$gc .= '_gaq.push(["_setAccount", "' . Mage::getModel('klarnaCheckout/config')->getGoogleAnalyticsNo() . '"]);';
|
77 |
$gc .= '_gaq.push(["_trackPageview"]);';
|
70 |
$shipping_fee = $p['total_price_including_tax'];
|
71 |
}
|
72 |
|
|
|
|
|
73 |
$gc .= 'var _gaq = _gaq || [];';
|
74 |
$gc .= '_gaq.push(["_setAccount", "' . Mage::getModel('klarnaCheckout/config')->getGoogleAnalyticsNo() . '"]);';
|
75 |
$gc .= '_gaq.push(["_trackPageview"]);';
|
app/code/community/Avenla/KlarnaCheckout/Helper/Data.php
CHANGED
@@ -87,7 +87,7 @@ class Avenla_KlarnaCheckout_Helper_Data extends Mage_Core_Helper_Data
|
|
87 |
public function getLogoSrc($width = 88)
|
88 |
{
|
89 |
$eid = Mage::getSingleton('klarnaCheckout/KCO')->getConfig()->getKlarnaEid();
|
90 |
-
|
91 |
}
|
92 |
|
93 |
/**
|
87 |
public function getLogoSrc($width = 88)
|
88 |
{
|
89 |
$eid = Mage::getSingleton('klarnaCheckout/KCO')->getConfig()->getKlarnaEid();
|
90 |
+
return "https://cdn.klarna.com/1.0/shared/image/generic/logo/sv_se/basic/blue-black.png?width=". $width . "&eid=" . $eid;
|
91 |
}
|
92 |
|
93 |
/**
|
app/code/community/Avenla/KlarnaCheckout/Model/Api.php
CHANGED
@@ -32,17 +32,22 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
32 |
{
|
33 |
$this->helper = Mage::helper('klarnaCheckout/api');
|
34 |
$this->klarna = new Klarna();
|
35 |
-
|
36 |
-
|
|
|
37 |
|
38 |
try{
|
39 |
$this->klarna->config(
|
40 |
$config->getKlarnaEid(),
|
41 |
$config->getKlarnaSharedSecret(),
|
42 |
-
$
|
43 |
-
$
|
44 |
-
$
|
45 |
-
$config->isLive() ? Klarna::LIVE : Klarna::BETA
|
|
|
|
|
|
|
|
|
46 |
);
|
47 |
}
|
48 |
catch (Exception $e) {
|
@@ -79,24 +84,58 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
79 |
* Check if activation is partial or full
|
80 |
*
|
81 |
* @param Magento_Sales_Order $mo
|
82 |
-
* @return
|
83 |
*/
|
84 |
private function checkIfPartial($mo)
|
85 |
{
|
86 |
$qtys = array();
|
87 |
$partial = false;
|
88 |
-
|
89 |
-
foreach
|
90 |
-
|
91 |
-
if($item->
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
else{
|
95 |
-
$qtys[$item->getId()] =
|
|
|
|
|
|
|
96 |
}
|
97 |
-
|
98 |
-
if($item->getQtyShipped() != $item->getQtyOrdered())
|
99 |
-
$partial = true;
|
100 |
}
|
101 |
|
102 |
if($partial)
|
@@ -121,6 +160,11 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
121 |
$sku = Mage::getModel('sales/order_item')->load($key)->getSku();
|
122 |
$this->klarna->addArtNo($qty, $sku);
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
try{
|
126 |
$rno = $this->helper->getReservationNumber($mo);
|
@@ -200,7 +244,7 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
200 |
'risk' => $result[0]
|
201 |
);
|
202 |
|
203 |
-
$mo->addStatusHistoryComment($this->helper->__('
|
204 |
$mo = $this->helper->saveKlarnaInvoices($mo, $klarnainvoices);
|
205 |
|
206 |
return $mo;
|
@@ -224,7 +268,6 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
224 |
$mo->getPayment()->setAdditionalInformation(
|
225 |
'klarna_message',
|
226 |
'Reservation was activated after expiration (expired '.$formattedExpiration.')'
|
227 |
-
|
228 |
);
|
229 |
}
|
230 |
return $mo;
|
@@ -240,14 +283,18 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
240 |
public function activateFromInvoice($mo, $invoice)
|
241 |
{
|
242 |
if($rno = $this->helper->getReservationNumber($mo)){
|
243 |
-
|
244 |
if (abs($mo->getTotalDue() - $invoice->getGrandTotal()) > .0001){
|
245 |
-
foreach($invoice->getAllItems() as $item)
|
246 |
-
|
247 |
-
|
|
|
248 |
}
|
249 |
}
|
250 |
|
|
|
|
|
|
|
|
|
251 |
try{
|
252 |
$result = $this->klarna->activate($rno);
|
253 |
|
@@ -411,4 +458,52 @@ class Avenla_KlarnaCheckout_Model_Api extends Mage_Core_Model_Abstract
|
|
411 |
return false;
|
412 |
}
|
413 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
}
|
32 |
{
|
33 |
$this->helper = Mage::helper('klarnaCheckout/api');
|
34 |
$this->klarna = new Klarna();
|
35 |
+
|
36 |
+
$locale = $this->klarna->getLocale($this->helper->getCountry());
|
37 |
+
$config = Mage::getSingleton('klarnaCheckout/KCO')->getConfig();
|
38 |
|
39 |
try{
|
40 |
$this->klarna->config(
|
41 |
$config->getKlarnaEid(),
|
42 |
$config->getKlarnaSharedSecret(),
|
43 |
+
$locale['country'],
|
44 |
+
$locale['language'],
|
45 |
+
$locale['currency'],
|
46 |
+
$config->isLive() ? Klarna::LIVE : Klarna::BETA,
|
47 |
+
'json',
|
48 |
+
Mage::getBaseDir('lib').'/Klarna/pclasses/'.$config->getKlarnaEid().'_pclass_'.$locale['country'].'.json',
|
49 |
+
true,
|
50 |
+
true
|
51 |
);
|
52 |
}
|
53 |
catch (Exception $e) {
|
84 |
* Check if activation is partial or full
|
85 |
*
|
86 |
* @param Magento_Sales_Order $mo
|
87 |
+
* @return array | false
|
88 |
*/
|
89 |
private function checkIfPartial($mo)
|
90 |
{
|
91 |
$qtys = array();
|
92 |
$partial = false;
|
93 |
+
|
94 |
+
foreach($mo->getAllVisibleItems() as $item){
|
95 |
+
|
96 |
+
if($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE){
|
97 |
+
if($item->isChildrenCalculated()){
|
98 |
+
foreach($item->getChildrenItems() as $child){
|
99 |
+
$qtys[$child->getId()] = $child->getQtyShipped() - $child->getQtyInvoiced();
|
100 |
+
|
101 |
+
if($child->getQtyOrdered() != $child->getQtyShipped())
|
102 |
+
$partial = true;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
else{
|
106 |
+
if($item->isDummy()){
|
107 |
+
$bundleQtys = array();
|
108 |
+
foreach($item->getChildrenItems() as $child){
|
109 |
+
$parentCount = 0;
|
110 |
+
$bundleCount = $child->getQtyOrdered() / $item->getQtyOrdered();
|
111 |
+
$qtyInvoiced = $bundleCount * $item->getQtyInvoiced();
|
112 |
+
$diff = $child->getQtyShipped() - $qtyInvoiced;
|
113 |
+
|
114 |
+
if($diff >= $bundleCount)
|
115 |
+
$parentCount = floor($bundleCount / $diff);
|
116 |
+
|
117 |
+
$bundleQtys[] = $parentCount;
|
118 |
+
|
119 |
+
if($child->getQtyOrdered() != $child->getQtyShipped())
|
120 |
+
$partial = true;
|
121 |
+
}
|
122 |
+
|
123 |
+
$qtys[$item->getId()] = min($bundleQtys);
|
124 |
+
}
|
125 |
+
else{
|
126 |
+
$qtys[$item->getId()] = $item->getQtyShipped() - $item->getQtyInvoiced();
|
127 |
+
|
128 |
+
if($item->getQtyShipped() != $item->getQtyOrdered())
|
129 |
+
$partial = true;
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
else{
|
134 |
+
$qtys[$item->getId()] = $item->getQtyShipped() - $item->getQtyInvoiced();
|
135 |
+
|
136 |
+
if($item->getQtyShipped() != $item->getQtyOrdered())
|
137 |
+
$partial = true;
|
138 |
}
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
if($partial)
|
160 |
$sku = Mage::getModel('sales/order_item')->load($key)->getSku();
|
161 |
$this->klarna->addArtNo($qty, $sku);
|
162 |
}
|
163 |
+
|
164 |
+
$klarnainvoices = $this->helper->getKlarnaInvoices($mo);
|
165 |
+
if(empty($klarnainvoices)){
|
166 |
+
$this->klarna->addArtNo(1, 'shipping_fee');
|
167 |
+
}
|
168 |
|
169 |
try{
|
170 |
$rno = $this->helper->getReservationNumber($mo);
|
244 |
'risk' => $result[0]
|
245 |
);
|
246 |
|
247 |
+
$mo->addStatusHistoryComment($this->helper->__('Created Klarna invoice %s', $result[1]));
|
248 |
$mo = $this->helper->saveKlarnaInvoices($mo, $klarnainvoices);
|
249 |
|
250 |
return $mo;
|
268 |
$mo->getPayment()->setAdditionalInformation(
|
269 |
'klarna_message',
|
270 |
'Reservation was activated after expiration (expired '.$formattedExpiration.')'
|
|
|
271 |
);
|
272 |
}
|
273 |
return $mo;
|
283 |
public function activateFromInvoice($mo, $invoice)
|
284 |
{
|
285 |
if($rno = $this->helper->getReservationNumber($mo)){
|
|
|
286 |
if (abs($mo->getTotalDue() - $invoice->getGrandTotal()) > .0001){
|
287 |
+
foreach($invoice->getAllItems() as $item){
|
288 |
+
if(!$item->getOrderItem()->isDummy()){
|
289 |
+
$this->klarna->addArtNo($item->getQty(), $item->getSku());
|
290 |
+
}
|
291 |
}
|
292 |
}
|
293 |
|
294 |
+
if($invoice->getShippingAmount() > 0){
|
295 |
+
$this->klarna->addArtNo(1, 'shipping_fee');
|
296 |
+
}
|
297 |
+
|
298 |
try{
|
299 |
$result = $this->klarna->activate($rno);
|
300 |
|
458 |
return false;
|
459 |
}
|
460 |
}
|
461 |
+
|
462 |
+
/**
|
463 |
+
* Get cheapest monthly price
|
464 |
+
*
|
465 |
+
* @param float $price
|
466 |
+
* @return string | bool
|
467 |
+
*/
|
468 |
+
public function getMonthlyPrice($price)
|
469 |
+
{
|
470 |
+
if($pclass = $this->klarna->getCheapestPClass($price, KlarnaFlags::PRODUCT_PAGE)){
|
471 |
+
$value = KlarnaCalc::calc_monthly_cost(
|
472 |
+
$price,
|
473 |
+
$pclass,
|
474 |
+
KlarnaFlags::PRODUCT_PAGE
|
475 |
+
);
|
476 |
+
|
477 |
+
$country = $pclass->getCountry();
|
478 |
+
$currency = KlarnaCurrency::getCode(KlarnaCountry::getCurrency($pclass->getCountry()));
|
479 |
+
|
480 |
+
try{
|
481 |
+
$currency = Mage::app()->getLocale()->currency(strtoupper($currency))->getSymbol();
|
482 |
+
}
|
483 |
+
catch(Exception $e){
|
484 |
+
Mage::logException($e);
|
485 |
+
}
|
486 |
+
|
487 |
+
return $value . $currency;
|
488 |
+
}
|
489 |
+
|
490 |
+
return false;
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Update Klarna PClasses
|
495 |
+
*
|
496 |
+
* @return string
|
497 |
+
*/
|
498 |
+
public function updatePClasses()
|
499 |
+
{
|
500 |
+
try {
|
501 |
+
$this->klarna->fetchPClasses();
|
502 |
+
return $this->helper->__('PClasses updated successfully');
|
503 |
+
}
|
504 |
+
catch(Exception $e) {
|
505 |
+
Mage::logException($e);
|
506 |
+
return $e->getMessage();
|
507 |
+
}
|
508 |
+
}
|
509 |
}
|
app/code/community/Avenla/KlarnaCheckout/Model/Config.php
CHANGED
@@ -199,7 +199,7 @@ class Avenla_KlarnaCheckout_Model_Config extends Varien_Object
|
|
199 |
*
|
200 |
* @return bool
|
201 |
*/
|
202 |
-
public function
|
203 |
{
|
204 |
return $this->getConfigData('pp_widget');
|
205 |
}
|
@@ -243,4 +243,14 @@ class Avenla_KlarnaCheckout_Model_Config extends Varien_Object
|
|
243 |
{
|
244 |
return $this->getConfigData('show_newsletter');
|
245 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
199 |
*
|
200 |
* @return bool
|
201 |
*/
|
202 |
+
public function getPpWidgetSelection()
|
203 |
{
|
204 |
return $this->getConfigData('pp_widget');
|
205 |
}
|
243 |
{
|
244 |
return $this->getConfigData('show_newsletter');
|
245 |
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Show gift message form on cart page
|
249 |
+
*
|
250 |
+
* @return bool
|
251 |
+
*/
|
252 |
+
public function showGiftMessage()
|
253 |
+
{
|
254 |
+
return $this->getConfigData('show_giftmessage');
|
255 |
+
}
|
256 |
}
|
app/code/community/Avenla/KlarnaCheckout/Model/KCO.php
CHANGED
@@ -171,7 +171,7 @@ class Avenla_KlarnaCheckout_Model_KCO extends Mage_Payment_Model_Method_Abstract
|
|
171 |
if($diff > 0)
|
172 |
$total_refund = false;
|
173 |
|
174 |
-
if($item->getQty() > 0)
|
175 |
$products[$item->getSku()] = $item->getQty();
|
176 |
}
|
177 |
|
171 |
if($diff > 0)
|
172 |
$total_refund = false;
|
173 |
|
174 |
+
if($item->getQty() > 0 && !$item->getOrderItem()->isDummy())
|
175 |
$products[$item->getSku()] = $item->getQty();
|
176 |
}
|
177 |
|
app/code/community/Avenla/KlarnaCheckout/Model/Order.php
CHANGED
@@ -93,8 +93,6 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
93 |
$create['merchant_reference']['orderid1'] = $this->quote ? $this->quote->getId() : '12345';
|
94 |
$create['gui']['options'] = array('disable_autofocus');
|
95 |
$create['gui']['layout'] = $this->mobile ? 'mobile' : 'desktop';
|
96 |
-
$layout = $this->mobile ? 'mobile' : 'desktop';
|
97 |
-
Mage::log($layout);
|
98 |
|
99 |
$info = $this->getCustomerInfo();
|
100 |
|
@@ -189,28 +187,46 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
189 |
private function addProductsToCart()
|
190 |
{
|
191 |
$mCart = $this->quote->getAllVisibleItems();
|
|
|
192 |
if(count($mCart) > 0){
|
193 |
foreach ($mCart as $i){
|
194 |
-
$
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
198 |
}
|
199 |
-
|
200 |
-
$this->cart[] = array(
|
201 |
-
'type' => 'physical',
|
202 |
-
'reference' => $i->getSku(),
|
203 |
-
'name' => $i->getName(),
|
204 |
-
'uri' => $i->getUrlPath(),
|
205 |
-
'quantity' => (int)$i->getQty(),
|
206 |
-
'unit_price' => round($i->getBasePriceInclTax(), 2) * 100,
|
207 |
-
'discount_rate' => round($discount_rate, 2) * 100,
|
208 |
-
'tax_rate' => round($i->getTaxPercent(), 2) * 100
|
209 |
-
);
|
210 |
}
|
211 |
}
|
212 |
}
|
213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
/**
|
215 |
* Process discount from quote to Klarna Checkout order
|
216 |
*
|
93 |
$create['merchant_reference']['orderid1'] = $this->quote ? $this->quote->getId() : '12345';
|
94 |
$create['gui']['options'] = array('disable_autofocus');
|
95 |
$create['gui']['layout'] = $this->mobile ? 'mobile' : 'desktop';
|
|
|
|
|
96 |
|
97 |
$info = $this->getCustomerInfo();
|
98 |
|
187 |
private function addProductsToCart()
|
188 |
{
|
189 |
$mCart = $this->quote->getAllVisibleItems();
|
190 |
+
|
191 |
if(count($mCart) > 0){
|
192 |
foreach ($mCart as $i){
|
193 |
+
if($i->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $i->isChildrenCalculated()){
|
194 |
+
foreach($i->getChildren() as $c){
|
195 |
+
$this->addProduct($c);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
else{
|
199 |
+
$this->addProduct($i);
|
200 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
}
|
203 |
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Add quote item to cart array
|
207 |
+
*
|
208 |
+
* @param Mage_Sales_Model_Quote_Item
|
209 |
+
*/
|
210 |
+
private function addProduct($item)
|
211 |
+
{
|
212 |
+
$discount_rate = 0;
|
213 |
+
if($item->getBaseDiscountAmount()){
|
214 |
+
$discount_rate = $item->getBaseDiscountAmount() / ($item->getBaseRowTotalInclTax() / 100);
|
215 |
+
$this->discounted += $item->getBaseDiscountAmount();
|
216 |
+
}
|
217 |
+
|
218 |
+
$this->cart[] = array(
|
219 |
+
'type' => 'physical',
|
220 |
+
'reference' => $item->getSku(),
|
221 |
+
'name' => $item->getName(),
|
222 |
+
'uri' => $item->getUrlPath(),
|
223 |
+
'quantity' => (int)$item->getTotalQty(),
|
224 |
+
'unit_price' => round($item->getBasePriceInclTax(), 2) * 100,
|
225 |
+
'discount_rate' => round($discount_rate, 2) * 100,
|
226 |
+
'tax_rate' => round($item->getTaxPercent(), 2) * 100
|
227 |
+
);
|
228 |
+
}
|
229 |
+
|
230 |
/**
|
231 |
* Process discount from quote to Klarna Checkout order
|
232 |
*
|
app/code/community/Avenla/KlarnaCheckout/Model/Source/Ppwidget.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
|
22 |
+
class Avenla_KlarnaCheckout_Model_Source_Ppwidget
|
23 |
+
{
|
24 |
+
public function toOptionArray()
|
25 |
+
{
|
26 |
+
return array(
|
27 |
+
array(
|
28 |
+
'label' => "No",
|
29 |
+
'value' => 'no'
|
30 |
+
),
|
31 |
+
array(
|
32 |
+
'label' => Mage::helper('klarnaCheckout')->__("Klarna widget"),
|
33 |
+
'value' => 'klarna'
|
34 |
+
),
|
35 |
+
array(
|
36 |
+
'label' => Mage::helper('klarnaCheckout')->__("Custom widget on product page"),
|
37 |
+
'value' => 'product'
|
38 |
+
),
|
39 |
+
array(
|
40 |
+
'label' => Mage::helper('klarnaCheckout')->__("Custom widget on product page and product listing"),
|
41 |
+
'value' => 'product_list'
|
42 |
+
)
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/{design/frontend/base/default/template/KCO/catalog/product/ppwidget.phtml → code/community/Avenla/KlarnaCheckout/controllers/Adminhtml/KCOController.php}
RENAMED
@@ -18,14 +18,15 @@
|
|
18 |
* @category Avenla
|
19 |
* @package Avenla_KlarnaCheckout
|
20 |
*/
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
18 |
* @category Avenla
|
19 |
* @package Avenla_KlarnaCheckout
|
20 |
*/
|
21 |
+
class Avenla_KlarnaCheckout_Adminhtml_KCOController extends Mage_Adminhtml_Controller_Action
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Update Klarna PClasses
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
public function updatePClassesAction()
|
28 |
+
{
|
29 |
+
$result = Mage::getModel('klarnaCheckout/api')->updatePClasses();
|
30 |
+
Mage::app()->getResponse()->setBody($result);
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Avenla/KlarnaCheckout/controllers/KCOController.php
CHANGED
@@ -48,7 +48,16 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
48 |
}
|
49 |
|
50 |
if(!$kco->isAvailable($quote)){
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
else{
|
54 |
$ko = null;
|
@@ -107,7 +116,7 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
107 |
}
|
108 |
|
109 |
if($redirect){
|
110 |
-
header('Location: ' . Mage::helper('checkout/url')->getCartUrl());
|
111 |
exit();
|
112 |
}
|
113 |
}
|
@@ -136,6 +145,27 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
136 |
exit();
|
137 |
}
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
/**
|
140 |
* Convert Klarna address to Magento address
|
141 |
*
|
@@ -154,6 +184,8 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
154 |
? $address['street_address']
|
155 |
: $address['street_name'] . " " . $address['street_number'];
|
156 |
|
|
|
|
|
157 |
$magentoAddress = array(
|
158 |
'firstname' => $address['given_name'],
|
159 |
'lastname' => $address['family_name'],
|
@@ -164,7 +196,7 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
164 |
'region' => $region,
|
165 |
'postcode' => $address['postal_code'],
|
166 |
'country_id' => strtoupper($address['country']),
|
167 |
-
'telephone' => $
|
168 |
);
|
169 |
|
170 |
return $magentoAddress;
|
@@ -279,6 +311,7 @@ class Avenla_KlarnaCheckout_KCOController extends Mage_Core_Controller_Front_Act
|
|
279 |
$quote->collectTotals()->save();
|
280 |
$service = Mage::getModel('sales/service_quote', $quote);
|
281 |
$service->submitAll();
|
|
|
282 |
|
283 |
return $service->getOrder();
|
284 |
}
|
48 |
}
|
49 |
|
50 |
if(!$kco->isAvailable($quote)){
|
51 |
+
if(!(Mage::getSingleton('customer/session')->isLoggedIn() || Mage::helper('checkout')->isAllowedGuestCheckout($quote))){
|
52 |
+
$result['msg'] = $this->__("Please login to use Klarna Checkout");
|
53 |
+
$this->loadLayout();
|
54 |
+
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('checkout/cart'));
|
55 |
+
$result['klarnaframe'] = $this->getLayout()->createBlock('customer/form_login')->setTemplate('customer/form/mini.login.phtml')->toHtml();
|
56 |
+
$result['kcologin'] = true;
|
57 |
+
}
|
58 |
+
else{
|
59 |
+
$result['msg'] = $this->__("Klarna Checkout is not available");
|
60 |
+
}
|
61 |
}
|
62 |
else{
|
63 |
$ko = null;
|
116 |
}
|
117 |
|
118 |
if($redirect){
|
119 |
+
header('Location: ' . Mage::helper('checkout/url')->getCartUrl());
|
120 |
exit();
|
121 |
}
|
122 |
}
|
145 |
exit();
|
146 |
}
|
147 |
|
148 |
+
/**
|
149 |
+
* Action for saving gift message form
|
150 |
+
*
|
151 |
+
*/
|
152 |
+
public function saveGiftMessageAction()
|
153 |
+
{
|
154 |
+
Mage::dispatchEvent(
|
155 |
+
'kco_save_giftmessage',
|
156 |
+
array(
|
157 |
+
'request' => $this->getRequest(),
|
158 |
+
'quote' => Mage::getSingleton('checkout/session')->getQuote()
|
159 |
+
)
|
160 |
+
);
|
161 |
+
|
162 |
+
$result = array();
|
163 |
+
|
164 |
+
$result['msg'] = $this->__('Gift message saved successfully');
|
165 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
166 |
+
}
|
167 |
+
|
168 |
+
|
169 |
/**
|
170 |
* Convert Klarna address to Magento address
|
171 |
*
|
184 |
? $address['street_address']
|
185 |
: $address['street_name'] . " " . $address['street_number'];
|
186 |
|
187 |
+
$phone = strlen($address['phone'] > 0) ? $address['phone'] : '1';
|
188 |
+
|
189 |
$magentoAddress = array(
|
190 |
'firstname' => $address['given_name'],
|
191 |
'lastname' => $address['family_name'],
|
196 |
'region' => $region,
|
197 |
'postcode' => $address['postal_code'],
|
198 |
'country_id' => strtoupper($address['country']),
|
199 |
+
'telephone' => $phone
|
200 |
);
|
201 |
|
202 |
return $magentoAddress;
|
311 |
$quote->collectTotals()->save();
|
312 |
$service = Mage::getModel('sales/service_quote', $quote);
|
313 |
$service->submitAll();
|
314 |
+
$quote->setIsActive(false)->save();
|
315 |
|
316 |
return $service->getOrder();
|
317 |
}
|
app/code/community/Avenla/KlarnaCheckout/etc/config.xml
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
<config>
|
24 |
<modules>
|
25 |
<Avenla_KlarnaCheckout>
|
26 |
-
<version>1.0.
|
27 |
</Avenla_KlarnaCheckout>
|
28 |
</modules>
|
29 |
<global>
|
@@ -31,6 +31,16 @@
|
|
31 |
<klarnaCheckout>
|
32 |
<class>Avenla_KlarnaCheckout_Block</class>
|
33 |
</klarnaCheckout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</blocks>
|
35 |
<models>
|
36 |
<klarnaCheckout>
|
@@ -74,6 +84,15 @@
|
|
74 |
</avenla_klarnacheckout_sales_order_invoice_save_after>
|
75 |
</observers>
|
76 |
</sales_order_invoice_save_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
</events>
|
78 |
</global>
|
79 |
<default>
|
@@ -140,7 +159,6 @@
|
|
140 |
</controller_action_layout_load_before>
|
141 |
</events>
|
142 |
</frontend>
|
143 |
-
|
144 |
<adminhtml>
|
145 |
<translate>
|
146 |
<modules>
|
23 |
<config>
|
24 |
<modules>
|
25 |
<Avenla_KlarnaCheckout>
|
26 |
+
<version>1.0.8</version>
|
27 |
</Avenla_KlarnaCheckout>
|
28 |
</modules>
|
29 |
<global>
|
31 |
<klarnaCheckout>
|
32 |
<class>Avenla_KlarnaCheckout_Block</class>
|
33 |
</klarnaCheckout>
|
34 |
+
<catalog>
|
35 |
+
<rewrite>
|
36 |
+
<product_price>Avenla_KlarnaCheckout_Block_Catalog_Product_Price</product_price>
|
37 |
+
</rewrite>
|
38 |
+
</catalog>
|
39 |
+
<bundle>
|
40 |
+
<rewrite>
|
41 |
+
<catalog_product_price>Avenla_KlarnaCheckout_Block_Catalog_Product_Price</catalog_product_price>
|
42 |
+
</rewrite>
|
43 |
+
</bundle>
|
44 |
</blocks>
|
45 |
<models>
|
46 |
<klarnaCheckout>
|
84 |
</avenla_klarnacheckout_sales_order_invoice_save_after>
|
85 |
</observers>
|
86 |
</sales_order_invoice_save_after>
|
87 |
+
<kco_save_giftmessage>
|
88 |
+
<observers>
|
89 |
+
<avenla_klarnacheckout_save_giftmessage>
|
90 |
+
<type>model</type>
|
91 |
+
<class>giftmessage/observer</class>
|
92 |
+
<method>checkoutEventCreateGiftMessage</method>
|
93 |
+
</avenla_klarnacheckout_save_giftmessage>
|
94 |
+
</observers>
|
95 |
+
</kco_save_giftmessage>
|
96 |
</events>
|
97 |
</global>
|
98 |
<default>
|
159 |
</controller_action_layout_load_before>
|
160 |
</events>
|
161 |
</frontend>
|
|
|
162 |
<adminhtml>
|
163 |
<translate>
|
164 |
<modules>
|
app/code/community/Avenla/KlarnaCheckout/etc/system.xml
CHANGED
@@ -165,14 +165,14 @@
|
|
165 |
<pp_widget translate="label">
|
166 |
<label>Show part payment widget on product page</label>
|
167 |
<frontend_type>select</frontend_type>
|
168 |
-
<source_model>
|
169 |
<sort_order>17</sort_order>
|
170 |
<show_in_default>1</show_in_default>
|
171 |
<show_in_website>1</show_in_website>
|
172 |
<show_in_store>1</show_in_store>
|
173 |
</pp_widget>
|
174 |
<pp_layout translate="label">
|
175 |
-
<depends><pp_widget>
|
176 |
<label>Part payment widget layout</label>
|
177 |
<frontend_type>select</frontend_type>
|
178 |
<source_model>klarnaCheckout/source_pplayout</source_model>
|
@@ -190,6 +190,25 @@
|
|
190 |
<show_in_website>1</show_in_website>
|
191 |
<show_in_store>1</show_in_store>
|
192 |
</show_newsletter>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
</fields>
|
194 |
</klarnaCheckout_payment>
|
195 |
</groups>
|
165 |
<pp_widget translate="label">
|
166 |
<label>Show part payment widget on product page</label>
|
167 |
<frontend_type>select</frontend_type>
|
168 |
+
<source_model>klarnaCheckout/source_ppwidget</source_model>
|
169 |
<sort_order>17</sort_order>
|
170 |
<show_in_default>1</show_in_default>
|
171 |
<show_in_website>1</show_in_website>
|
172 |
<show_in_store>1</show_in_store>
|
173 |
</pp_widget>
|
174 |
<pp_layout translate="label">
|
175 |
+
<depends><pp_widget>klarna</pp_widget></depends>
|
176 |
<label>Part payment widget layout</label>
|
177 |
<frontend_type>select</frontend_type>
|
178 |
<source_model>klarnaCheckout/source_pplayout</source_model>
|
190 |
<show_in_website>1</show_in_website>
|
191 |
<show_in_store>1</show_in_store>
|
192 |
</show_newsletter>
|
193 |
+
<show_giftmessage translate="label">
|
194 |
+
<label>Show giftmessage form on cart page</label>
|
195 |
+
<comment><![CDATA[Only if you have gift messages are enabled.]]></comment>
|
196 |
+
<frontend_type>select</frontend_type>
|
197 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
198 |
+
<sort_order>20</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>1</show_in_store>
|
202 |
+
</show_giftmessage>
|
203 |
+
<update_pclass translate="label">
|
204 |
+
<label>Update PClasses</label>
|
205 |
+
<frontend_type>button</frontend_type>
|
206 |
+
<frontend_model>klarnaCheckout/adminhtml_system_config_field_pclass</frontend_model>
|
207 |
+
<sort_order>21</sort_order>
|
208 |
+
<show_in_default>1</show_in_default>
|
209 |
+
<show_in_website>1</show_in_website>
|
210 |
+
<show_in_store>1</show_in_store>
|
211 |
+
</update_pclass>
|
212 |
</fields>
|
213 |
</klarnaCheckout_payment>
|
214 |
</groups>
|
app/design/adminhtml/default/default/template/KCO/system/config/field/pclass.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<script type="text/javascript">
|
23 |
+
//<![CDATA[
|
24 |
+
function updatePClasses() {
|
25 |
+
|
26 |
+
new Ajax.Request('<?php echo $this->getAjaxUpdateUrl() ?>', {
|
27 |
+
onSuccess: function(response){
|
28 |
+
if (response.responseText){
|
29 |
+
$('pclassResponse').update(response.responseText);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
});
|
33 |
+
}
|
34 |
+
//]]>
|
35 |
+
</script>
|
36 |
+
<?php echo $this->getButtonHtml() ?>
|
37 |
+
<p id="pclassResponse"></p>
|
app/design/frontend/base/default/layout/KCO.xml
CHANGED
@@ -52,6 +52,7 @@
|
|
52 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active"><name>checkout.cart.methods.onepage.top</name></action>
|
53 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active">"<name>checkout.cart.methods.onepage</name></action>
|
54 |
</reference>
|
|
|
55 |
<reference name="checkout.cart">
|
56 |
<action method="setCartTemplate" ifconfig="payment/klarnaCheckout_payment/active"><value>KCO/cart.phtml</value></action>
|
57 |
<action method="chooseTemplate"/>
|
@@ -65,7 +66,9 @@
|
|
65 |
<type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>KCO/cart/item/default.phtml</template>
|
66 |
</action>
|
67 |
<block type="klarnaCheckout/KCO" name="checkout.cart.klarnacheckout" as="klarnacheckout" template="KCO/KCO.phtml" />
|
|
|
68 |
</reference>
|
|
|
69 |
<reference name="checkout.cart.crosssell">
|
70 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/cart/crosssell.phtml</template></action>
|
71 |
</reference>
|
@@ -79,26 +82,33 @@
|
|
79 |
|
80 |
<checkout_onepage_index>
|
81 |
<reference name="head">
|
82 |
-
|
83 |
</reference>
|
84 |
</checkout_onepage_index>
|
85 |
|
86 |
<catalog_product_view>
|
87 |
-
<
|
88 |
-
<reference name="head">
|
89 |
<block type="core/text" name="klarna_widget_js">
|
90 |
<action method="setText" ifconfig="payment/klarnaCheckout_payment/pp_widget">
|
91 |
<text><![CDATA[<script async src="https://cdn.klarna.com/1.0/code/client/all.js"></script>]]></text>
|
92 |
</action>
|
93 |
</block>
|
94 |
-
|
95 |
-
<reference name="product.info.extrahint">
|
96 |
-
<action method="append" ifconfig="payment/klarnaCheckout_payment/pp_widget">
|
97 |
-
<block>klarna_pp_widget</block>
|
98 |
-
</action>
|
99 |
</reference>
|
100 |
</catalog_product_view>
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
<kco_twocolumns>
|
103 |
<reference name="checkout.cart">
|
104 |
<action method="setCartTemplate" ifconfig="payment/klarnaCheckout_payment/active">
|
52 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active"><name>checkout.cart.methods.onepage.top</name></action>
|
53 |
<action method="unsetChild" ifconfig="payment/klarnaCheckout_payment/active">"<name>checkout.cart.methods.onepage</name></action>
|
54 |
</reference>
|
55 |
+
|
56 |
<reference name="checkout.cart">
|
57 |
<action method="setCartTemplate" ifconfig="payment/klarnaCheckout_payment/active"><value>KCO/cart.phtml</value></action>
|
58 |
<action method="chooseTemplate"/>
|
66 |
<type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>KCO/cart/item/default.phtml</template>
|
67 |
</action>
|
68 |
<block type="klarnaCheckout/KCO" name="checkout.cart.klarnacheckout" as="klarnacheckout" template="KCO/KCO.phtml" />
|
69 |
+
<block type="core/template" name="cart.giftmessage" as="cart.giftmessage" template="KCO/cart/giftmessage.phtml"/>
|
70 |
</reference>
|
71 |
+
|
72 |
<reference name="checkout.cart.crosssell">
|
73 |
<action method="setTemplate" ifconfig="payment/klarnaCheckout_payment/active"><template>KCO/cart/crosssell.phtml</template></action>
|
74 |
</reference>
|
82 |
|
83 |
<checkout_onepage_index>
|
84 |
<reference name="head">
|
85 |
+
<action method="addCss" ifconfig="payment/klarnaCheckout_payment/active"><stylesheet>KCO/kco.css</stylesheet></action>
|
86 |
</reference>
|
87 |
</checkout_onepage_index>
|
88 |
|
89 |
<catalog_product_view>
|
90 |
+
<reference name="head">
|
|
|
91 |
<block type="core/text" name="klarna_widget_js">
|
92 |
<action method="setText" ifconfig="payment/klarnaCheckout_payment/pp_widget">
|
93 |
<text><![CDATA[<script async src="https://cdn.klarna.com/1.0/code/client/all.js"></script>]]></text>
|
94 |
</action>
|
95 |
</block>
|
96 |
+
<action method="addCss" ifconfig="payment/klarnaCheckout_payment/active"><stylesheet>KCO/kco.css</stylesheet></action>
|
|
|
|
|
|
|
|
|
97 |
</reference>
|
98 |
</catalog_product_view>
|
99 |
+
|
100 |
+
<catalog_category_default>
|
101 |
+
<reference name="head">
|
102 |
+
<action method="addCss" ifconfig="payment/klarnaCheckout_payment/active"><stylesheet>KCO/kco.css</stylesheet></action>
|
103 |
+
</reference>
|
104 |
+
</catalog_category_default>
|
105 |
+
|
106 |
+
<catalog_category_layered>
|
107 |
+
<reference name="head">
|
108 |
+
<action method="addCss" ifconfig="payment/klarnaCheckout_payment/active"><stylesheet>KCO/kco.css</stylesheet></action>
|
109 |
+
</reference>
|
110 |
+
</catalog_category_layered>
|
111 |
+
|
112 |
<kco_twocolumns>
|
113 |
<reference name="checkout.cart">
|
114 |
<action method="setCartTemplate" ifconfig="payment/klarnaCheckout_payment/active">
|
app/design/frontend/base/default/template/KCO/KCO.phtml
CHANGED
@@ -19,7 +19,14 @@
|
|
19 |
* @package Avenla_KlarnaCheckout
|
20 |
*/
|
21 |
?>
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<div id="klarnaMsg" style="display:none"><h2></h2></div>
|
24 |
|
25 |
<div id="klarnaWrapper" name="klarnaWrapper">
|
@@ -30,8 +37,8 @@
|
|
30 |
<script>
|
31 |
function loadFrame()
|
32 |
{
|
33 |
-
|
34 |
-
|
35 |
if($$('div.payments')[0]){
|
36 |
if($$('div.payments')[0].getWidth() < 600)
|
37 |
kcoloadurl = kcoloadurl + 'mobile/1';
|
@@ -43,19 +50,44 @@
|
|
43 |
var response = eval("(" + k.responseText + ")");
|
44 |
if(response.msg){
|
45 |
$('klarnaMsg').update('<h2>'+ response.msg +'</h2>').show();
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
else{
|
49 |
$('klarnaMsg').update('').hide();
|
50 |
$('klarnaOverlay').hide();
|
51 |
}
|
52 |
|
53 |
-
if(response.klarnaframe)
|
54 |
$('klarnaFrame').update(response.klarnaframe);
|
|
|
|
|
55 |
}
|
56 |
});
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
document.observe('dom:loaded', function(){
|
60 |
loadFrame();
|
61 |
});
|
19 |
* @package Avenla_KlarnaCheckout
|
20 |
*/
|
21 |
?>
|
22 |
+
<?php
|
23 |
+
if (Mage::app()->getStore()->isCurrentlySecure()){
|
24 |
+
$kcoloadurl = $this->getUrl("klarnaCheckout/KCO/loadKcoFrame/", array("_forced_secure" => true));
|
25 |
+
}
|
26 |
+
else{
|
27 |
+
$kcoloadurl = $this->getUrl("klarnaCheckout/KCO/loadKcoFrame/");
|
28 |
+
}
|
29 |
+
?>
|
30 |
<div id="klarnaMsg" style="display:none"><h2></h2></div>
|
31 |
|
32 |
<div id="klarnaWrapper" name="klarnaWrapper">
|
37 |
<script>
|
38 |
function loadFrame()
|
39 |
{
|
40 |
+
var kcoloadurl = '<?php echo $kcoloadurl; ?>';
|
41 |
+
|
42 |
if($$('div.payments')[0]){
|
43 |
if($$('div.payments')[0].getWidth() < 600)
|
44 |
kcoloadurl = kcoloadurl + 'mobile/1';
|
50 |
var response = eval("(" + k.responseText + ")");
|
51 |
if(response.msg){
|
52 |
$('klarnaMsg').update('<h2>'+ response.msg +'</h2>').show();
|
53 |
+
if(!response.kcologin){
|
54 |
+
$('klarnaOverlay').show();
|
55 |
+
}
|
56 |
+
else{
|
57 |
+
$('klarnaOverlay').hide();
|
58 |
+
}
|
59 |
}
|
60 |
else{
|
61 |
$('klarnaMsg').update('').hide();
|
62 |
$('klarnaOverlay').hide();
|
63 |
}
|
64 |
|
65 |
+
if(response.klarnaframe){
|
66 |
$('klarnaFrame').update(response.klarnaframe);
|
67 |
+
waitForKlarna();
|
68 |
+
}
|
69 |
}
|
70 |
});
|
71 |
}
|
72 |
|
73 |
+
function waitForKlarna(){
|
74 |
+
if(typeof window._klarnaCheckout !== "undefined"){
|
75 |
+
window._klarnaCheckout(function(api) {
|
76 |
+
api.on({
|
77 |
+
'change': function(data){
|
78 |
+
|
79 |
+
}
|
80 |
+
});
|
81 |
+
});
|
82 |
+
}
|
83 |
+
else{
|
84 |
+
setTimeout(function(){
|
85 |
+
waitForKlarna();
|
86 |
+
},250);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
document.observe('dom:loaded', function(){
|
92 |
loadFrame();
|
93 |
});
|
app/design/frontend/base/default/template/KCO/cart.phtml
CHANGED
@@ -117,10 +117,13 @@
|
|
117 |
</div>
|
118 |
<div class="col1-set">
|
119 |
<div class="col-1">
|
|
|
|
|
|
|
120 |
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
|
121 |
</div>
|
122 |
-
</div>
|
123 |
-
|
124 |
<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
|
125 |
|
126 |
<div class="col2-set totalsRow">
|
117 |
</div>
|
118 |
<div class="col1-set">
|
119 |
<div class="col-1">
|
120 |
+
<?php if(Mage::getModel('klarnaCheckout/config')->showGiftMessage()):?>
|
121 |
+
<?php echo $this->getChildHtml('cart.giftmessage') ?>
|
122 |
+
<?php endif; ?>
|
123 |
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
|
124 |
</div>
|
125 |
+
</div>
|
126 |
+
|
127 |
<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
|
128 |
|
129 |
<div class="col2-set totalsRow">
|
app/design/frontend/base/default/template/KCO/cart/giftmessage.phtml
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<script type="text/javascript">
|
23 |
+
//<![CDATA[
|
24 |
+
if(!window.toogleVisibilityOnObjects) {
|
25 |
+
var toogleVisibilityOnObjects = function(source, objects) {
|
26 |
+
if($(source) && $(source).checked) {
|
27 |
+
objects.each(function(item){
|
28 |
+
$(item).show();
|
29 |
+
$$('#' + item + ' .input-text').each(function(item) {
|
30 |
+
item.removeClassName('validation-passed');
|
31 |
+
});
|
32 |
+
});
|
33 |
+
} else {
|
34 |
+
objects.each(function(item){
|
35 |
+
if ($(item)) {
|
36 |
+
$(item).hide();
|
37 |
+
$$('#' + item + ' .input-text').each(function(sitem) {
|
38 |
+
sitem.addClassName('validation-passed');
|
39 |
+
});
|
40 |
+
$$('#' + item + ' .giftmessage-area').each(function(sitem) {
|
41 |
+
sitem.value = '';
|
42 |
+
});
|
43 |
+
$$('#' + item + ' .checkbox').each(function(sitem) {
|
44 |
+
sitem.checked = false;
|
45 |
+
});
|
46 |
+
$$('#' + item + ' .select').each(function(sitem) {
|
47 |
+
sitem.value = '';
|
48 |
+
});
|
49 |
+
$$('#' + item + ' .price-box').each(function(sitem) {
|
50 |
+
sitem.addClassName('no-display');
|
51 |
+
});
|
52 |
+
}
|
53 |
+
});
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
if(!window.toogleRequired) {
|
59 |
+
var toogleRequired = function (source, objects)
|
60 |
+
{
|
61 |
+
if(!$(source).value.blank()) {
|
62 |
+
objects.each(function(item) {
|
63 |
+
$(item).addClassName('required-entry');
|
64 |
+
});
|
65 |
+
} else {
|
66 |
+
objects.each(function(item) {
|
67 |
+
if (typeof shippingMethod != 'undefined' && shippingMethod.validator) {
|
68 |
+
shippingMethod.validator.reset(item);
|
69 |
+
}
|
70 |
+
$(item).removeClassName('required-entry');
|
71 |
+
});
|
72 |
+
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
</script>
|
77 |
+
<div class="KCOgiftFormContainer">
|
78 |
+
<form id="KCOgiftForm">
|
79 |
+
<?php echo $this->helper('giftmessage/message')->getInline('onepage_checkout', Mage::getSingleton('checkout/session')->getQuote(), true) ?>
|
80 |
+
</form>
|
81 |
+
</div>
|
82 |
+
|
83 |
+
<script>
|
84 |
+
Event.observe(window, 'load', function(){
|
85 |
+
appendGiftButton();
|
86 |
+
});
|
87 |
+
|
88 |
+
function appendGiftButton(){
|
89 |
+
$('allow-gift-message-container')
|
90 |
+
.insert('<button id="addGiftMessage" class="button"><span><?php echo $this->__("Save gift message") ?></span></button>');
|
91 |
+
$('allow-gift-message-container').insert('<p id="giftStatus"></p>');
|
92 |
+
|
93 |
+
$("addGiftMessage").observe('click', function(e){
|
94 |
+
Event.stop(e);
|
95 |
+
saveGiftForm(true);
|
96 |
+
});
|
97 |
+
|
98 |
+
$$('#KCOgiftForm input[type="checkbox"]').invoke('observe','click',function(field) {
|
99 |
+
if(!this.checked){
|
100 |
+
saveGiftForm(false);
|
101 |
+
}
|
102 |
+
});
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
function saveGiftForm(showmessage){
|
107 |
+
new Ajax.Request('<?php echo $this->getUrl("klarnaCheckout/KCO/saveGiftMessage") ?>', {
|
108 |
+
method:'POST',
|
109 |
+
parameters: $('KCOgiftForm').serialize(true),
|
110 |
+
onSuccess: function(k) {
|
111 |
+
var response = eval("(" + k.responseText + ")");
|
112 |
+
if(response.msg){
|
113 |
+
if(showmessage){
|
114 |
+
$('giftStatus').update(response.msg);
|
115 |
+
}
|
116 |
+
else{
|
117 |
+
$('giftStatus').update('');
|
118 |
+
}
|
119 |
+
return true;
|
120 |
+
}
|
121 |
+
else{
|
122 |
+
return false;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
});
|
126 |
+
}
|
127 |
+
</script>
|
app/design/frontend/base/default/template/KCO/cart/shipping.phtml
CHANGED
@@ -121,8 +121,16 @@
|
|
121 |
Event.observe(el, 'click', function(){
|
122 |
if (el.checked == true) {
|
123 |
setShipLoading(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
-
new Ajax.Request('<?php echo $
|
126 |
method:'POST',
|
127 |
parameters: $('co-shipping-method-form').serialize(true),
|
128 |
onSuccess: function(k) {
|
@@ -143,7 +151,15 @@
|
|
143 |
|
144 |
function estimateAjaxPost(event) {
|
145 |
setShipLoading(true);
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
method:'POST',
|
148 |
parameters: $('shipping-zip-form').serialize(true),
|
149 |
onSuccess: function(k) {
|
121 |
Event.observe(el, 'click', function(){
|
122 |
if (el.checked == true) {
|
123 |
setShipLoading(true);
|
124 |
+
<?php
|
125 |
+
if (Mage::app()->getStore()->isCurrentlySecure()){
|
126 |
+
$estimateUpdateUrl = $this->getUrl("klarnaCheckout/cart/estimateUpdateAjaxPost", array("_forced_secure" => true));
|
127 |
+
}
|
128 |
+
else{
|
129 |
+
$estimateUpdateUrl = $this->getUrl("klarnaCheckout/cart/estimateUpdateAjaxPost");
|
130 |
+
}
|
131 |
+
?>
|
132 |
|
133 |
+
new Ajax.Request('<?php echo $estimateUpdateUrl; ?>', {
|
134 |
method:'POST',
|
135 |
parameters: $('co-shipping-method-form').serialize(true),
|
136 |
onSuccess: function(k) {
|
151 |
|
152 |
function estimateAjaxPost(event) {
|
153 |
setShipLoading(true);
|
154 |
+
<?php
|
155 |
+
if (Mage::app()->getStore()->isCurrentlySecure()){
|
156 |
+
$estimatePostUrl = $this->getUrl("klarnaCheckout/cart/estimateAjaxPost", array("_forced_secure" => true));
|
157 |
+
}
|
158 |
+
else{
|
159 |
+
$estimatePostUrl = $this->getUrl("klarnaCheckout/cart/estimateAjaxPost");
|
160 |
+
}
|
161 |
+
?>
|
162 |
+
new Ajax.Request('<?php echo $estimatePostUrl; ?>', {
|
163 |
method:'POST',
|
164 |
parameters: $('shipping-zip-form').serialize(true),
|
165 |
onSuccess: function(k) {
|
app/design/frontend/base/default/template/KCO/cart_twocolumns.phtml
CHANGED
@@ -133,6 +133,9 @@
|
|
133 |
</div>
|
134 |
|
135 |
<div class="full-column">
|
|
|
|
|
|
|
136 |
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
|
137 |
<?php
|
138 |
if(Mage::getModel('klarnaCheckout/config')->showNewsletter())
|
133 |
</div>
|
134 |
|
135 |
<div class="full-column">
|
136 |
+
<?php if(Mage::getModel('klarnaCheckout/config')->showGiftMessage()):?>
|
137 |
+
<?php echo $this->getChildHtml('cart.giftmessage') ?>
|
138 |
+
<?php endif; ?>
|
139 |
<?php echo $this->getChildHtml('checkout.cart.extra') ?>
|
140 |
<?php
|
141 |
if(Mage::getModel('klarnaCheckout/config')->showNewsletter())
|
app/design/frontend/base/default/template/KCO/catalog/product/price.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is released under a custom license by Avenla Oy.
|
4 |
+
* All rights reserved
|
5 |
+
*
|
6 |
+
* License and more information can be found at http://productdownloads.avenla.com/magento-modules/klarna-checkout/
|
7 |
+
* For questions and support - klarna-support@avenla.com
|
8 |
+
*
|
9 |
+
* @category Avenla
|
10 |
+
* @package Avenla_KlarnaCheckout
|
11 |
+
* @copyright Copyright (c) Avenla Oy
|
12 |
+
* @link http://www.avenla.fi
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Avenla KlarnaCheckout
|
17 |
+
*
|
18 |
+
* @category Avenla
|
19 |
+
* @package Avenla_KlarnaCheckout
|
20 |
+
*/
|
21 |
+
?>
|
22 |
+
<?php if($this->getWidgetType() == "klarna"): ?>
|
23 |
+
<?php $params = $this->getWidgetData(); ?>
|
24 |
+
<?php if($params['price']): ?>
|
25 |
+
<div style="width:<?php echo $params['width']; ?>px; height:<?php echo $params['height']; ?>px"
|
26 |
+
class="klarna-widget klarna-part-payment"
|
27 |
+
data-eid="<?php echo $params['eid']; ?>"
|
28 |
+
data-locale="<?php echo $params['locale']; ?>"
|
29 |
+
data-price="<?php echo $params['price']; ?>"
|
30 |
+
data-layout="<?php echo $params['layout']; ?>">
|
31 |
+
</div>
|
32 |
+
<?php endif; ?>
|
33 |
+
<?php elseif($this->getWidgetType() == "product" && $this->getWidgetData()): ?>
|
34 |
+
<div class="kco-ppayment">
|
35 |
+
<p><?php echo $this->getWidgetData(); ?></p>
|
36 |
+
<img src="<?php echo Mage::helper('klarnaCheckout')->getLogoSrc(50); ?>" />
|
37 |
+
</div>
|
38 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/KCO/link.phtml
CHANGED
@@ -22,8 +22,8 @@
|
|
22 |
<?php $helper = Mage::helper("klarnaCheckout"); ?>
|
23 |
|
24 |
<a href="<?php echo $helper->getCartUri();?>" class="klarnaLink">
|
25 |
-
|
26 |
-
|
27 |
</a>
|
28 |
|
29 |
<?php echo $this->getChildHtml('original'); ?>
|
22 |
<?php $helper = Mage::helper("klarnaCheckout"); ?>
|
23 |
|
24 |
<a href="<?php echo $helper->getCartUri();?>" class="klarnaLink">
|
25 |
+
<img src="<?php echo $helper->getLogoSrc(); ?>" alt="Klarna Checkout" />
|
26 |
+
<p class="klarnaLinkText"><?php echo $this->__($helper->getLinkText());?></p>
|
27 |
</a>
|
28 |
|
29 |
<?php echo $this->getChildHtml('original'); ?>
|
app/locale/fi_FI/Avenla_KlarnaCheckout.csv
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
"Enter account number to use Google Ecommerce tracking", "Syötä tilin numero käyttääksesi Google Ecommerce seurantaa"
|
31 |
"Failed to activate reservation %s", "Varauksen %s aktivointi epäonnistui"
|
32 |
"Activate Klarna reservation", "Aktivoi Klarna varaus"
|
33 |
-
"
|
34 |
"Klarna reservation <b>%s</b> was canceled.", "Klarna varaus <b>%s</b> peruutettiin."
|
35 |
"Failed to cancel Klarna reservation <b>%s</b>.(%s - %s)", "Varauksen <b>%s</b> peruuttaminen epäonnistui.(%s - %s)"
|
36 |
"Adjustment fee", "Tasaus"
|
@@ -52,4 +52,17 @@
|
|
52 |
"Cart page layout", "Ostoskori sivun asettelu"
|
53 |
"Show newsletter subscription checkbox", "Näytä valintaruutu uutiskirjeen tilaamiseen"
|
54 |
"Default", "Oletus"
|
55 |
-
"Two columns", "Kaksi palstaa"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
"Enter account number to use Google Ecommerce tracking", "Syötä tilin numero käyttääksesi Google Ecommerce seurantaa"
|
31 |
"Failed to activate reservation %s", "Varauksen %s aktivointi epäonnistui"
|
32 |
"Activate Klarna reservation", "Aktivoi Klarna varaus"
|
33 |
+
"Created Klarna invoice %s", "Luotiin Klarna lasku: %s"
|
34 |
"Klarna reservation <b>%s</b> was canceled.", "Klarna varaus <b>%s</b> peruutettiin."
|
35 |
"Failed to cancel Klarna reservation <b>%s</b>.(%s - %s)", "Varauksen <b>%s</b> peruuttaminen epäonnistui.(%s - %s)"
|
36 |
"Adjustment fee", "Tasaus"
|
52 |
"Cart page layout", "Ostoskori sivun asettelu"
|
53 |
"Show newsletter subscription checkbox", "Näytä valintaruutu uutiskirjeen tilaamiseen"
|
54 |
"Default", "Oletus"
|
55 |
+
"Two columns", "Kaksi palstaa"
|
56 |
+
"From %s/mo.", "Alk. %s/kk"
|
57 |
+
"Update PClasses", "Päivitä kampanjat"
|
58 |
+
"Continue Shopping", "Jatka ostoksia"
|
59 |
+
"Please login to use Klarna Checkout", "Kirjaudu sisään käyttääksesi Klarna Checkouttia"
|
60 |
+
"Gift message saved successfully", "Lahjaviesti tallennettiin onnistuneesti"
|
61 |
+
"PClasses updated successfully", "Kampanjat päivitettiin onnistuneesti"
|
62 |
+
"Please fill in your phone number.", "Ole hyvä ja täytä puhelinnumerosi"
|
63 |
+
"Please use the same post code for your quote and Klarna.", "Ole hyvä ja käytä samaa postinumeroa toimitusosoitteessasi ja Klarna Checkoutissa"
|
64 |
+
"Show giftmessage form on cart page", "Näytä lahjaviestilomake ostoskorisivulla"
|
65 |
+
"Only if you have gift messages are enabled.", "Vain jos lahjaviestit ovat käytössä"
|
66 |
+
"Klarna widget", "Klarna näyttö"
|
67 |
+
"Custom widget on product page", "Kustomoitu näyttö tuotesivulla"
|
68 |
+
"Custom widget on product page and product listing", "Kustomoitu näyttö tuotesivulla sekä tuotelistauksessa"
|
lib/Klarna/Klarna.php
CHANGED
@@ -666,6 +666,7 @@ class Klarna
|
|
666 |
$locale['currency'] = $this->_currency;
|
667 |
}
|
668 |
} else {
|
|
|
669 |
// Use the given country / language / currency
|
670 |
if (!is_numeric($country)) {
|
671 |
$country = KlarnaCountry::fromCode($country);
|
@@ -699,7 +700,7 @@ class Klarna
|
|
699 |
$locale['country']
|
700 |
);
|
701 |
}
|
702 |
-
|
703 |
$this->_checkCountry($locale['country']);
|
704 |
$this->_checkCurrency($locale['currency']);
|
705 |
$this->_checkLanguage($locale['language']);
|
@@ -3660,7 +3661,6 @@ class Klarna
|
|
3660 |
KlarnaFlags::CHECKOUT_PAGE . ' or ' . KlarnaFlags::PRODUCT_PAGE
|
3661 |
);
|
3662 |
}
|
3663 |
-
|
3664 |
$lowest_pp = $lowest = false;
|
3665 |
|
3666 |
foreach ($this->getPClasses() as $pclass) {
|
666 |
$locale['currency'] = $this->_currency;
|
667 |
}
|
668 |
} else {
|
669 |
+
|
670 |
// Use the given country / language / currency
|
671 |
if (!is_numeric($country)) {
|
672 |
$country = KlarnaCountry::fromCode($country);
|
700 |
$locale['country']
|
701 |
);
|
702 |
}
|
703 |
+
|
704 |
$this->_checkCountry($locale['country']);
|
705 |
$this->_checkCurrency($locale['currency']);
|
706 |
$this->_checkLanguage($locale['language']);
|
3661 |
KlarnaFlags::CHECKOUT_PAGE . ' or ' . KlarnaFlags::PRODUCT_PAGE
|
3662 |
);
|
3663 |
}
|
|
|
3664 |
$lowest_pp = $lowest = false;
|
3665 |
|
3666 |
foreach ($this->getPClasses() as $pclass) {
|
lib/KlarnaCheckout/Checkout.php
CHANGED
@@ -23,10 +23,10 @@
|
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
-
* @link http://
|
27 |
*/
|
28 |
|
29 |
-
define('KLARNA_CHECKOUT_DIR', dirname(
|
30 |
|
31 |
require_once KLARNA_CHECKOUT_DIR . '/ConnectorInterface.php';
|
32 |
require_once KLARNA_CHECKOUT_DIR . '/ResourceInterface.php';
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
+
* @link http://developers.klarna.com/
|
27 |
*/
|
28 |
|
29 |
+
define('KLARNA_CHECKOUT_DIR', dirname(__FILE__) . '/Checkout');
|
30 |
|
31 |
require_once KLARNA_CHECKOUT_DIR . '/ConnectorInterface.php';
|
32 |
require_once KLARNA_CHECKOUT_DIR . '/ResourceInterface.php';
|
lib/KlarnaCheckout/Checkout/BasicConnector.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -37,7 +37,7 @@
|
|
37 |
* @author David K. <david.keijser@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
-
* @link http://
|
41 |
*/
|
42 |
class Klarna_Checkout_BasicConnector implements Klarna_Checkout_ConnectorInterface
|
43 |
{
|
@@ -309,7 +309,6 @@ class Klarna_Checkout_BasicConnector implements Klarna_Checkout_ConnectorInterfa
|
|
309 |
|
310 |
// Create a HTTP Request object
|
311 |
$request = $this->createRequest($resource, $method, $payload, $url);
|
312 |
-
// $this->_setContent($request, $payload, $method);
|
313 |
|
314 |
// Execute the HTTP Request
|
315 |
$result = $this->http->send($request);
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
37 |
* @author David K. <david.keijser@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
+
* @link http://developers.klarna.com/
|
41 |
*/
|
42 |
class Klarna_Checkout_BasicConnector implements Klarna_Checkout_ConnectorInterface
|
43 |
{
|
309 |
|
310 |
// Create a HTTP Request object
|
311 |
$request = $this->createRequest($resource, $method, $payload, $url);
|
|
|
312 |
|
313 |
// Execute the HTTP Request
|
314 |
$result = $this->http->send($request);
|
lib/KlarnaCheckout/Checkout/ConnectionErrorException.php
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
-
* @link http://
|
27 |
*/
|
28 |
|
29 |
/**
|
@@ -35,7 +35,7 @@
|
|
35 |
* @author Christer G. <christer.gustavsson@klarna.com>
|
36 |
* @copyright 2012 Klarna AB
|
37 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
38 |
-
* @link http://
|
39 |
*/
|
40 |
class Klarna_Checkout_ConnectionErrorException extends Klarna_Checkout_Exception
|
41 |
{
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
+
* @link http://developers.klarna.com/
|
27 |
*/
|
28 |
|
29 |
/**
|
35 |
* @author Christer G. <christer.gustavsson@klarna.com>
|
36 |
* @copyright 2012 Klarna AB
|
37 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
38 |
+
* @link http://developers.klarna.com/
|
39 |
*/
|
40 |
class Klarna_Checkout_ConnectionErrorException extends Klarna_Checkout_Exception
|
41 |
{
|
lib/KlarnaCheckout/Checkout/Connector.php
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
-
* @link http://
|
27 |
*/
|
28 |
|
29 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
class Klarna_Checkout_Connector
|
42 |
{
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
+
* @link http://developers.klarna.com/
|
27 |
*/
|
28 |
|
29 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
class Klarna_Checkout_Connector
|
42 |
{
|
lib/KlarnaCheckout/Checkout/ConnectorException.php
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
-
* @link http://
|
27 |
*/
|
28 |
|
29 |
/**
|
@@ -35,7 +35,7 @@
|
|
35 |
* @author David K. <david.keijser@klarna.com>
|
36 |
* @copyright 2012 Klarna AB
|
37 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
38 |
-
* @link http://
|
39 |
*/
|
40 |
class Klarna_Checkout_ConnectorException extends Klarna_Checkout_Exception
|
41 |
{
|
23 |
* @author Klarna <support@klarna.com>
|
24 |
* @copyright 2012 Klarna AB
|
25 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
26 |
+
* @link http://developers.klarna.com/
|
27 |
*/
|
28 |
|
29 |
/**
|
35 |
* @author David K. <david.keijser@klarna.com>
|
36 |
* @copyright 2012 Klarna AB
|
37 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
38 |
+
* @link http://developers.klarna.com/
|
39 |
*/
|
40 |
class Klarna_Checkout_ConnectorException extends Klarna_Checkout_Exception
|
41 |
{
|
lib/KlarnaCheckout/Checkout/ConnectorInterface.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
interface Klarna_Checkout_ConnectorInterface
|
42 |
{
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
interface Klarna_Checkout_ConnectorInterface
|
42 |
{
|
lib/KlarnaCheckout/Checkout/Digest.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author Christer G. <christer.gustavsson@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
class Klarna_Checkout_Digest
|
42 |
{
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author Christer G. <christer.gustavsson@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
class Klarna_Checkout_Digest
|
42 |
{
|
lib/KlarnaCheckout/Checkout/Exception.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
class Klarna_Checkout_Exception extends Exception
|
42 |
{
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
class Klarna_Checkout_Exception extends Exception
|
42 |
{
|
lib/KlarnaCheckout/Checkout/HTTP/CURLFactory.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author Klarna <support@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
class Klarna_Checkout_HTTP_CURLFactory
|
42 |
{
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author Klarna <support@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
class Klarna_Checkout_HTTP_CURLFactory
|
42 |
{
|
lib/KlarnaCheckout/Checkout/HTTP/CURLHandle.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
class Klarna_Checkout_HTTP_CURLHandle
|
42 |
implements Klarna_Checkout_HTTP_CURLHandleInterface
|
@@ -93,6 +93,16 @@ class Klarna_Checkout_HTTP_CURLHandle
|
|
93 |
return curl_getinfo($this->_handle);
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
/**
|
97 |
* Close the cURL session
|
98 |
*
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
class Klarna_Checkout_HTTP_CURLHandle
|
42 |
implements Klarna_Checkout_HTTP_CURLHandleInterface
|
93 |
return curl_getinfo($this->_handle);
|
94 |
}
|
95 |
|
96 |
+
/**
|
97 |
+
* Get error message regarding this transfer
|
98 |
+
*
|
99 |
+
* @return string Error message
|
100 |
+
*/
|
101 |
+
public function getError()
|
102 |
+
{
|
103 |
+
return curl_error($this->_handle);
|
104 |
+
}
|
105 |
+
|
106 |
/**
|
107 |
* Close the cURL session
|
108 |
*
|
lib/KlarnaCheckout/Checkout/HTTP/CURLHandleInterface.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
interface Klarna_Checkout_HTTP_CURLHandleInterface
|
42 |
{
|
@@ -64,6 +64,13 @@ interface Klarna_Checkout_HTTP_CURLHandleInterface
|
|
64 |
*/
|
65 |
public function getInfo();
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
/**
|
68 |
* Close the cURL session
|
69 |
*
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
interface Klarna_Checkout_HTTP_CURLHandleInterface
|
42 |
{
|
64 |
*/
|
65 |
public function getInfo();
|
66 |
|
67 |
+
/**
|
68 |
+
* Get error message regarding this transfer
|
69 |
+
*
|
70 |
+
* @return string Error message
|
71 |
+
*/
|
72 |
+
public function getError();
|
73 |
+
|
74 |
/**
|
75 |
* Close the cURL session
|
76 |
*
|
lib/KlarnaCheckout/Checkout/HTTP/CURLHeaders.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
-
* @link http://
|
29 |
*/
|
30 |
|
31 |
/**
|
@@ -37,7 +37,7 @@
|
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
-
* @link http://
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_CURLHeaders
|
43 |
{
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
+
* @link http://developers.klarna.com/
|
29 |
*/
|
30 |
|
31 |
/**
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
+
* @link http://developers.klarna.com/
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_CURLHeaders
|
43 |
{
|
lib/KlarnaCheckout/Checkout/HTTP/CURLTransport.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
-
* @link http://
|
29 |
*/
|
30 |
|
31 |
/**
|
@@ -37,7 +37,7 @@
|
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
-
* @link http://
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_CURLTransport
|
43 |
implements Klarna_Checkout_HTTP_TransportInterface
|
@@ -56,6 +56,13 @@ class Klarna_Checkout_HTTP_CURLTransport
|
|
56 |
*/
|
57 |
protected $timeout;
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* Initializes a new instance of the HTTP cURL class.
|
61 |
*
|
@@ -65,6 +72,20 @@ class Klarna_Checkout_HTTP_CURLTransport
|
|
65 |
{
|
66 |
$this->curl = $curl;
|
67 |
$this->timeout = self::DEFAULT_TIMEOUT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -128,6 +149,7 @@ class Klarna_Checkout_HTTP_CURLTransport
|
|
128 |
|
129 |
$curl->setOption(CURLOPT_RETURNTRANSFER, true);
|
130 |
$curl->setOption(CURLOPT_CONNECTTIMEOUT, $this->timeout);
|
|
|
131 |
|
132 |
$curlHeaders = new Klarna_Checkout_HTTP_CURLHeaders();
|
133 |
$curl->setOption(
|
@@ -135,22 +157,28 @@ class Klarna_Checkout_HTTP_CURLTransport
|
|
135 |
array(&$curlHeaders, 'processHeader')
|
136 |
);
|
137 |
|
138 |
-
|
139 |
-
$curl->setOption(CURLOPT_SSL_VERIFYPEER,
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
$payload = $curl->execute();
|
142 |
$info = $curl->getInfo();
|
|
|
143 |
|
144 |
$curl->close();
|
145 |
|
146 |
/*
|
147 |
-
* A failure
|
148 |
* payload is false (e.g. HTTP timeout?).
|
149 |
* info is false, then it has no HTTP status code.
|
150 |
*/
|
151 |
if ($payload === false || $info === false) {
|
152 |
throw new Klarna_Checkout_ConnectionErrorException(
|
153 |
-
"Connection to '{$url}' failed
|
154 |
);
|
155 |
}
|
156 |
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
+
* @link http://developers.klarna.com/
|
29 |
*/
|
30 |
|
31 |
/**
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
+
* @link http://developers.klarna.com/
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_CURLTransport
|
43 |
implements Klarna_Checkout_HTTP_TransportInterface
|
56 |
*/
|
57 |
protected $timeout;
|
58 |
|
59 |
+
/**
|
60 |
+
* cURL Options
|
61 |
+
*
|
62 |
+
* @var array
|
63 |
+
*/
|
64 |
+
protected $options;
|
65 |
+
|
66 |
/**
|
67 |
* Initializes a new instance of the HTTP cURL class.
|
68 |
*
|
72 |
{
|
73 |
$this->curl = $curl;
|
74 |
$this->timeout = self::DEFAULT_TIMEOUT;
|
75 |
+
$this->options = array();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Set specific cURL options.
|
80 |
+
*
|
81 |
+
* @param int $option cURL option constant
|
82 |
+
* @param mixed $value cURL option value
|
83 |
+
*
|
84 |
+
* @return void
|
85 |
+
*/
|
86 |
+
public function setOption($option, $value)
|
87 |
+
{
|
88 |
+
$this->options[$option] = $value;
|
89 |
}
|
90 |
|
91 |
/**
|
149 |
|
150 |
$curl->setOption(CURLOPT_RETURNTRANSFER, true);
|
151 |
$curl->setOption(CURLOPT_CONNECTTIMEOUT, $this->timeout);
|
152 |
+
$curl->setOption(CURLOPT_TIMEOUT, $this->timeout);
|
153 |
|
154 |
$curlHeaders = new Klarna_Checkout_HTTP_CURLHeaders();
|
155 |
$curl->setOption(
|
157 |
array(&$curlHeaders, 'processHeader')
|
158 |
);
|
159 |
|
160 |
+
$curl->setOption(CURLOPT_SSL_VERIFYHOST, 2);
|
161 |
+
$curl->setOption(CURLOPT_SSL_VERIFYPEER, true);
|
162 |
+
|
163 |
+
// Override specific set options
|
164 |
+
foreach ($this->options as $option => $value) {
|
165 |
+
$curl->setOption($option, $value);
|
166 |
+
}
|
167 |
|
168 |
$payload = $curl->execute();
|
169 |
$info = $curl->getInfo();
|
170 |
+
$error = $curl->getError();
|
171 |
|
172 |
$curl->close();
|
173 |
|
174 |
/*
|
175 |
+
* A failure occurred if:
|
176 |
* payload is false (e.g. HTTP timeout?).
|
177 |
* info is false, then it has no HTTP status code.
|
178 |
*/
|
179 |
if ($payload === false || $info === false) {
|
180 |
throw new Klarna_Checkout_ConnectionErrorException(
|
181 |
+
"Connection to '{$url}' failed: {$error}"
|
182 |
);
|
183 |
}
|
184 |
|
lib/KlarnaCheckout/Checkout/HTTP/Request.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
-
* @link http://
|
29 |
*/
|
30 |
|
31 |
/**
|
@@ -37,7 +37,7 @@
|
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
-
* @link http://
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_Request
|
43 |
{
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
+
* @link http://developers.klarna.com/
|
29 |
*/
|
30 |
|
31 |
/**
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
+
* @link http://developers.klarna.com/
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_Request
|
43 |
{
|
lib/KlarnaCheckout/Checkout/HTTP/Response.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
-
* @link http://
|
29 |
*/
|
30 |
|
31 |
/**
|
@@ -37,7 +37,7 @@
|
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
-
* @link http://
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_Response
|
43 |
{
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
+
* @link http://developers.klarna.com/
|
29 |
*/
|
30 |
|
31 |
/**
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
+
* @link http://developers.klarna.com/
|
41 |
*/
|
42 |
class Klarna_Checkout_HTTP_Response
|
43 |
{
|
lib/KlarnaCheckout/Checkout/HTTP/Transport.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
class Klarna_Checkout_HTTP_Transport
|
42 |
{
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
class Klarna_Checkout_HTTP_Transport
|
42 |
{
|
lib/KlarnaCheckout/Checkout/HTTP/TransportInterface.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
-
* @link http://
|
29 |
*/
|
30 |
|
31 |
/**
|
@@ -37,7 +37,7 @@
|
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
-
* @link http://
|
41 |
*/
|
42 |
interface Klarna_Checkout_HTTP_TransportInterface
|
43 |
{
|
25 |
* @author Klarna <support@klarna.com>
|
26 |
* @copyright 2012 Klarna AB
|
27 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
28 |
+
* @link http://developers.klarna.com/
|
29 |
*/
|
30 |
|
31 |
/**
|
37 |
* @author Klarna <support@klarna.com>
|
38 |
* @copyright 2012 Klarna AB
|
39 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
40 |
+
* @link http://developers.klarna.com/
|
41 |
*/
|
42 |
interface Klarna_Checkout_HTTP_TransportInterface
|
43 |
{
|
lib/KlarnaCheckout/Checkout/Order.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
class Klarna_Checkout_Order
|
42 |
implements Klarna_Checkout_ResourceInterface, ArrayAccess
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
class Klarna_Checkout_Order
|
42 |
implements Klarna_Checkout_ResourceInterface, ArrayAccess
|
lib/KlarnaCheckout/Checkout/ResourceInterface.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -36,7 +36,7 @@
|
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
-
* @link http://
|
40 |
*/
|
41 |
interface Klarna_Checkout_ResourceInterface
|
42 |
{
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
36 |
* @author David K. <david.keijser@klarna.com>
|
37 |
* @copyright 2012 Klarna AB
|
38 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
39 |
+
* @link http://developers.klarna.com/
|
40 |
*/
|
41 |
interface Klarna_Checkout_ResourceInterface
|
42 |
{
|
lib/KlarnaCheckout/Checkout/UserAgent.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
-
* @link http://
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -35,7 +35,7 @@
|
|
35 |
* @author David K. <david.keijser@klarna.com>
|
36 |
* @copyright 2012 Klarna AB
|
37 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
38 |
-
* @link http://
|
39 |
*/
|
40 |
class Klarna_Checkout_UserAgent
|
41 |
{
|
@@ -51,11 +51,10 @@ class Klarna_Checkout_UserAgent
|
|
51 |
*/
|
52 |
public function __construct()
|
53 |
{
|
54 |
-
|
55 |
-
$this->_fields = array(
|
56 |
'Library' => array(
|
57 |
'name' => 'Klarna.ApiWrapper',
|
58 |
-
'version' => '1.1
|
59 |
),
|
60 |
'OS' => array(
|
61 |
'name' => php_uname('s'),
|
@@ -64,10 +63,10 @@ class Klarna_Checkout_UserAgent
|
|
64 |
'Language' => array(
|
65 |
'name' => 'PHP',
|
66 |
'version' => phpversion()
|
67 |
-
|
68 |
'Module' => array(
|
69 |
'name' => 'KlarnaCheckout.MagentoModule',
|
70 |
-
'version' => '1.0.
|
71 |
)
|
72 |
);
|
73 |
}
|
24 |
* @author Klarna <support@klarna.com>
|
25 |
* @copyright 2012 Klarna AB
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
27 |
+
* @link http://developers.klarna.com/
|
28 |
*/
|
29 |
|
30 |
/**
|
35 |
* @author David K. <david.keijser@klarna.com>
|
36 |
* @copyright 2012 Klarna AB
|
37 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
|
38 |
+
* @link http://developers.klarna.com/
|
39 |
*/
|
40 |
class Klarna_Checkout_UserAgent
|
41 |
{
|
51 |
*/
|
52 |
public function __construct()
|
53 |
{
|
54 |
+
$this->_fields = array(
|
|
|
55 |
'Library' => array(
|
56 |
'name' => 'Klarna.ApiWrapper',
|
57 |
+
'version' => '1.2.1',
|
58 |
),
|
59 |
'OS' => array(
|
60 |
'name' => php_uname('s'),
|
63 |
'Language' => array(
|
64 |
'name' => 'PHP',
|
65 |
'version' => phpversion()
|
66 |
+
),
|
67 |
'Module' => array(
|
68 |
'name' => 'KlarnaCheckout.MagentoModule',
|
69 |
+
'version' => '1.0.8'
|
70 |
)
|
71 |
);
|
72 |
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Avenla_KlarnaCheckout</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://productdownloads.avenla.com/magento-modules/klarna-checkout/">Custom license by Avenla Oy</license>
|
7 |
<channel>community</channel>
|
@@ -13,9 +13,9 @@ For questions and support - klarna-support@avenla.com
|
|
13 |
</description>
|
14 |
<notes>Klarna Checkout module</notes>
|
15 |
<authors><author><name>Avenla Oy</name><user>Avenla</user><email>info@avenla.fi</email></author></authors>
|
16 |
-
<date>2014-
|
17 |
-
<time>
|
18 |
-
<contents><target name="magecommunity"><dir name="Avenla"><dir name="KlarnaCheckout"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Info.php" hash="a7fd2dde41ccfe8477267a45be3abf5a"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="
|
19 |
<compatible/>
|
20 |
-
<dependencies><required><php><min>5.2.16</min><max>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Avenla_KlarnaCheckout</name>
|
4 |
+
<version>1.0.8</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://productdownloads.avenla.com/magento-modules/klarna-checkout/">Custom license by Avenla Oy</license>
|
7 |
<channel>community</channel>
|
13 |
</description>
|
14 |
<notes>Klarna Checkout module</notes>
|
15 |
<authors><author><name>Avenla Oy</name><user>Avenla</user><email>info@avenla.fi</email></author></authors>
|
16 |
+
<date>2014-10-22</date>
|
17 |
+
<time>12:43:27</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Avenla"><dir name="KlarnaCheckout"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Field"><file name="Pclass.php" hash="99f758992b958ae9097d2026984dff7d"/></dir><dir name="Fieldset"><file name="Info.php" hash="a7fd2dde41ccfe8477267a45be3abf5a"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Price.php" hash="15be72dbe2723bb2d72c6977abd4d8a7"/></dir></dir><dir name="KCO"><file name="Confirmation.php" hash="1b46e67d919f16cb5cd33459c9cc3c1f"/><file name="Info.php" hash="2af961abb2eb0609b84f8da5281332ad"/><file name="Newsletter.php" hash="8d02745a2c814101ae61b2bf00e8901e"/></dir><file name="KCO.php" hash="1abf22f4408a872572c1f8babed730d6"/></dir><dir name="Helper"><file name="Api.php" hash="40f14b72afdcf758b97b564ebe27d0c6"/><file name="Data.php" hash="a5591fd65aa1358570421b4aba6c93c6"/></dir><dir name="Model"><file name="Api.php" hash="016856fd21d1b0e414b34e20e4f436ff"/><file name="Config.php" hash="659c403d06c646ed31d1344f19a62511"/><file name="KCO.php" hash="8c15a8882acbce2bd8630228e9cccc04"/><file name="Newsletter.php" hash="9696df5adee53302fba4d614656350f2"/><file name="Observer.php" hash="032c1dc5216c5da585e82b797948dc71"/><file name="Order.php" hash="faa6f986f28d46fe502d9616a2517a4f"/><dir name="Source"><file name="Countries.php" hash="0440b3ecc5528cf42dbb937eb7d9c0cb"/><file name="Kcolayout.php" hash="9ece6e53ebb4e39e3c1d4d534d71cb27"/><file name="Orderlocale.php" hash="a88769cf211991c70a0f51185bc53fb0"/><file name="Pplayout.php" hash="455484dbea2ff0770aa17e42851b81a6"/><file name="Ppwidget.php" hash="4e1de2ee86a2f5bf5100e211bc01b8f2"/><file name="Servermode.php" hash="df4420b3831b1a1e1ec04daa53711a4d"/><file name="Shippingmethods.php" hash="fecb931e29be4ae008c678cc1d760a02"/><file name="Taxclass.php" hash="c770ce5721c820c27895580e4d2de4b1"/></dir><file name="Validator.php" hash="cb8148baee0988c4a59eb6d9c5b1989d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="KCOController.php" hash="c161d3eb39f4d3a9f27985934e7144af"/></dir><file name="CartController.php" hash="891403418045004e6c047c0173dc7c6a"/><file name="KCOController.php" hash="b89898a8bd2af9817fc646458cc0ddac"/></dir><dir name="etc"><file name="config.xml" hash="e910749c0d6f73f81411b308a4e20932"/><file name="system.xml" hash="eb86aa4041195a9ed8e98ffbf98958b8"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="KCO"><file name="info.phtml" hash="92048d26b2b4f751e4c83ddddab89448"/><dir name="system"><dir name="config"><dir name="field"><file name="pclass.phtml" hash="8566542d14d0dce48dc6aabaf5181007"/></dir><dir name="fieldset"><file name="info.phtml" hash="36a21983fcc4816b7c8a6b8fe9f2e78c"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="KCO"><file name="KCO.phtml" hash="c71d63a2599d086c0937cbd23426d20b"/><dir name="cart"><file name="crosssell.phtml" hash="e7f78cb99e14ab680b794524b8666812"/><file name="giftmessage.phtml" hash="4cb99583d6ce811a3a576a6e20ff0f99"/><dir name="item"><file name="default.phtml" hash="9190b3fad2f2ed57ea2ffbed2e1faa02"/></dir><file name="shipping.phtml" hash="b940c98adec4e3fd455ffc04094a1a4f"/></dir><file name="cart.phtml" hash="4d0d54548f1a20ed359f8e517767d233"/><file name="cart_twocolumns.phtml" hash="6e296c790b5c3a96cdb313ee4829b977"/><dir name="catalog"><dir name="product"><file name="price.phtml" hash="8f32fd038bed9521f6f576d736408ca9"/></dir></dir><file name="info.phtml" hash="a87d8ee70c92a10445fa864a63d042ba"/><file name="link.phtml" hash="d2c3dac8b2cde4b52854019e990b3b11"/><file name="newsletter.phtml" hash="87c3730ed525d3810a5df0a9180bf993"/><dir name="onepage"><file name="link.phtml" hash="a05ab2ebf5f0ed225c2f3967e2bceced"/></dir></dir></dir><dir name="layout"><file name="KCO.xml" hash="63e485d105bbe6c6969fe85e336deea9"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Klarna"><file name="Country.php" hash="40360c3964fc6193e7fb922845eb419b"/><file name="Currency.php" hash="a709407428d86521cc0775cbeb281523"/><file name="Encoding.php" hash="f8f8e744303ff7ce7f4b226331e7bdcf"/><file name="Exceptions.php" hash="933b2811e910da817743766cdde8ffeb"/><file name="Flags.php" hash="b407a1373adf5f172bef3e3d01e81cdb"/><file name="Klarna.php" hash="c92501977a6fc642715045a49e29b50a"/><file name="Language.php" hash="8e40aed0dece8f0a3fbe07e37451af16"/><dir name="checkout"><file name="checkouthtml.intf.php" hash="81e0740254585f2af67895df28093d35"/><file name="threatmetrix.class.php" hash="6ce1bfded90b6b3bb329176ff4c7acac"/></dir><dir name="examples"><file name="activate.php" hash="85a84a8eaeec830949551dfd98fe0236"/><file name="activateInvoice.php" hash="cfac2ed57d0c79679fb35ca723eaffab"/><file name="activatePart.php" hash="b46475c2d9f5b326ff2cd65586a1de6e"/><file name="activateReservation.php" hash="bd9b0e5717eaa32ebf6b5d31ad66e5d4"/><file name="addTransaction.php" hash="6426b7965de733bb17ddc7f74ee3949f"/><file name="calc_monthly_cost.php" hash="30e78c4d40db82643396f9289749a898"/><file name="cancelReservation.php" hash="ae8d00e19c671f6cfe8454a5bb590ab1"/><file name="changeReservation.php" hash="43d9486d29326a8c33a4fda466612149"/><file name="checkOrderStatus.php" hash="bef76f120b3e486790d78b50f4101701"/><file name="creditInvoice.php" hash="8edca171c9f7be2a3c15b23ff166048e"/><file name="creditPart.php" hash="5497b9307da7cccadbf4a6c0dc943876"/><file name="deleteInvoice.php" hash="6d2a6e53c64e7a1aacb79c775a46da5b"/><file name="emailInvoice.php" hash="764fbd5fab4f52dacd767a3f7ac17234"/><file name="fetchPClasses.php" hash="aac08dc4d9cfece6ac9e9a9c4e7b20cc"/><file name="getAddresses.php" hash="ebd79224ea702c92e99a407a53d42da0"/><file name="getPClasses.php" hash="8e444c98a7c63b82512af1f4ce35ac65"/><file name="invoiceAddress.php" hash="97475403b1db4264c0add60930380434"/><file name="invoiceAmount.php" hash="2f5dc326549b179cf99c27518b715e88"/><file name="invoicePartAmount.php" hash="87bf68e855bfdd4f6ba3547091104c97"/><file name="reserveAmount.php" hash="1a97ef5c39f5a2c6d97660504cbbfa10"/><file name="reserveOCR.php" hash="9349b5ea9807060cba4b5f3fcd14369f"/><file name="returnAmount.php" hash="02caca4d76b6d055d504023c770961a4"/><file name="sendInvoice.php" hash="9139eef562746840d09f9d9d5a465c21"/><file name="splitReservation.php" hash="0e09421de645d97c3b74485d51edacfd"/><file name="update.php" hash="3e3561165f4c6727731afe451b0f87d6"/><file name="updateChargeAmount.php" hash="34de26a7f6a089bdb18f67eae1f903c7"/><file name="updateGoodsQty.php" hash="e4f9ee36f56b47924ba35cda500cf13e"/><file name="updateOrderNo.php" hash="cdd594a386072f7bffbf05d2ecdcb9b7"/></dir><file name="klarnaaddr.php" hash="b090d4b0a819fdb7cc58815a8643de18"/><file name="klarnacalc.php" hash="3ab728bf3889240b881f282122fd25fd"/><file name="klarnaconfig.php" hash="a3a4011dccda60fcf3567f56254699ff"/><file name="klarnapclass.php" hash="26a8fd1df0806788f6719cb894787f76"/><dir name="pclasses"><file name="jsonstorage.class.php" hash="e59e526d9dcc17d1ca92ded188750672"/><file name="mysqlstorage.class.php" hash="896a5cd4edf461ef517e0bb2e328707b"/><file name="sqlstorage.class.php" hash="bb7ba4359e7e69424c9f0ecdafc0c9ae"/><file name="storage.intf.php" hash="26db57484b6db3d717c0150ffaa87b19"/><file name="xmlstorage.class.php" hash="4f13939bf8d73f2724f858dd17f219de"/></dir><dir name="transport"><dir name="xmlrpc-3.0.0.beta"><dir name="lib"><file name="xmlrpc.inc" hash="5a74ea2a831648febc9b2c8f809b252c"/><file name="xmlrpc_wrappers.inc" hash="5aa00141ead09fc5498d9a3c9fcab888"/><file name="xmlrpcs.inc" hash="158b97bda79333e9b40793d876b6e98f"/></dir></dir></dir></dir><dir name="KlarnaCheckout"><dir name="Checkout"><file name="BasicConnector.php" hash="e15b4e83aa79afa7c98dbbfb865d7a7a"/><file name="ConnectionErrorException.php" hash="e07a9ccb71869c98036b085b146171fa"/><file name="Connector.php" hash="5378924b60a858f14a41882a8c90c6bc"/><file name="ConnectorException.php" hash="b4304fc99da372305dc4ad40e849a4a9"/><file name="ConnectorInterface.php" hash="f7e0c91db42f54cc4a9858cc1ef47e1a"/><file name="Digest.php" hash="28bde4dc8443bbcc5ad7d04ea9d9c5eb"/><file name="Exception.php" hash="43b4516fe4fe5aa98e1f9b382f504ab7"/><dir name="HTTP"><file name="CURLFactory.php" hash="7fa2aecea60eaf467b1965d2335935d9"/><file name="CURLHandle.php" hash="0b7d459eec95a0f17f420d0493e828bc"/><file name="CURLHandleInterface.php" hash="ddcf0889e242f1f15e6df047386e8403"/><file name="CURLHeaders.php" hash="0807a7b2e579490e08576b4d30f1d1d8"/><file name="CURLTransport.php" hash="a50ed245e0246b6ecc27042bd457bb86"/><file name="Request.php" hash="d7718e7e503a8b4c355aff2b31d0c174"/><file name="Response.php" hash="6be76eb703d424b77e9ea1b37f4825f2"/><file name="Transport.php" hash="c8dd8f3560c310dc78b84bfa057419b5"/><file name="TransportInterface.php" hash="8395efa365907d216633370d79d5380b"/></dir><file name="Order.php" hash="29309d953e7b3b3ae411a6ee913410d9"/><file name="ResourceInterface.php" hash="93a56d28ccf5a29010fb33f15d53ae32"/><file name="UserAgent.php" hash="4817af9e0b3a3b99236d240cfffbbdb7"/></dir><file name="Checkout.php" hash="e28fbfb7516e27bb792d7b3fba8c8853"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="KCO"><file name="dropdown.png" hash="a408e177ff3130bdb4bb491935700df4"/><file name="kco.css" hash="293485490a353852b62c2ede827da28b"/><file name="klarna_simplifying.png" hash="280abffdadbbd0d372a8505c4c83a9e8"/><file name="loader.gif" hash="5e51d58f5d9bd09ab814d9ca9347d3b9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Avenla_KlarnaCheckout.xml" hash="22b47fd5cc2c12370457a51ffff752d6"/></dir></target><target name="magelocale"><dir name="fi_FI"><file name="Avenla_KlarnaCheckout.csv" hash="0d44f78f6c9495701e380cb0ffc9b972"/></dir></target></contents>
|
19 |
<compatible/>
|
20 |
+
<dependencies><required><php><min>5.2.16</min><max>6.0.0</max></php></required></dependencies>
|
21 |
</package>
|
skin/frontend/base/default/KCO/kco.css
CHANGED
@@ -109,4 +109,9 @@
|
|
109 |
.twocolumncart .col2-set .col-1, .twocolumncart .col2-set .col-2{float: none;width: auto;border: 0;padding-right: 0;padding-left: 0;}
|
110 |
.twocolumncart .cart-collaterals .col2-set .col-1, .twocolumncart .cart-collaterals .col2-set .col-2, .cart .cart-collaterals .col2-set .col-2 {width: 100%;}
|
111 |
.cart-table button.button{margin-bottom:5px;}
|
112 |
-
}
|
|
|
|
|
|
|
|
|
|
109 |
.twocolumncart .col2-set .col-1, .twocolumncart .col2-set .col-2{float: none;width: auto;border: 0;padding-right: 0;padding-left: 0;}
|
110 |
.twocolumncart .cart-collaterals .col2-set .col-1, .twocolumncart .cart-collaterals .col2-set .col-2, .cart .cart-collaterals .col2-set .col-2 {width: 100%;}
|
111 |
.cart-table button.button{margin-bottom:5px;}
|
112 |
+
}
|
113 |
+
|
114 |
+
.KCOgiftFormContainer{margin-bottom:20px;}
|
115 |
+
.catalog-product-view .kco-ppayment p{margin:0px;}
|
116 |
+
.catalog-category-view .kco-ppayment p{font-size:11px;margin:0px;}
|
117 |
+
.kco-ppayment img{display:inline;}
|