Version Notes
Klarna Checkout module
Download this release
Release Info
Developer | Avenla Oy |
Extension | Avenla_KlarnaCheckout |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- app/code/community/Avenla/KlarnaCheckout/Model/Order.php +30 -24
- app/code/community/Avenla/KlarnaCheckout/Model/Validator.php +6 -0
- app/code/community/Avenla/KlarnaCheckout/etc/config.xml +1 -1
- app/locale/fi_FI/Avenla_KlarnaCheckout.csv +2 -1
- lib/KlarnaCheckout/Checkout/UserAgent.php +1 -1
- package.xml +4 -4
app/code/community/Avenla/KlarnaCheckout/Model/Order.php
CHANGED
@@ -31,6 +31,7 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
31 |
public $connector;
|
32 |
public $order;
|
33 |
private $mobile;
|
|
|
34 |
|
35 |
public function __construct()
|
36 |
{
|
@@ -184,21 +185,26 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
184 |
private function addProductsToCart()
|
185 |
{
|
186 |
$mCart = $this->quote->getAllVisibleItems();
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
|
204 |
/**
|
@@ -209,18 +215,18 @@ class Avenla_KlarnaCheckout_Model_Order extends Klarna_Checkout_Order
|
|
209 |
{
|
210 |
$totals = $this->quote->getTotals();
|
211 |
$baseDiscount = $this->quote->getShippingAddress()->getBaseDiscountAmount();
|
212 |
-
|
213 |
-
if($baseDiscount
|
214 |
$discount = $totals['discount'];
|
215 |
|
216 |
$this->cart[] = array(
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
}
|
225 |
}
|
226 |
|
31 |
public $connector;
|
32 |
public $order;
|
33 |
private $mobile;
|
34 |
+
private $discounted = 0;
|
35 |
|
36 |
public function __construct()
|
37 |
{
|
185 |
private function addProductsToCart()
|
186 |
{
|
187 |
$mCart = $this->quote->getAllVisibleItems();
|
188 |
+
if(count($mCart) > 0){
|
189 |
+
foreach ($mCart as $i){
|
190 |
+
$discount_rate = 0;
|
191 |
+
if($i->getBaseDiscountAmount()){
|
192 |
+
$discount_rate = $i->getBaseDiscountAmount() / ($i->getBaseRowTotalInclTax() / 100);
|
193 |
+
$this->discounted += $i->getBaseDiscountAmount();
|
194 |
+
}
|
195 |
+
|
196 |
+
$this->cart[] = array(
|
197 |
+
'type' => 'physical',
|
198 |
+
'reference' => $i->getSku(),
|
199 |
+
'name' => $i->getName(),
|
200 |
+
'uri' => $i->getUrlPath(),
|
201 |
+
'quantity' => (int)$i->getQty(),
|
202 |
+
'unit_price' => round($i->getBasePriceInclTax(), 2) * 100,
|
203 |
+
'discount_rate' => round($discount_rate, 2) * 100,
|
204 |
+
'tax_rate' => round($i->getTaxPercent(), 2) * 100
|
205 |
+
);
|
206 |
+
}
|
207 |
+
}
|
208 |
}
|
209 |
|
210 |
/**
|
215 |
{
|
216 |
$totals = $this->quote->getTotals();
|
217 |
$baseDiscount = $this->quote->getShippingAddress()->getBaseDiscountAmount();
|
218 |
+
|
219 |
+
if(abs($baseDiscount) - $this->discounted > 0.001){
|
220 |
$discount = $totals['discount'];
|
221 |
|
222 |
$this->cart[] = array(
|
223 |
+
'type' => 'discount',
|
224 |
+
'reference' => $discount->getcode(),
|
225 |
+
'name' => $discount->getTitle(),
|
226 |
+
'quantity' => 1,
|
227 |
+
'unit_price' => round($baseDiscount, 2) * 100,
|
228 |
+
'tax_rate' => 0
|
229 |
+
);
|
230 |
}
|
231 |
}
|
232 |
|
app/code/community/Avenla/KlarnaCheckout/Model/Validator.php
CHANGED
@@ -50,6 +50,12 @@ class Avenla_KlarnaCheckout_Model_Validator extends Mage_Core_Model_Abstract
|
|
50 |
*/
|
51 |
public function validateQuote($quote, $ko)
|
52 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
if (!$quote->isVirtual()){
|
54 |
$address = $quote->getShippingAddress();
|
55 |
$method= $address->getShippingMethod();
|
50 |
*/
|
51 |
public function validateQuote($quote, $ko)
|
52 |
{
|
53 |
+
if(!isset($ko->shipping_address->phone) || !isset($ko->billing_address->phone)){
|
54 |
+
$msg = Mage::helper('klarnaCheckout')->__('Please fill in your phone number.');
|
55 |
+
Mage::getSingleton('core/session')->addError($msg);
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
|
59 |
if (!$quote->isVirtual()){
|
60 |
$address = $quote->getShippingAddress();
|
61 |
$method= $address->getShippingMethod();
|
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>
|
23 |
<config>
|
24 |
<modules>
|
25 |
<Avenla_KlarnaCheckout>
|
26 |
+
<version>1.0.6</version>
|
27 |
</Avenla_KlarnaCheckout>
|
28 |
</modules>
|
29 |
<global>
|
app/locale/fi_FI/Avenla_KlarnaCheckout.csv
CHANGED
@@ -47,4 +47,5 @@
|
|
47 |
"Part payment widget layout", "Osamaksu tietojen ulkoasu"
|
48 |
"Please use the same post code for your quote and Klarna.", "Toimitustavan valinnassa tulee käyttää samaa postinumeroa kuin Klarnan tilaajan tiedoissa."
|
49 |
"Hide links to default Checkout", "Piilota linkit kassasivulle"
|
50 |
-
"Text shown in Klarna link at Magento Checkout", "Kassan linkissä näytettävä teksti"
|
|
47 |
"Part payment widget layout", "Osamaksu tietojen ulkoasu"
|
48 |
"Please use the same post code for your quote and Klarna.", "Toimitustavan valinnassa tulee käyttää samaa postinumeroa kuin Klarnan tilaajan tiedoissa."
|
49 |
"Hide links to default Checkout", "Piilota linkit kassasivulle"
|
50 |
+
"Text shown in Klarna link at Magento Checkout", "Kassan linkissä näytettävä teksti"
|
51 |
+
"Please specify a shipping method.", "Ole hyvä ja täytä puhelinnumerosi."
|
lib/KlarnaCheckout/Checkout/UserAgent.php
CHANGED
@@ -67,7 +67,7 @@ class Klarna_Checkout_UserAgent
|
|
67 |
),
|
68 |
'Module' => array(
|
69 |
'name' => 'KlarnaCheckout.MagentoModule',
|
70 |
-
'version' => '1.0.
|
71 |
)
|
72 |
);
|
73 |
}
|
67 |
),
|
68 |
'Module' => array(
|
69 |
'name' => 'KlarnaCheckout.MagentoModule',
|
70 |
+
'version' => '1.0.6'
|
71 |
)
|
72 |
);
|
73 |
}
|
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-07
|
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="3d0fd774a6116513e4d413a078e80848"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Ppwidget.php" hash="bdf50c2d2fc94994d853f33ff9600117"/></dir></dir><dir name="KCO"><file name="Confirmation.php" hash="61e58e00070fa76b9f067619e0db5ba5"/><file name="Info.php" hash="2af961abb2eb0609b84f8da5281332ad"/></dir><file name="KCO.php" hash="1abf22f4408a872572c1f8babed730d6"/></dir><dir name="Helper"><file name="Api.php" hash="40f14b72afdcf758b97b564ebe27d0c6"/><file name="Data.php" hash="ca36161784169edf2e055088ac14a49d"/></dir><dir name="Model"><file name="Api.php" hash="dad35c50097e6e3aa5e72cbb4bc54ce1"/><file name="Config.php" hash="f0417d1bf67e0f6da2f6e581c763491c"/><file name="KCO.php" hash="48565fcddce1d3cad0192afc67972f0c"/><file name="Observer.php" hash="32a73fb00607a252ddc912f14ae630a2"/><file name="Order.php" hash="
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.16</min><max>5.5.0</max></php></required></dependencies>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Avenla_KlarnaCheckout</name>
|
4 |
+
<version>1.0.6</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-08-07</date>
|
17 |
+
<time>09:14:15</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="3d0fd774a6116513e4d413a078e80848"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Ppwidget.php" hash="bdf50c2d2fc94994d853f33ff9600117"/></dir></dir><dir name="KCO"><file name="Confirmation.php" hash="61e58e00070fa76b9f067619e0db5ba5"/><file name="Info.php" hash="2af961abb2eb0609b84f8da5281332ad"/></dir><file name="KCO.php" hash="1abf22f4408a872572c1f8babed730d6"/></dir><dir name="Helper"><file name="Api.php" hash="40f14b72afdcf758b97b564ebe27d0c6"/><file name="Data.php" hash="ca36161784169edf2e055088ac14a49d"/></dir><dir name="Model"><file name="Api.php" hash="dad35c50097e6e3aa5e72cbb4bc54ce1"/><file name="Config.php" hash="f0417d1bf67e0f6da2f6e581c763491c"/><file name="KCO.php" hash="48565fcddce1d3cad0192afc67972f0c"/><file name="Observer.php" hash="32a73fb00607a252ddc912f14ae630a2"/><file name="Order.php" hash="a634c4edd45cd92a217c6ba878d77aaa"/><dir name="Source"><file name="Countries.php" hash="0440b3ecc5528cf42dbb937eb7d9c0cb"/><file name="Orderlocale.php" hash="a88769cf211991c70a0f51185bc53fb0"/><file name="Pplayout.php" hash="455484dbea2ff0770aa17e42851b81a6"/><file name="Servermode.php" hash="df4420b3831b1a1e1ec04daa53711a4d"/><file name="Shippingmethods.php" hash="fecb931e29be4ae008c678cc1d760a02"/><file name="Taxclass.php" hash="ff40a1943352031fd7971688b805be05"/></dir><file name="Validator.php" hash="cb8148baee0988c4a59eb6d9c5b1989d"/></dir><dir name="controllers"><file name="CartController.php" hash="891403418045004e6c047c0173dc7c6a"/><file name="KCOController.php" hash="daea867511eca9b03ba7a9c668e52290"/></dir><dir name="etc"><file name="config.xml" hash="6c816ad3033638da7789186136d12efb"/><file name="system.xml" hash="697422c0d777501a660ab102411b9ae2"/></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="3fd13b1139150ac3949bc23dd22a63a4"/><dir name="system"><dir name="config"><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="659a8f322539d18d7e9a068dd5c48b15"/><dir name="cart"><file name="crosssell.phtml" hash="e7f78cb99e14ab680b794524b8666812"/><file name="shipping.phtml" hash="d5526d17ffe083471b02d683147ca2a2"/></dir><file name="cart.phtml" hash="587df7307d1a49d01525e6b6ae6e7a68"/><dir name="catalog"><dir name="product"><file name="ppwidget.phtml" hash="806ac81d9394ef9566daa080eb582832"/></dir></dir><file name="info.phtml" hash="a87d8ee70c92a10445fa864a63d042ba"/><file name="link.phtml" hash="7dadce1567975585dddd51bc904b95fa"/><dir name="onepage"><file name="link.phtml" hash="a05ab2ebf5f0ed225c2f3967e2bceced"/></dir></dir></dir><dir name="layout"><file name="KCO.xml" hash="86b6db0d5c6c777c0d7620cfeed5f6c1"/></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="dc69f2c10e9b65999057bc04246c3fe8"/><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="42afc7257646279bbc9239e5e427a76d"/><file name="ConnectionErrorException.php" hash="352ae3f5bbb18c04f0a9d3ca1be30faf"/><file name="Connector.php" hash="767cd6181abcd144ea8b2d1738f0a617"/><file name="ConnectorException.php" hash="fe4017579c8757798e018fb0755496c0"/><file name="ConnectorInterface.php" hash="0ebfd5610fec6ddce7b7fd0f45f3d1d6"/><file name="Digest.php" hash="d7c2ea4ff1f22c8919685aad7e4e9c8b"/><file name="Exception.php" hash="31a95e8212f01d149265f75e20b31bcb"/><dir name="HTTP"><file name="CURLFactory.php" hash="591493c487797a80fd76f4f80ca598d0"/><file name="CURLHandle.php" hash="2d58ba553ffddafdcc9c80bea0c2c5ee"/><file name="CURLHandleInterface.php" hash="df5e3ddf82deb09164c75249c7235756"/><file name="CURLHeaders.php" hash="2a900efb8591defaf9230368403c975f"/><file name="CURLTransport.php" hash="c35a9910a04007372c2d6673f4657b89"/><file name="Request.php" hash="180f04ffd522b713b4261087a7e60c68"/><file name="Response.php" hash="86993580c2a11b14bab4af6328caa6de"/><file name="Transport.php" hash="4aa96d5086e105d79b0f97593fbe5d9b"/><file name="TransportInterface.php" hash="3d6aab36479741136c9dee1bbcf3914e"/></dir><file name="Order.php" hash="568242a47b838ae9abf8438a4bc7301e"/><file name="ResourceInterface.php" hash="55fc925edc0f69a89f2d79e348152a2c"/><file name="UserAgent.php" hash="a7b2e9b256c679d1f314a0c5433703cf"/></dir><file name="Checkout.php" hash="6e16bb237ecfc54f086a0d533a8e69e3"/></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="fb072bb34dde0222d3e66bf076e91178"/><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="90c9e7967b95400592d6b00c9fd6395a"/></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.16</min><max>5.5.0</max></php></required></dependencies>
|
21 |
</package>
|