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

Don't treat "unreturned exchanges" differently in checkout #1690

Merged

Conversation

jhawthorn
Copy link
Contributor

Previously the order's checkout state machine treated unreturned exchanges (orders created to charge for a previously cross-shipped exchange shipment) specially.

This PR removes that special treatment in favour of making the AvailabilityValidator smarter and understanding inventory units which have already been shipped.

"Unreturned exchanges" may be extracted into their own gem in the future, this would more easily allow that.

Previously the subject validations would never run, so line_item.errors
would always be empty.
When finalizing shipments, only pending units are considered, so we
should do the same here.

When creating an "unreturned exchange", the order is created with an
existing shipment which has already been shipped and finalized. This
commit allows the AvailabilityValidator to consider that valid.
Now that AvailabilityValidator is smarter and understands pending
inventory units, this isn't necessary. Inventory won't be checked for
finalized inventory units.
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.

Looks reasonable to me. I don't imagine most stores are following these code paths at all, and if they do, I'd be concerned.

@jhawthorn jhawthorn merged commit b19ff96 into solidusio:master Jan 25, 2017
@jhawthorn jhawthorn deleted the remove_unreturned_exchange_checkout branch January 25, 2017 23:01
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.

None yet

2 participants