News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Klarna Checkout - Buggy as ....

Started by Rune Rasmussen, March 26, 2015, 14:18:54 PM

Previous topic - Next topic

Rune Rasmussen

Have been doing some testing on the Klarna Checkout lately, and it's seems to be so buggy that it probably shouldn't have been released.

1. Shipping tax isn't handled correctly, even if it's only one VatTax +% defined and assigned to one shipping option. It doesn't send the tax value to Klarna, and it will always output a error to the logged in customers telling:

QuoteError  vmError: KlarnaCheckout getTaxShipment: expecting math operation to be +% but is 

This seems to be because $shipment_calc_id isn't defined ref.
http://dev.virtuemart.net/projects/virtuemart/repository/entry/trunk/virtuemart/plugins/vmpayment/klarnacheckout/klarnacheckout.php#L247

        function getTaxShipment($shipment_calc_id) {
                // TO DO add shipmentTaxRate in the cart
                // assuming there is only one rule +%
                $db = JFactory::getDBO();
                $q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $shipment_calc_id . '" ';
                $db->setQuery($q);
                $taxrule = $db->loadObject();
                if ($taxrule->calc_value_mathop != "+%") {
                        VmError('KlarnaCheckout getTaxShipment: expecting math operation to be +% but is ' . $taxrule->calc_value_mathop);
                }
                return $taxrule->calc_value * 100;
        }



