From 789ed533c0851c539f324efb571a5b6a89e69623 Mon Sep 17 00:00:00 2001 From: margud Date: Thu, 1 Sep 2022 16:56:23 +0300 Subject: [PATCH 1/2] MOLIM-374: credit card component fix --- changelog.md | 1 + controllers/front/payment.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index e99b83fc5..f8ff8553d 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ # Changelog # ## Changes in release 5.4.0 ## + Removed reference variables from translations. ++ Fixed issue where credit card components would throw error even taught order was created. ## Changes in release 5.3.0 ## + Added PS8.0.0+ compatibility diff --git a/controllers/front/payment.php b/controllers/front/payment.php index cde709249..1bf935960 100644 --- a/controllers/front/payment.php +++ b/controllers/front/payment.php @@ -86,6 +86,8 @@ public function initContent() $transactionService = $this->module->getMollieContainer(PaymentMethodService::class); /** @var MollieOrderCreationService $mollieOrderCreationService */ $mollieOrderCreationService = $this->module->getMollieContainer(MollieOrderCreationService::class); + /** @var PaymentMethodRepositoryInterface $paymentMethodRepository */ + $paymentMethodRepository = $this->module->getMollieContainer(PaymentMethodRepositoryInterface::class); $environment = (int) Configuration::get(Mollie\Config\Config::MOLLIE_ENVIRONMENT); $paymentMethodId = $paymentMethodRepo->getPaymentMethodIdByMethodId($method, $environment); @@ -153,7 +155,10 @@ public function initContent() $order->reference ); } else { - $mollieOrderCreationService->createMolliePayment($apiPayment, $cart->id, $orderNumber); + $paymentMethod = $paymentMethodRepository->getPaymentBy('transaction_id', $apiPayment->id); + if (!$paymentMethod) { + $mollieOrderCreationService->createMolliePayment($apiPayment, $cart->id, $orderNumber); + } } } catch (Exception $e) { $this->setTemplate('error.tpl'); From a07d5f8814071851735a0fb8c4c66c4c5328fd54 Mon Sep 17 00:00:00 2001 From: margud Date: Thu, 1 Sep 2022 16:57:10 +0300 Subject: [PATCH 2/2] cs fixer --- controllers/front/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/front/payment.php b/controllers/front/payment.php index 1bf935960..604230ad0 100644 --- a/controllers/front/payment.php +++ b/controllers/front/payment.php @@ -86,7 +86,7 @@ public function initContent() $transactionService = $this->module->getMollieContainer(PaymentMethodService::class); /** @var MollieOrderCreationService $mollieOrderCreationService */ $mollieOrderCreationService = $this->module->getMollieContainer(MollieOrderCreationService::class); - /** @var PaymentMethodRepositoryInterface $paymentMethodRepository */ + /** @var PaymentMethodRepositoryInterface $paymentMethodRepository */ $paymentMethodRepository = $this->module->getMollieContainer(PaymentMethodRepositoryInterface::class); $environment = (int) Configuration::get(Mollie\Config\Config::MOLLIE_ENVIRONMENT);