Changeset View
Changeset View
Standalone View
Standalone View
src/app/Providers/Payment/Mollie.php
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | public function webhook(): int | ||||
// Mollie recommends to return "200 OK" even if the payment does not exist | // Mollie recommends to return "200 OK" even if the payment does not exist | ||||
return 200; | return 200; | ||||
} | } | ||||
// Get the payment details from Mollie | // Get the payment details from Mollie | ||||
// TODO: Consider https://github.com/mollie/mollie-api-php/issues/502 when it's fixed | // TODO: Consider https://github.com/mollie/mollie-api-php/issues/502 when it's fixed | ||||
$mollie_payment = mollie()->payments()->get($payment_id); | $mollie_payment = mollie()->payments()->get($payment_id); | ||||
if (empty($mollie_payment)) { | |||||
machniak: In fact we should probably try/catch instead to do what Mollie recommends and return 200. | |||||
Done Inline ActionsI created a diff for it. mollekopf: I created a diff for it. | |||||
// Mollie recommends to return "200 OK" even if the payment does not exist | |||||
return 200; | |||||
} | |||||
$refunds = []; | $refunds = []; | ||||
if ($mollie_payment->isPaid()) { | if ($mollie_payment->isPaid()) { | ||||
// The payment is paid. Update the balance, and notify the user | // The payment is paid. Update the balance, and notify the user | ||||
if ($payment->status != self::STATUS_PAID && $payment->amount > 0) { | if ($payment->status != self::STATUS_PAID && $payment->amount > 0) { | ||||
$credit = true; | $credit = true; | ||||
$notify = $payment->type == self::TYPE_RECURRING; | $notify = $payment->type == self::TYPE_RECURRING; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 269 Lines • Show Last 20 Lines |
In fact we should probably try/catch instead to do what Mollie recommends and return 200.