Filling in the correct tax id directly in the query works as a workaround.

      $q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`=1 ';

Don't know what the plan is/was, but even shops don't using tax, or don't have tax for shipping outside their own territory should be able to use this module - so requiring tax on it would be wrong anyway.

2. The system is always sending two error mails for each KCO order to store owner telling to look in error log, even if debug isn't activated, and there isn't any debug log. Those mails should only be sent when debug is active, or better have a own option for deactivation.

http://dev.virtuemart.net/projects/virtuemart/repository/entry/trunk/virtuemart/administrator/components/com_virtuemart/plugins/vmpsplugin.php#L1299

        public function debugLog($message, $title='', $type = 'message', $doDebug=true) {
                if ( isset($this->_currentMethod) and isset($this->_currentMethod->debug) and $this->_currentMethod->debug  AND $doDebug) {
                }
                if ( isset($this->_currentMethod) and !$this->_currentMethod->log and $type !='error') {
                        //Do not log message messages if we are not in LOG mode
                        return;
                }
                if ( $type == 'error') {
                        $this->sendEmailToVendorAndAdmins();
                }
                $this->logInfo($title.': '.print_r($message,true), $type, true);
        }



3. The debug file includes so much unneeded info, that it's really hard to read and identify the issues - often 100 KB per order ... and the debug will grove enormus in short time with the bugs that seems to be in there now.

4. Order history and comments is not added to the correct order. In a clean test site with only KCO-test, all is added to the first order. Only the first confimed message is added to the correct order. See image kco_comment_bug.png

5. On a live site the download links for packing slips is all going to testdrive: https://online.testdrive.klarna.com/packslips/....

6. Language files doesn't work. There's a bug in the core kco language file, giving bugs in all translations on Transifex:

VMPAYMENT_KLARNACHECKOUT_ERROR_AMOUNTS_SUBJECT="FEL med Klarna checkout"

But even if this is corrected manually the files will stopp KCO from working properly, t.ex. making it stop updating the orders on confirmed.

7. Debug choices in config use same language strings for both debug options, and the users have no clue what they do unless looking at the code. The last seems to be for saving the log file, the first I have no clue about - didn't care to figure out yet. See image kco_debug_option.png
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Rune Rasmussen

#1
Another thing is that the customers are forced to select a shipping option before Klarna Checkout can display, but when using shipping options requiring ZIP/Country, this doesn't work to well unless the customer register an address first. And so the effect of Klarna Checkout's simplified checkout process is partly lost...

There should be a field for entering zip, witch needs to be filled, before shipment options displays.

«Select shipping
[   ] Enter your zip code to see all available shipping options»

- This same zip field could then also post the zip to the Klarna Checkout field I guess...


Oh, and one more thing related to Klarna Checkout...

In cart after selecting Klarna Checkout, the requirement and display of TOS should be skipped/hidden, and same for the VM Checkout button - as both are handled in Klarna Checkout.

They only make it confusing, and if clicked they sends the customer to the VM registration process. Chances are big for the customer being annoyed and leaving the damn cart is quite big...
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Milbo

Thank you for your report, we take a look soon.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Rune Rasmussen

#3
Please also note that the tax issue also applies to the older versions, for both Klarna and Klarna Checkout. Plus that normal Klarna (invoice/account) seems totally broken in VM3 ...

Tested on default demo install J2.5.28 + VM 3.0.7.4 from http://dev.virtuemart.net/projects/virtuemart/files
Using PHP 5.3.29 since it's required by this Klarna Module, according to the config screen.
Guest Checkout

Product Details Display:
Quote
The layout: productprice_layout does not exist in:
/templates/vmbeez5/html/payment/klarna/productprice_layout.php
/plugins/payment/klarna/tmpl/productprice_layout.php
/plugins/payment/klarna/klarna/tmpl/productprice_layout.php

Cart Display - One Page. No payment options displayed, only:
Quote
Notice: Undefined property: VirtueMartViewCart::$found_payment_method in /components/com_virtuemart/views/cart/tmpl/select_payment.php on line 61

Notice: Undefined property: VirtueMartViewCart::$payment_not_found_text in /components/com_virtuemart/views/cart/tmpl/select_payment.php on line 75

Normal Cart - Payment Selection:
Quote
The layout: payment_form does not exist in:
/templates/vmbeez5/html/payment/klarna/payment_form.php
/plugins/payment/klarna/tmpl/payment_form.php
/plugins/payment/klarna/klarna/tmpl/payment_form.php


Strict Standards: Non-static method KlarnaHandler::getKlarnaError() should not be called statically, assuming $this from incompatible context in /plugins/vmpayment/klarna/klarna/helpers/klarna_payments.php on line 231

Strict Standards: Non-static method KlarnaHandler::checkPartpriceCondition() should not be called statically, assuming $this from incompatible context in /plugins/vmpayment/klarna/klarna.php on line 379

Strict Standards: Non-static method KlarnaHandler::getKlarnaError() should not be called statically, assuming $this from incompatible context in /plugins/vmpayment/klarna/klarna/helpers/klarna_payments.php on line 231

Also test server parameter is missing for Klarna invoice/account...
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Rune Rasmussen

One more thing,

Since Klarna is a invoicing service sending valid invoices to the customers, the module should have an option to send over the model number (SKU) instead of the product ID.

Many store owners don't have any realtion to the product ID in VirtueMart. They handle support calls, returns etc., based on model number (SKU).
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Rune Rasmussen

#5
Have discovered something who seems to be a quite bad issue with Klarna Checkout, who is cluttering up the database big time.

Sometimes it fails to create the order i VirtueMart, but the order is created and complete at Klarna Online - just missing an order number from VM. This is actually fine, good to have the order at least.

But now the problems starts as Klarna is sending updates for the order several times per day, and with the way the module seems to have been created this leads to a new insert in the virtuemart_orders table alone for each single update sent from Klarna - thus you will get lots of empty orders in VirtueMart for the failed orders.

It's really about time to get this module fixed, or removed, it's not stable at all it seems...
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Rune Rasmussen

Oh... and for the orders being "OK", the log is filed up with lines like this:

Quote2015-06-18 21:25:32 ERROR vmError: No klarna data for this order: 6521
2015-06-18 21:25:32 ERROR plgVmOnUpdateOrderPayment: No klarna data for this order:6521
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

alatak

Hello
I am fixing it. I have contacted you by skype .

alatak

Hello Rune
i have fixed klarnachekout
there is one issue i am not able to reproduce it is the "KlarnaCheckout getTaxShipment: expecting math operation to be +% but is "
i will send you the new version via skype to test

alatak

Hello Rune,

I have sent you the link to download the plugin  Klarnacheckout fixed.
This error "KlarnaCheckout getTaxShipment: expecting math operation to ..". i am not able to reproduce it
There is a debug+log option. If you set it on, and you have that error, send me the log file. it will give me some information to understand the error.

Thank you for the testing.


Rune Rasmussen

Hi Valérie, any news/progress on the VM3 version?

For the "KlarnaCheckout getTaxShipment: expecting math operation to .." remember that it only displays when the user is logged in.
And anyhow shipping tax is missing at Klarna Online also for guest, in the new VM2 version I got for testing.
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

alatak

Hello
The VM3 version is available here
https://www.dropbox.com/s/ac9b57282w9ewhc/com_virtuemart.3.0.10KCObeta1_ext_aio.zip?dl=0

the taxshipment issue is fixed for VM3.
I'll check for VM2 that issue tomorrow

there is still one issue which depend on your shipment configuration.
the issue is the following: if your shop has only shipment with countries, then vm has to wait until it gets the BT/ST address , and then the client can select the shipment
For example, if your shop uses UPS, it needs the ShipTo country, and shipto ZIP to return quotes
I am waiting for some replies from Klarna to finish that step.

Rune Rasmussen

OK, good - seems like tax issue is solved yes. At least it works in a "close to default" demo now.

But "Your payment for order %s has been confirmed by Klarna. Your reservation number is %s" is not inserted on the order status update, it only displays "Payment confirmed" - is it how it's supposed to be in beta mode, or is it a bug?

For the logo, isn't it better to use the eid and locale from the settings, in case there is seller/country/language specific logos or something influencing in future?
I mean for this one: http://dev.virtuemart.net/projects/virtuemart/repository/revisions/8893/diff/trunk/virtuemart/plugins/vmpayment/klarnacheckout/klarnacheckout/tmpl/display_payment.php

One missing language strings in settings:  VMPAYMENT_KLARNACHECKOUT_PAYMENT_LOGO_DISPLAY_TOOLTIP
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

alatak

Hello

Thanks for reporting. I am going to fix that.

Rune Rasmussen

#14
Hi Valérie,

I noticed there was quite many, and some bigger changes to the codebase, for Klarna since the test version posted above. Some marked as WIP, but then no more changes during the latest weeks.

Is the module considered stable now, and can it be pulled out and used as it is? Or do the changes for Klarna rely on other changes in VirtueMart core, so we have to wait to the next stable release of VirtueMart before we can test and use it?
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team