TWDesign Posted May 17, 2012 Share Posted May 17, 2012 If I use nice whole numbers like Price 100 JPY Tax %5 Total 105 JPY then PayPal Standard accepts my order just fine But if I change the amount to something like: Price 103 JPY Tax %5 Total 108.15 JPY (as per calculation) PayPal rejects the order with the following message PayPal response: TIMESTAMP -> 2012-05-17T02:14:25Z L_ERRORCODE0 -> 10401 L_ERRORCODE1 -> 10426 L_ERRORCODE2 -> 10413 L_ERRORCODE3 -> 10431 L_SHORTMESSAGE0 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE1 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE2 -> Transaction refused because of an invalid argument. See additional error messages for details. L_SHORTMESSAGE3 -> Transaction refused because of an invalid argument. See additional error messages for details. L_LONGMESSAGE0 -> Order total is invalid. L_LONGMESSAGE1 -> Item total is invalid. L_LONGMESSAGE2 -> The totals of the cart item amounts do not match order amounts. L_LONGMESSAGE3 -> Item amount is invalid. L_SEVERITYCODE0 -> Error L_SEVERITYCODE1 -> Error L_SEVERITYCODE2 -> Error L_SEVERITYCODE3 -> Error PayPal returned error Japanese Yen is a non-decimal currency of course. My guess is that somewhere in the PayPal module the PHP code needs to have a round(price,0) function applied to the value that gets passed over. Any suggestions? Need help urgently ! I am using PrestaShop 1.4.7.3 PayPal Module 2.8.6 Link to comment Share on other sites More sharing options...
TWDesign Posted May 17, 2012 Author Share Posted May 17, 2012 OK, maybe I have fixed this myself. In the /classes/Cart.php file I searched for every instance of the ps_round function e.g. $row['total'] = Tools::ps_round($row['price'] * (int)($row['cart_quantity']), 2); This function takes two parameters, the variable to be rounded, and the "precision" to apply, which by default is set to 2 So I found every instance of the function and changed the 2 to a zero like this: $row['total'] = Tools::ps_round($row['price'] * (int)($row['cart_quantity']), 0); It's a quick fix. Best practice of course is to put this into an override file so it's future proofed. If somebody can explain the details of how to do that for the Cart.php Class I would be grateful. Link to comment Share on other sites More sharing options...
miskey Posted May 17, 2012 Share Posted May 17, 2012 (edited) I do have the rounding problem you described before, and I do not what exactly the problems. I guess the shopping amount is rounded when exchanged to another currency for clearing so it does not match the original shipping amount. Maybe you can try switching between different rounding mode at Backoffice > Preferences> Round mode Choose the rounding method: always superior, always inferior, or classic rounding. Edited May 17, 2012 by miskey (see edit history) Link to comment Share on other sites More sharing options...
TWDesign Posted May 17, 2012 Author Share Posted May 17, 2012 I do have the rounding problem you described before, and I do not what exactly the problems. I guess the shopping amount is rounded when exchanged to another currency for clearing so it does not match the original shipping amount. Maybe you can try switching between different rounding mode at Backoffice > Preferences> Round mode Choose the rounding method: always superior, always inferior, or classic rounding. I havent tried but I dont think those option would make much difference. Prestashop is clearly hard coded to use two decimals, which is strange because many of the world's currencies (Japanese Yen, Korean Won, Thai Baht) are zero decimal currencies. Link to comment Share on other sites More sharing options...
ezakimak Posted November 12, 2012 Share Posted November 12, 2012 Hi, Did you find a solution for this issue ? I am having the same problem with ps1.4.9.0 and paypal v3.0.9 Regards Hugo I havent tried but I dont think those option would make much difference. Prestashop is clearly hard coded to use two decimals, which is strange because many of the world's currencies (Japanese Yen, Korean Won, Thai Baht) are zero decimal currencies. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now