-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
Remove split checkout toggle and legacy checkout #10913
Remove split checkout toggle and legacy checkout #10913
Conversation
36e0761
to
f7fab38
Compare
f7fab38
to
f52604d
Compare
are failing because the expected order state is 'complete' and now, it's 'confimation'.
Multiple tests are failing due to this PR |
Looks good so far, I think it's going in the right direction 👍 Yeah in this case I think the specs mostly need to be changed to reflect the what the code is doing and not the other way around. For example, taxes should not be applied before the order gets towards the end of the checkout process ( So those tests need updating a bit and I'd say that test at In those tax adjustment specs around For reference, I had a little draft PR here that was aimed at some of the cleanup related to this and the question of when taxes should (or shouldn't) be applied: https://github.com/openfoodfoundation/openfoodnetwork/pull/10776/files |
2cb6d8e
to
8f6d1c3
Compare
Pending tests
Those are failing because there is a new state
I removed this because it's using the legacy checkout.
not sure if those need to be updated or removed
not sure about those update: |
7824f9d
to
4446dc9
Compare
f6bf421
to
d888809
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great ❤️
I think we should get this merged ASAP 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, this turned out to be a big task!
It's clear there were still a lot of tests based on legacy checkout, thanks for working through these.
I have a few questions, and a suggestion for tidying up state_machine_spec.rb
.
But I'm concerned about removing the concurrency spec, and disabling a number of others. Supporting the checkout process is pretty important and ideally we'd like to protect against bugs that we previous had specs for. Perhaps a practical compromise is to postpone these, but I think that needs to be agreed by product-circle or scheduled as a task.
PS I'm wondering what you think, and if we should discuss in the delivery circle meeting.
before_transition to: :confirmation, do: :validate_payment_method! | ||
|
||
after_transition to: :payment, do: :create_tax_charge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering why? Is this another bug that wasn't picked up in the test suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we keep the original code before_transition
, create_tax_charge!
will do nothing because of the guard clause.
def create_tax_charge!
return if state.in?(["cart", "address", "delivery"])
...
end
It was introduced on this PR for optimization reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taxing the items in the order needs to happen after the order's addresses have been set but should be done before the user lands on the payments step page. It wasn't quite working correctly before as the order's state hadn't been updated at the point it was being checked in the before_transition
hook. The after_transition
hook is the correct place for it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It would be cool if we could add a spec to show that, but the main thing is we're improving 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great teaming up on this massive much-needed cleanup!
Sorry for holding this up, I didn't see it clearly initially. I agree we need to move it forward.
Assuming you're happy with my little code cleanup, I'll mark ready for testing.
e68a246
to
f41560f
Compare
Rebased to resolve conflicts 👌 |
these tests are using the legacy checkout
This method is only called from tests and nowhere else in the codebase. We may as well remove it.
f41560f
to
2654d3b
Compare
Hey @abdellani @Matt-Yorkley , Ok, so I've tested checking out, as a customer and using:
As an admin:
Uff. All good. Fun fact: if a customer has a card set up (the x-3155) which has expired (visible under Without going much more into this black hole, if a new card is set up then yes, payments work, with this card type:
Ok, so - I've decided to merge despite insufficient testing on Paypal. Merging! |
@abdellani Hello :) I still see the toggle when I visit the page |
No cache issue I suppose since |
I remember that I removed it locally. Maybe I accidentally overwritten the commit that updates the list when I fetched the changes from the repo. Anyway, enabling or disabling that feature will not have any impact on the current behavior. |
What? Why?
Removes
split_checkout
feature toggle and updates various parts of the test suite that were not correctly using the new checkout and order flow logic.Useful references:
#8810
What should we test?
99% of these changes are removing old checkout code split_checkout feature toggles and updating parts of the test suite that were not using the new checkout logic. Aside from that there's a couple of small changes here to actual application code in 32b8d72 and 4a8a146 which are effectively fixing bugs that are already in production but were not being picked up in the test suite...
I've pulled one of those changes out into a separate PR here: #10933 which could be tested separately (if that's easier). It affects marking the order as
complete
after processing stripe payments that require additional authorization (3DS).The other change mostly affects Paypal redirects after a payment has failed for some reason at the checkout (like insufficient funds). It should now redirect to the checkout with the correct error message (currently I think it throws a 404/not found).
Release notes
Changelog Category: Technical changes
The title of the pull request will be included in the release notes.