openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.1k stars 717 forks source link

Orders with tax refunds: Can't checkout with paypal - "PayPal failed. Tax total is invalid" #7535

Open filipefurtad0 opened 3 years ago

filipefurtad0 commented 3 years ago

Description

If a product has an included tax (for a given zone), but the order is placed from a customer with billing address outside that zone, then the order will include the refund of that tax amount.

This scenario seems to prevent Paypal from being used as a payment gateway on checkout: . The error "PayPal failed. Tax total is invalid" is displayed on the checkout page.

Expected Behavior

It should be possible to take payments with Paypal, in cases where there is a tax refund.

Actual Behaviour

It is not possible to take payments with Paypal, in cases where there is a tax refund.

Steps to Reproduce

  1. Set up an included tax, for a given Zone.
  2. Log in as a customer, and place some items in the cart in which this tax applies.
  3. Fill in the billing address making sure it is outside the Zone set for that tax.
  4. Attempt to checkout with Paypal.

Animated Gif/Screenshot

Peek 2021-05-03 11-10.gif

Workaround

Using another payment method.

Severity

It has workarounds, but I guess it will may prevent customer checkout, for hubs in which no other payment method is set. This would point out to S2.

Your Environment

Possible Fix

Matt-Yorkley commented 3 years ago

I'm pretty sure all instances that use included tax use a single default zone, so I don't think we'll currently hit this in production.

There are definitely issues around this tax-refund-for-inclusive-tax-on-orders-outside-the-default-zone scenario though :+1:

filipefurtad0 commented 3 years ago

That's good news! :+1: Shall we downgrade or rather or close?

Matt-Yorkley commented 3 years ago

Downgrade for sure, maybe s5. I'm pretty sure it's pre-exisiting for a long time. It would be good to make sure some of these little potential issues are solved though, in case a new instance pops up with different tax configurations.

Matt-Yorkley commented 3 years ago

There are a number of bugs like this that only appear with certain specific configurations and don't currently affect any production servers.

filipefurtad0 commented 3 years ago

Sure, I'm thinking of a similar case on #6463. Maybe grouping them in a Tax Refunds epic?