From 3a06ecb3b9a98a9c36f01dcd179dc6bbe92817de Mon Sep 17 00:00:00 2001 From: vinoth Date: Fri, 29 Nov 2024 12:01:30 +0530 Subject: [PATCH] bugfix/PP-13303: before delete gateway check transaction too --- PayrexxPaymentGatewaySW6/src/Handler/PaymentHandler.php | 1 - PayrexxPaymentGatewaySW6/src/Service/PayrexxApiService.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/PayrexxPaymentGatewaySW6/src/Handler/PaymentHandler.php b/PayrexxPaymentGatewaySW6/src/Handler/PaymentHandler.php index 19020d5..1f3b1c0 100644 --- a/PayrexxPaymentGatewaySW6/src/Handler/PaymentHandler.php +++ b/PayrexxPaymentGatewaySW6/src/Handler/PaymentHandler.php @@ -161,7 +161,6 @@ public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $ if (in_array($paymentMean, ['sofortueberweisung_de', 'postfinance_card', 'postfinance_efinance'])) { throw new Exception('Unavailable payment method error'); } - // Create Payrexx Gateway link for checkout and redirect user try { $payrexxGateway = $this->payrexxApiService->createPayrexxGateway( diff --git a/PayrexxPaymentGatewaySW6/src/Service/PayrexxApiService.php b/PayrexxPaymentGatewaySW6/src/Service/PayrexxApiService.php index 169837b..277f882 100644 --- a/PayrexxPaymentGatewaySW6/src/Service/PayrexxApiService.php +++ b/PayrexxPaymentGatewaySW6/src/Service/PayrexxApiService.php @@ -209,7 +209,7 @@ public function deletePayrexxGateway(string $salesChannelId, int $gatewayId): vo $payrexx = $this->getInterface($salesChannelId); $gateway = $this->getPayrexxGateway($gatewayId, $salesChannelId); - if ($payrexx && $gateway && !$gateway->getInvoices()) { + if ($payrexx && $gateway && !$this->getTransactionByGateway($salesChannelId, $gatewayId)) { try { $payrexx->delete($gateway); } catch (\Payrexx\PayrexxException $e) {