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 an issue with Failed IPN changing to Payment Received incorrectly #617

Open
wants to merge 1 commit into
base: 1.9.3.x
from

Conversation

Projects
None yet
2 participants
@rvelhote
Copy link

commented Mar 7, 2019

Hello everyone,

We recently had some issues with Failed IPN requests from Paypal changing the status of an order from REVIEW to PROCESSING instead of CANCELED. Some orders that were paid using eCheck didn't clear the payment and the IPN request did not cancel the order which caused us to ship an order without correct payment.

The main issue resides in Mage_Sales_Model_Order::registerCancellation which is where the change actually occurs:

if ($this->canCancel() || $this->isPaymentReview()) {
            $cancelState = self::STATE_CANCELED;
            foreach ($this->getAllItems() as $item) {
                if ($cancelState != self::STATE_PROCESSING && $item->getQtyToRefund()) {
                    if ($item->getQtyToShip() > $item->getQtyToCancel()) {
                        $cancelState = self::STATE_PROCESSING;
                    } else {
                        $cancelState = self::STATE_COMPLETE;
                    }
                }
                $item->cancel();
            }

            // (...)
}

however the root cause is that un the case of an order in the REVIEW status from Paypal there is an invoice with the PENDING status which causes $this->canCancel() to be false and $this->isPaymentReview() to be true.

Issue + Solution Found:

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.