Jump to content

Sending 3 decimal places amount to Paypal module


pl.sabotinov

Recommended Posts

Hello everybody,

 

My prestashop is 1.5.4.1 and paypal module is 3.6.6.

 

I have noticed that working only with two decimal places in prestashop causes incorrect computing of the prices. This is especially a problem when working with low value single prices. For example i have price of single piece - 0.12 Eu, and would like to add specific price rule for amount over 500 pcs. So i want to add a discount for this amount -40%. Thus the correct price with the discount should be 0.072 Eu. But because of working with two decimals presta rounds this single price to 0.07Eu. So if a customer orders 500 pcs x 0.07 = 35Eu, instead of 500*0.072 = 36Eu.

I think i found the way to work properly with 3 decimal places so i have achieved a proper computing of the single prices and the end price.

But here had appeared a new  problem with the paypal module. It does not accept values with three decimals and returns errors: 10401, 10412, 10413, 10427. So i have decided to round the endvalues of the cart rows and the total value in the cart. So instead of sending to Paypal the amount for example: 35.953 i have managed to send this amount rounded to the 2nd decimal place  - 35.950 Eu. But still i do receive the same error report from Paypal - so the module is working only with 2 decimal places - doesn't matter if the amount is rounded to the 2nd decimal place. If i switch back to wotking with 2 decimal places i do not have any error reports from paypal module.

So my question is: Can i adjust the sending of the values to paypal to be made with rounded 2 decimal places amounts.And if it is possible, which files should i override. I have looked for it in the Paypal.php, but think could not fiond such a place or code to modify if for having this result. It seems that everything depends on the _PS_PRICE_DISPLAY_PRECISION_ definition. Or i could not understand all the code in  this module.

 

So please if somebody can answer me, if it is possible to work with 3 decimal places, but to send to the paypal module the total row amount and total amount from cart using only 2 decimal places. (Rounded [converted to 2 decimal places]  end value of the price).

 

Thanks in advance and kind regards,

Link to comment
Share on other sites

the issue is when one goes to 3 decimal currency, for a two decimal currency, then when they interact outside ps, they must conform to two digit...

 

so when paypal module sends api info, there is where you want to change to ensure two decimal. 

 

you could try modeling your eu currency like three digit currency Colombian Pesos for example,   I've never actually done this but have some experience in currencies, then it would be naturally in 3 decimal without change, then of course changing to two decimal when sent via api to paypal.

Link to comment
Share on other sites

Hello El Patron,

 

was busy last two days and couldn't answer. Regarding the Pesso format of the currency, i have read some of your posts and suppose you mean this currency format: 0,000.00X.

The problem is that i have made a script for updating all of my prices in the online store automaticly from the prices in the ERP system. The format there is actually another : 000.00. So it is difficult to change the format, because i do need this function, as it saves a lot of time.(Though as i think it might be preadjusted) So i will need to find the code in the paypal module, where the api sends the info with the numbers to paypal. 

  • Like 1
Link to comment
Share on other sites

Hello El Patron,

 

was busy last two days and couldn't answer. Regarding the Pesso format of the currency, i have read some of your posts and suppose you mean this currency format: 0,000.00X.

The problem is that i have made a script for updating all of my prices in the online store automaticly from the prices in the ERP system. The format there is actually another : 000.00. So it is difficult to change the format, because i do need this function, as it saves a lot of time.(Though as i think it might be preadjusted) So i will need to find the code in the paypal module, where the api sends the info with the numbers to paypal. 

 

Hi, let us know how you eventually get this sorted.  best of luck to you and your work.

Link to comment
Share on other sites

Hello again,

 

as far as i can see not all modules could be overidden in prestashop. Is it valid also for the paypal module or part of it : paypal.php ; submit.php and other files in the modules/paypal folder? 

I am asking as i can not see this module in the appropriate folder as given in the prestashop docs: 

  • /themes/my_theme/modules/my_module/views/templates/front/my_module.tpl
  • ...
Link to comment
Share on other sites

  • 1 year later...

Hi, I have 1.0.6.9 of prestashop and this form has always worked but today I received these emails whit this text:


Error reporting from your PayPalAPI module

A client has encountered a problem with the module PayPalAPI, see the report:

PayPal response: 
TIMESTAMP -> 2015-11-30T08:24:23Z 
L_ERRORCODE0 -> 10401 
L_ERRORCODE1 -> 10427 
L_ERRORCODE2 -> 10413 
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 for details. 

L_SHORTMESSAGE2 -> Transaction refused because of an invalid argument. See additional error messages for details. 
L_LONGMESSAGE0 -> Order total is invalid. 
L_LONGMESSAGE1 -> Shipping total is invalid. 
L_LONGMESSAGE2 -> The totals of the cart item amounts do not match order amounts. 
L_SEVERITYCODE0 -> Error 
L_SEVERITYCODE1 -> Error 
L_SEVERITYCODE2 -> Error

post-1119372-0-96920100-1448874506_thumb.png

anyone can help me?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...