Register capture notification moves order out of Payment Review (#35382) - #41165
Open
lbajsarowicz wants to merge 4 commits into
Open
Register capture notification moves order out of Payment Review (#35382)#41165lbajsarowicz wants to merge 4 commits into
lbajsarowicz wants to merge 4 commits into
Conversation
…gento#35382) Covers the RegisterCaptureNotificationCommand fix that promotes an order stuck in Payment Review to Processing once a capture notification arrives. No such test existed; this closes that gap using the real Payment::registerCaptureNotification() entry point against a placed order.
|
Hi @lbajsarowicz. 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. |
Contributor
Author
|
@magento run all tests |
5 tasks
The upstream Static Tests build fails on PHPCS warnings in any file the PR touches, and setOrderStateAndStatus() carried a @deprecated without the required @see.
Contributor
Author
|
@magento run Static Tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
An order left in the
Payment Reviewstate never returned toProcessingwhen a capture notification arrived, so orders held for payment review stayed stuck even after the payment was captured.Magento\Sales\Model\Order\Payment\State\RegisterCaptureNotificationCommand::execute()promotes an order toSTATE_PROCESSINGonly when the current state is empty,STATE_NEWorSTATE_PENDING_PAYMENT.STATE_PAYMENT_REVIEWwas not in that list, so the capture notification updated the payment but left the order state untouched.This adds
STATE_PAYMENT_REVIEWto that condition.This does not weaken payment review. The
getIsTransactionPending()andgetIsFraudDetected()checks further down the same method run after the promotion and set the state back toSTATE_PAYMENT_REVIEW(withSTATUS_FRAUDin the fraud case). So a payment that is still pending at the gateway, or flagged as fraudulent, cannot be promoted — only a clean capture notification results inProcessing.This PR continues #35383 by @itmsenior, rebased onto current
2.4-develop, with the integration coverage that was missing. The original commits and authorship are preserved; @engcom-Charlie's static-test fix from that PR is included as well.Related Pull Requests
Continues #35383
Fixed Issues
Fixes #35382
Manual testing scenarios
Payment Review(for example PayPal with a pending/under-review result), or set an existing order's state topayment_review.Magento\Sales\Model\Order\Payment::registerCaptureNotification()with the amount due.Payment Review.After: the order moves to
Processingwith the configured default status for that state.setIsFraudDetected(true)) or still pending (setIsTransactionPending(true)) and confirm the order stays inPayment Reviewin both cases.Questions or comments
Gates run locally on
2.4-develop:Magento/Sales/shows the same 1 error and 4 failures on this branch as on a clean2.4-developcheckout (all pre-existing: three abstract-class warnings,GridTest::testRefreshByScheduletiming, and unrelated cases). The new test passes.Magento2: 0 errors. One pre-existing warning on the@deprecatedtag ofsetOrderStateAndStatus(), untouched by this change.payment_review), green with it.Contribution checklist