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

Shipping tax fails to calculate when using the backend #1288

Closed
deodad opened this issue Jun 30, 2016 · 5 comments
Closed

Shipping tax fails to calculate when using the backend #1288

deodad opened this issue Jun 30, 2016 · 5 comments

Comments

@deodad
Copy link
Contributor

deodad commented Jun 30, 2016

Calculating, and re-calculating shipping tax when building an order in the backend is a bit funky. I've listed a flow below that can be performed on a 1.3.0 sandbox to replicate.

  1. In the admin, create a new order.
  2. Add a Ruby on Rails Bag.
  3. Under customer details, fill out any U.S. address and submit.
  4. Under shipments, select UPS One Day.
  5. Go to payments.

At this point we have an order total of $39.14, which is 75 cents short of what it should be due to the missing shipping tax. This is because the order is still in the delivery state, even though we are trying to create a payment. There is no way intuitive way to have the order transition to payment.

  1. Submit a payment with the default amount ($39.14).

A payment is created for a (different) amount that includes the newly created shipping tax ($39.89). This might be a bug: the payment form is submitted with $39.14 in the amount field, but after the order transitions and calculates the shipping tax, a payment is created for $39.89 instead.

  1. Return to the shipments page, change the shipping method to UPS Ground.

The shipping tax adjustment changes from 75 cents to 25 cents, but the tax total on the order doesn't get updated. Again, no intuitive way to have the order re-calculate/transition.

@fredericboivin
Copy link
Contributor

fredericboivin commented Jun 30, 2016

I ran into something similar yesterday, I think the issue at hand is that taxes are updated by the OrderUpdater and that changing the selected_shipping_rate from the backend does not trigger anything that calls the OrderUpdater because it goes through the API and simply update the attributes, while adding a payment trigger @order.next which calls OrderUpdater through a transition callback

from shipment.rb

def selected_shipping_rate_id=(id)
   shipping_rates.update_all(selected: false)
   shipping_rates.update(id, selected: true)
   save!
end

@jordan-brough
Copy link
Contributor

Note to self: We should try to tackle this while working on #1252

@jordan-brough
Copy link
Contributor

@adaddeo & @dangerdogz thanks for the detailed info.

@jhawthorn
Copy link
Contributor

This should be fixed by #1514, which has been merged into master

@deodad
Copy link
Contributor Author

deodad commented Nov 8, 2016

Great stuff!

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

No branches or pull requests

4 participants