Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continued rounding errors #987

Closed
robwatson-intechra opened this issue Jan 25, 2018 · 15 comments
Closed

Continued rounding errors #987

robwatson-intechra opened this issue Jan 25, 2018 · 15 comments
Assignees
Labels
Milestone

Comments

@robwatson-intechra
Copy link

In reference to #892, #909, and #908, we are still experiencing order amount rounding issues that are causing us to have to pay change fees to our fulfillment company for each order that has this problem. This time I'm attaching a series of recent orders (with sensitive customer data obfuscated) in case a larger pattern can be revealed that might lead to a fix. Included at the bottom of the document is our WooCommerce status and config.
orders-with-rounding-errors.txt

@angelleye
Copy link
Collaborator

Interesting. The math actually does add up in these cases, and it does show Approved with the warning about the item amount being invalid. Are you seeing these payments show up in your PayPal account, or are they declining altogether?

I see an item with QTY 3 at 29.67, which is a total of 89.01. Then it's subtracting the penny as a line item discount to make the subtotal 89.00, which is indeed what is getting set for the ITEMAMT and the AMT, so it does add up and really shouldn't be throwing this error. I may need to circle back to PayPal MTS on this particular example.

Are you using 3 decimals in your pricing or something unique like that, by chance? It's odd that if the line item details are coming to 89.01 that WooCommerce would be calculating an order total of 89.00 even. Our system is then subtracting the penny so that the subtotal/itemamt matches the line item totals. So again, it's strange that it's telling us the itemamt is invalid when it's not.

Do you have any idea why WC would be calculating an order total of 89.00 even when you've got 3 items at 29.67 in the cart? We're just pulling what the WC cart object returns, so we need to figure out what's going on there.

@robwatson-intechra
Copy link
Author

The products are selling and being shipped, so they are definitely going into PayPal as completed orders. I'd have to individually confirm the exact amounts in PayPal, but I don't have access to that at the moment. I'll have to get back to you on that. What I do know is that the amounts arriving at the fulfillment center are off by varying penny amounts and those are having to be corrected, with us getting charged back for their time in doing so.

We are using a dynamic pricing plugin for calculating bulk pricing. For the majority of our sales of a particular product (which this batch of orders mostly consists of), the quantities purchased don't reach the level that includes even one decimal in the price multiplier factor. Only one of these orders reaches that level of quantity. These orders were mostly calculated using whole numbers or one decimal place for multipliers and just two decimal places for prices.

The reason it calculates to 89.00 with 3 items @ 29.67 is because 3 * 29.67 = 89.01, but the subtracted penny is what we want to figure out. Put another way, 89.00 / 3 = 29.66666666666667. So, the rounding of that price is the problem, in my understanding.

Here's a screenshot of the discount scale applied for that product. Regular price is $34.00 and it gets discounted the more you buy.

pricing-group

If you need direct access to the website, I can provide it. Just email me at rwatson at intechrahealth.com.

Also, what about those orders that are Approved but the IP address is invalid? Why would those have had off-amounts that would trigger the changes at fulfillment?

@angelleye angelleye added the bug label Jan 30, 2018
@angelleye angelleye added this to the 1.5.0 milestone Jan 30, 2018
@angelleye
Copy link
Collaborator

Thanks again for the details. I've got this added to our 1.5.0 milestone, so we'll just need to see if we can reproduce the problem using that dynamic pricing plugin and make necessary adjustments to resolve it.

I'm not sure what you're referring to about approved orders with invalid IP address..??

@crobertwatson
Copy link

Thanks. As for the ones that had error messages saying the IP address is invalid, they also got flagged by our fulfillment as being out of balance on the amounts. Do you see the same? Maybe I need to have a conversation with them about those, if not.

@angelleye
Copy link
Collaborator

Is the IP address error coming back from PayPal, or where exactly are you seeing that? I'm just not clear where that's coming from..??

@robwatson-intechra
Copy link
Author

The IP address error is coming back from PayPal from what I can tell in the log file.

@angelleye
Copy link
Collaborator

Are you using the latest version of our plugin? There were some IP address issues that stem from some servers returning the IPv6 value, but PayPal only accepts IPv4. We made adjustments to this in our latest updates and other than this report we haven't had any other reports of that problem since then. Please verify you're using the latest version of our plugin..??

@angelleye angelleye modified the milestones: 1.5.0, 1.4.7.3 Jan 30, 2018
@robwatson-intechra
Copy link
Author

We're using Version 1.4.7.2.

@angelleye
Copy link
Collaborator

So which gateway specifically is this happening with?

@robwatson-intechra
Copy link
Author

Payflow. These are showing up in the Payflow logs in WooCommerce > Status > Logs > paypal_pro_payflow....log

@angelleye
Copy link
Collaborator

@robwatson-intechra We've made some adjustments here that should resolve this, and I'll be pushing a 1.4.7.3 update soon.

angelleye pushed a commit that referenced this issue Feb 9, 2018
@robwatson-intechra
Copy link
Author

Thank you. Looking forward to it. Sorry to keep reporting these, but I figure it's better to know than not.

@angelleye
Copy link
Collaborator

No problem at all, we appreciate the feedback!

@robwatson-intechra
Copy link
Author

Now that we've updated to this version (actually version 1.4.7.4 now), we caught these two "out of balance" items. The error messages from the fulfillment vendor are as follows:

Message: Order: 218731 Error: orderTotal of 92.00 is not equal to the sum of line item, shipping, tax and discount applied charges of 92.0100 (Order.orderTotal)

Message: Order: 218725 Error: orderTotal of 179.00 is not equal to the sum of line item, shipping, tax and discount applied charges of 178.9800 (Order.orderTotal)

Attached is the WC PayFlow log of these two orders.
payflow-orders-log.txt

If you need access to the live system, I can provide the login information via private email.

@robwatson-intechra
Copy link
Author

Here are the pricings for the order for 92.00 (which is the total for quantity = 3 of this particular product). Is it that we have too many or too few decimal places?
pricing-group
regular-pricing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants