From 3d518141128d3cceee2fbcd12190e26db46316ae Mon Sep 17 00:00:00 2001 From: Sander van Hooft Date: Thu, 5 Dec 2019 16:50:28 +0100 Subject: [PATCH] Store the definite mollie payment id --- src/Http/Controllers/WebhookController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Http/Controllers/WebhookController.php b/src/Http/Controllers/WebhookController.php index 7a38c716..5f87f721 100644 --- a/src/Http/Controllers/WebhookController.php +++ b/src/Http/Controllers/WebhookController.php @@ -47,9 +47,12 @@ protected function getOrder(Payment $payment) { $order = Order::findByPaymentId($payment->id); - if(!$order) { - if(isset($payment->metadata, $payment->metadata->temporary_mollie_payment_id)) { - $order = Order::findByPaymentId($payment->metadata->temporary_mollie_payment_id); + if(!$order && isset($payment->metadata, $payment->metadata->temporary_mollie_payment_id)) { + $order = Order::findByPaymentId($payment->metadata->temporary_mollie_payment_id); + + if($order) { + // Store the definite payment id. + $order->update(['mollie_payment_id' => $payment->id]); } }