ZES-88. Cancel order when Zip charge fails; bump version to 1.2.12 - #112
Merged
Merged
Conversation
alphadp
force-pushed
the
fix/ZES-88/cancel-order-on-charge-failure
branch
from
July 8, 2026 15:00
c549cd5 to
c92a16b
Compare
Do not leave a pending order in Magento when the charge cannot be completed. - Model/Charge::charge(): fix the always-true catch guard (|| -> &&) so that a failed charge (e.g. HTTP 402 "account is locked") reaches cancelOrder() instead of rethrowing early and leaving the order as 'pending'. - Helper/Data::handleException(): return the [apiError, message, logMessage] array again (it had been imploded into a string), so the list() destructuring in all five call sites works and the decline message reaches the customer and logs. - Bump version to 1.2.12 (composer.json, etc/module.xml) and add CHANGELOG.md.
alphadp
force-pushed
the
fix/ZES-88/cancel-order-on-charge-failure
branch
from
July 8, 2026 15:18
c92a16b to
eefe0e8
Compare
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.
Problem
A client reported an order created in Magento as
pendingwith no matching successful charge. Zip loggedAccountAdapterException: This account is locked ... cannot be charged(HTTP 402). The order (YW121519810) was placed, the charge failed, but the order stayedpending.Root cause
In
Model/Charge::charge()thecatchguard was:An exception can never be both types, so at least one
!instanceofis always true - the guard is always true - the method loggedALERT: Unexpected behavior .[402] ...and rethrew before reachingcancelOrder(). The order was never cancelled.Fix
Model/Charge.php:||->&&. Genuinely-unexpected exceptions are rethrown as-is, whileApiException/LocalizedExceptionfall through to charge cancellation + order cancellation. This resolves the incident.Helper/Data::handleException(): returned an imploded string while all five callers (Charge,Token,TransactionCancel/Capture/Refund) destructure it vialist($apiError, $message, $logMessage)- they were all silently gettingnull. Restored the array return so the correct decline message reaches the customer and logs.composer.json,etc/module.xml) and addedCHANGELOG.md.