-
Notifications
You must be signed in to change notification settings - Fork 219
Store API: Fix payment method validation (fixes COD) #9375
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.11 MB ℹ️ View Unchanged
|
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.
Thank you for working on this @mikejolley! I'm facing difficulty to test the PR. I couldn't get the error notice to appear. I'll appreciate it if you could help me with the detailed testing steps.
Steps I have tried so far:
- Enable COD and limit it to certain shipping methods.
- Enable another payment method.
- Go to Checkout, try checking out with COD.
- I can see the COD. But when I change the address where COD is not available, it gets removed from the list.
- If I remove all payments method and keep only COD, it doesn't display the notice at Checkout.
- I'm unable to reproduce a scenario in which notice is displayed.
In the instructions I provided a screenshot of the setup you need to use. Do not use limiting. The notice is shown when you try to place the order (before patch). |
@mikejolley I'm still unable get the error notice to appear. Could you please share the screen recording of the settings and steps you're following to make the error notice appear? The code changes looks good to me and I am able to checkout using COD. |
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.
Approving the PR as we won't be able to reproduce the error notice. Thank you for the clarification. 🎉
Widens the Store API Checkout Route enum for payment methods. Returns all payment methods, not just those "available". This is because schema is retrieved before a cart is loaded into session, and this is a dependency for validation.
I've noted this inline to prevent it being reverted.
Full validation occurs later during the checkout request. I've updated the error message to make it clear:
@senadir see any issue with this?
Fixes #9074
Testing
User Facing Testing
Use the following config for cash on delivery:
To test the original issue:
To test the fix
The order will go through without an error message (the erroneous case has been fixed).
WooCommerce Visibility
Changelog