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

Merge pull request #1406 from jordan-brough/add-order-payment-inverse-of #3

Merged
merged 4 commits into from
Nov 16, 2016

Conversation

bbuchalter
Copy link

@bbuchalter bbuchalter commented Nov 15, 2016

Add inverse_of to order.payments

Cherry picked from Solidus to fix https://www.pivotaltracker.com/story/show/134172587

Without this reverse association, an order object can have different payment objects in memory. When one version of the object is updated, the other is not, leading to unexpected behaviors.

In the case presented specifically in this story, the initial credit card payment is put in the invalid state by invalidate_old_payments when the new Apple Pay payment is created. However, without the reverse association, when the state machine advances the order from confirm to complete and begins process_payments!, the order.payments.map(&:state) shows ["checkout", "checkout"] showing the in-memory version of order.payments is stale.

Jordan fixed this and many other in-memory association problems in Solidus v1.4. We're back porting this one now because it's causing acute problems.

jordan-brough and others added 2 commits November 15, 2016 16:18
…t-inverse-of

Add `inverse_of` to order.payments
This prevents the change hooks from being triggered twice.
@bbuchalter
Copy link
Author

Only one failure:


  1) setting locale checkout form validation messages shows translated jquery.validate error messages
     Failure/Error: expect(find(".field#b#{attr} label.error").text).to eq(text)

     Capybara::ElementNotFound:
       Unable to find css ".field#bfirstname label.error"

This was in the front end and is likely a false positive. How do we feel about merging this anyway?

@bbuchalter
Copy link
Author

This was in the front end and is likely a false positive.

I get the error locally as well. Not a false positive.

@bbuchalter
Copy link
Author

We could skip the frontend in our CI builds? Mark this spec as skipped? Or try and understand why it's not working. I'm inclined to skip the frontend part of the build completely.

Tommy John is not using these other parts of Solidus, so there is no
need to run them in our fork.
We use MySQL instead of Postgres and Ruby 2.2.5.
@gmacdougall gmacdougall merged commit 2143ea1 into v1.2.2 Nov 16, 2016
@graygilmore graygilmore deleted the add-inverse-order-payments branch November 17, 2016 20:07
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.

3 participants