Webhook aftercare throws an error when there is no refund or chargeback

Created on 2 November 2023, about 1 year ago
Updated 19 December 2023, 11 months ago

We noticed serveral errors on the aftercare when there is no chargeback or refund in the callback.
It seems that the normal callback is retouted to /aftercare on succesfull payment:

// If the payment is paid we change the webhook to start "aftercare".
      if ($transaction->getStatus() === PaymentStatus::STATUS_PAID) {
        $payment = $this->mollie->getClient()->payments->get($transaction->id());

        // Set the new webhook URL.
        $payment->webhookUrl = Url::fromRoute(
          'mollie.webhook.aftercare',
          ['context' => $context, 'context_id' => $context_id]
        )->setAbsolute()->toString();

But when its just a normal payment with nothing to it, the aftercare function does not have an event on line 287
return new Response('', $event->getHttpStatusCode());
And than it gives an getHttpStatusCode on null error.

Since the code already says to return a 200 status, here is a patch to do that.
(normally I would do that with a constant because of magic numbers but the module doesn't really do that atm so following the module's style.)

๐Ÿ› Bug report
Status

RTBC

Version

2.1

Component

Code

Created by

๐Ÿ‡ณ๐Ÿ‡ฑNetherlands Roderik de Langen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024