Currently, when a Chargeback is processed, for instance because for the DirectDebit payment, the customer did not have enough funds in his / her bank account, Mollie calls a Webhook to update the WooCommerce Order. The order status is changed from Processing to On hold. This is great and how we expect this to work.
But... exactly one minute later, a second Webhook is sent to WooCommerce. I suppose this 2nd Webhook is also coming from Mollie, but have not verified this 100% yet.
I did track how this 2nd Webhook moves through the code though by checking the logs and the source code.
These are the important parts of the log files of the second webhook:
onWebhookPaid called for payment 123
onWebhookPaid WooCommerce payment_complete() processed and returned to Mollie\WooCommerce\Payment\MolliePayment::onWebhookPaid for payment 123
onWebhookPaid processing paid payment via Mollie plugin fully completed for order 123
This leads to the Order satus to be changed from On Hold back to Processing, even though one minute ago we got a Webhook call telling us about a Chargeback.
Also an Order Note is being added to the WooCommerce order (translated from Dutch): Order status changed from On hold to Processing
As mentioned, i tracked the Webhook in the code as well. In mollie-payments-for-woocommerce\src\Payment\MollieOrderService.php in the public function onWebhookAction(), the Payment object is loaded from Mollie and should bypass the cache, see line 97:
// Load the payment from Mollie, do not use cache
try {
$payment_object = $this->paymentFactory->getPaymentObject($payment_object_id);
}
But the $payment->status is 'paid', this is wrong since the order was just Charged back one minute ago.
My guess is $this->paymentFactory->getPaymentObject($payment_object_id) returns old information from Mollie where the data of the Chargeback is not stored yet or the answer still returns cached data on Mollie's side.