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

Fix Shipment#update_attributes_and_order - run full order updater #1514

Merged
merged 4 commits into from
Nov 8, 2016

Conversation

jordan-brough
Copy link
Contributor

Tax charges aren't being updated when the shipping method changes
because some parts of OrderUpdater aren't being run in
Shipment#update_attributes_and_order.

Also fix an issue in order_factory around shipment taxes.

See individual commits.

@jordan-brough jordan-brough force-pushed the update-shipments-taxes branch from bc39758 to dc70aa7 Compare October 11, 2016 04:43
Copy link
Member

@gmacdougall gmacdougall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

I love the direction for this. If we can remove some of the crazy order updater bypassing like this, we can optimize things by making the order updater faster and more intelligent about what it needs to update rather than having that logic strewn about.

Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is good. Concentrate all the tax stuff in the order updater. :)

@jhawthorn
Copy link
Contributor

What was the issue in the order_factory? Can we test it in a spec?

@jordan-brough
Copy link
Contributor Author

@jhawthorn see the commit message on the first commit:

Fix order_factory to create tax charge after shipment
Otherwise the shipment doesn't get a tax adjustment set up.

Yah I can create a spec for that. Will do.

@jordan-brough
Copy link
Contributor Author

@jhawthorn I've added a spec for the factory


create(:shipment, order: order, cost: evaluator.shipment_cost, shipping_method: evaluator.shipping_method, stock_location: evaluator.stock_location)
order.shipments.reload

order.create_tax_charge!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is no longer necessary thanks to your work in #1479

This order wasn't set up in a valid way. Just running `order.update!`
would mess up the test values.
Tax charges aren't being updated when the shipping method changed
because some parts of OrderUpdater aren't being run in
`Shipment#update_attributes_and_order`.
Tax charges aren't being updated when the shipping method changes
because some parts of OrderUpdater aren't being run in
`Shipment#update_attributes_and_order`.
@jhawthorn jhawthorn force-pushed the update-shipments-taxes branch from 52c1995 to 86f2e33 Compare November 8, 2016 00:32
@jhawthorn
Copy link
Contributor

@jordan-brough I rebased and removed the first commit, which was unnecessary as of #1479 🎉

@jhawthorn jhawthorn merged commit 94f630f into solidusio:master Nov 8, 2016
@mtomov
Copy link
Contributor

mtomov commented Nov 8, 2016

I also think that this simplification is brilliant, and @gmacdougall said it all very well. Thanks a lot!

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

Successfully merging this pull request may close these issues.

5 participants