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 obscure issue when choosing payment method in checkout #13197

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dacook
Copy link
Member

@dacook dacook commented Mar 6, 2025

What? Why?

When you perform a very particular set of actions, the checkout fails to proceed, with no feedback to the user at all (see comment on issue) I'd consider this a bug but haven't bothered to classify it.

This was caused by a clever pre-fetch optimisation of Turbo, when you hover over a link. It makes sense if the web app follows the rule that GET is a safe HTTP method. But our web app breaks that rule here 🤦

I've added a controller test to cover this, because I wasn't sure at first where to start. I now think that it would have been better to add a system test (eg checkout/payment_spec) and/or unit test (workflow_service_spec), but am not sure it's worth the effort. But I'm happy to be told otherwise by reviewers.

What should we test?

Repeat for both cases "i" and "ii":

  1. Add item to cart
  2. Proceed to choose payment method (if there's only one option, you'll need to add a second option in admin)
  3. From the summary screen, go back to the Payment method step. Repeat test for each:
    1. Hover over "1. Your details"
    2. Right-click on "1. Your details" and open in a new tab (then you can close it again)
  4. Now choose a different payment method
  5. click "Next - order summary".

For method "i", this should now work seamlessly.
For method "ii", you will have to click "next" a few times without getting feedback, but it does work eventually. We can probably improve that but I think it's pretty obscure and not worth bothering.

Release notes

It's probably worth mentioning as a user-facing change. Users may have been reporting strange issues with checkout to their instance managers, but they probably didn't figure out how to replicate it so didn't escalate further.

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

@dacook dacook self-assigned this Mar 6, 2025
@dacook

This comment was marked as outdated.

dacook added 4 commits March 11, 2025 16:08
It didn't catch the error I was looking for. I'm not sure if it is a valid use case, but it still seems helpful to add coverage for current functionality.
I tried to build it within  context "with existing invalid payments", but couldn't get it to work so created a different one.
Note that in the real world, this avoids a crash, but still requires the user to click the button two more times before it will work, with no hints as to why. So not a great help.
@dacook dacook force-pushed the reload-payments-12693 branch from 0d938b7 to 55cbe51 Compare March 11, 2025 05:19
@dacook dacook changed the title Reload payments 12693 Fix obscure issue when choosing payment method in checkout Mar 11, 2025
@dacook dacook marked this pull request as ready for review March 11, 2025 05:40
Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

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

That's a tricky one !

@rioug rioug added the user facing changes Thes pull requests affect the user experience label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user facing changes Thes pull requests affect the user experience
Projects
Status: Code review 🔎
Development

Successfully merging this pull request may close these issues.

ActiveRecord::RecordNotFound in checkout#update
2 participants