-
Notifications
You must be signed in to change notification settings - Fork 9.4k
magento/magento2#37983: Place order with disabled Payment method working #39937
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
base: 2.4-develop
Are you sure you want to change the base?
magento/magento2#37983: Place order with disabled Payment method working #39937
Conversation
- prevent order placement with unavailable payment method
Hi @KrasnoshchokBohdan. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
- copyright and static test errors fix
@magento run all tests |
Updated the code to safely handle cases where the cart's payment object might be null. This prevents potential errors when accessing the payment method code for carts without a valid payment set.
@magento run all tests |
@magento run all tests |
@magento run all tests |
@magento run all tests |
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.
Hello @KrasnoshchokBohdan,
Thanks for the contribution!
Please refer to the below review comment and also please add some automated test in accordance to the DOD.
Thanks
Co-authored-by: Abhinav Pathak <51681618+engcom-Hotel@users.noreply.github.com>
- Add unit tests for PlaceOrder functionality in QuoteGraphQl.
@magento run all tests |
Hello @KrasnoshchokBohdan, It seems that you have made the changes according to the review comments, we are picking this PR for the review. Thanks |
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.
Hello @KrasnoshchokBohdan,
Thanks for making the changes. Just a minor changes requested below. Please do the needful.
Thanks
} | ||
|
||
if (!$isPaymentMethodAvailable) { | ||
throw new LocalizedException(__('The requested Payment Method is not available.')); |
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.
The error message could be more specific by including the requested payment method code: "The requested Payment Method '{code}' is not available."
And also consider adding a debug log when a disabled payment method is detected to help track these attempts.
Add logging for disabled payment method attempts in PlaceOrder Extended `PlaceOrder` to log debug information when an unavailable payment method is used. This includes details like the cart ID, user ID, attempted payment method, and available methods, facilitating easier troubleshooting of order placement issues. Updated unit tests to validate the new logging behavior.
@magento run all tests |
Description (*)
I will leave here examples of mutations that I used.
createCustomer
generateCustomerToken
createEmptyCart (don't forget about Authentification)
addSimpleProductsToCart
setShippingAddressesOnCart
setBillingAddressOnCart
setShippingMethodsOnCart
setPaymentMethodOnCart + placeOrder
VARIABLES
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)