Skip to content

Fix order status changes not being applied (#15) - #16

Merged
fballiano merged 2 commits into
mainfrom
fix/order-status-changes
Jun 23, 2026
Merged

Fix order status changes not being applied (#15)#16
fballiano merged 2 commits into
mainfrom
fix/order-status-changes

Conversation

@fballiano

Copy link
Copy Markdown
Contributor

Fixes #15.

Root cause

Both symptoms reported in #15 — new orders stuck at Pending instead of Pending Payment, and paid orders never moving to Processing — trace back to a single missing config value, the same bug previously fixed in the Przelewy24 module (MahoCommerce/module-przelewy24#11).

In Maho core (Mage_Sales_Model_Order_Payment::place()):

$action = $methodInstance->getConfigPaymentAction();   // reads payment_action
if ($action) {
    if ($methodInstance->isInitializeNeeded()) {
        $methodInstance->initialize(...);   // applies order_status_pending
    }
    ...
}

None of the Mollie methods declared a <payment_action>, so $action was empty and the whole block — including the initialize() that applies the configured pending status — was skipped. The order fell back to the default status for STATE_NEW (pending).

That also broke recovery: the cron filters orders by state = pending_payment, so orders sitting in the wrong new/pending state were never reconciled to processing either.

Changes

  • etc/config.xml — added <payment_action>order</payment_action> to all 28 Mollie method blocks. With _isInitializeNeeded = true this only causes initialize() to fire (no capture logic is triggered); the existing initialize() already resolves and applies the configured pending status.
  • controllers/PaymentController.phpreturnAction now calls the idempotent reconcile() synchronously when Mollie reports paid/authorized on customer return, instead of relying solely on the webhook. Mollie's webhook is frequently unreachable in sandbox/local-dev (the reporter's setup), which is why the Processing transition wasn't happening. Mirrors the P24 robustness fix (Finalize order on return from Przelewy24 (#12) module-przelewy24#13). A later webhook/cron pass is a safe no-op.

Verification

  • php -l clean; xmllint validates the XML
  • php-cs-fixer: no changes needed
  • PHPStan: the only delta vs. the clean baseline (57 → 59) is the identical Mage::getModel('maho_mollie/cron') + @var pattern already used and passing in CI in WebhookController.php — a local plugin-cache false positive, not a real error.

None of the Mollie methods declared a payment_action, so
Mage_Sales_Model_Order_Payment::place() skipped the initialize() call
that applies the configured pending status. New orders fell back to the
default status for STATE_NEW (pending) instead of pending_payment, and
because they were stuck in the wrong state the cron (which filters by
state=pending_payment) never reconciled them to processing either.

Add <payment_action>order</payment_action> to every Mollie method so
initialize() runs and the merchant-configured statuses are honoured.

Also finalize paid/authorized payments synchronously on customer return
instead of relying solely on the webhook, which is frequently unreachable
in sandbox/local-dev setups. reconcile() is idempotent, so a later
webhook/cron pass is a no-op.
@fballiano
fballiano force-pushed the fix/order-status-changes branch from e7ddfd1 to b048bcb Compare June 23, 2026 15:49
@fballiano
fballiano merged commit 0301ee3 into main Jun 23, 2026
10 checks passed
@fballiano
fballiano deleted the fix/order-status-changes branch June 23, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order status changes do not work

1 participant