From 0205dc25b053836e327f015c04a97d932b5d3800 Mon Sep 17 00:00:00 2001 From: Goran Stamenkovski Date: Tue, 24 Sep 2024 13:04:00 +0200 Subject: [PATCH 1/9] Add explicit association for deliveries.stateMachineState in webhooks processor ISSUE: CS-5938 --- src/Service/CaptureService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Service/CaptureService.php b/src/Service/CaptureService.php index 91b979e0..1b704d5d 100644 --- a/src/Service/CaptureService.php +++ b/src/Service/CaptureService.php @@ -88,7 +88,10 @@ public function doOpenInvoiceCapture(string $orderNumber, $captureAmount, Contex $order = $this->orderRepository->getOrderByOrderNumber( $orderNumber, $context, - ['transactions', 'currency', 'lineItems', 'deliveries', 'deliveries.shippingMethod'] + [ + 'transactions', 'currency', 'lineItems', 'deliveries', + 'deliveries.shippingMethod', 'deliveries.stateMachineState' + ] ); if (is_null($order)) { From c558c5e501934a06ee071c7d02536e0707304b40 Mon Sep 17 00:00:00 2001 From: Tamara Date: Wed, 25 Sep 2024 18:25:11 +0200 Subject: [PATCH 2/9] Remove unnecessary foreign key CS-5927 --- .../Migration1626331358AdyenRefund.php | 4 +-- ...Migration1646742586AdyenPaymentCapture.php | 4 +-- .../Migration1669129247AdyenPayment.php | 4 +-- .../Migration1727273181AlterAdyenRefund.php | 26 +++++++++++++++++++ ...tion1727273183AlterAdyenPaymentCapture.php | 26 +++++++++++++++++++ .../Migration1727273187AlterAdyenPayment.php | 26 +++++++++++++++++++ 6 files changed, 81 insertions(+), 9 deletions(-) create mode 100755 src/Migration/Migration1727273181AlterAdyenRefund.php create mode 100755 src/Migration/Migration1727273183AlterAdyenPaymentCapture.php create mode 100755 src/Migration/Migration1727273187AlterAdyenPayment.php diff --git a/src/Migration/Migration1626331358AdyenRefund.php b/src/Migration/Migration1626331358AdyenRefund.php index df7337bc..211a6954 100644 --- a/src/Migration/Migration1626331358AdyenRefund.php +++ b/src/Migration/Migration1626331358AdyenRefund.php @@ -24,9 +24,7 @@ public function update(Connection $connection): void `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, `amount` INT(11) NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk.adyen_refund.order_transaction_id` - FOREIGN KEY (order_transaction_id) references `order_transaction` (id) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL ); diff --git a/src/Migration/Migration1646742586AdyenPaymentCapture.php b/src/Migration/Migration1646742586AdyenPaymentCapture.php index 89a1cf0a..4e90bf0a 100644 --- a/src/Migration/Migration1646742586AdyenPaymentCapture.php +++ b/src/Migration/Migration1646742586AdyenPaymentCapture.php @@ -24,9 +24,7 @@ public function update(Connection $connection): void `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, `amount` INT(11) NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk.adyen_payment_capture.order_transaction_id` - FOREIGN KEY (order_transaction_id) references `order_transaction` (id) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL ); diff --git a/src/Migration/Migration1669129247AdyenPayment.php b/src/Migration/Migration1669129247AdyenPayment.php index 785d48f3..0bf026d5 100644 --- a/src/Migration/Migration1669129247AdyenPayment.php +++ b/src/Migration/Migration1669129247AdyenPayment.php @@ -31,9 +31,7 @@ public function update(Connection $connection): void `updated_at` DATETIME(3) DEFAULT NULL COMMENT 'Updated at', PRIMARY KEY (`id`), KEY `ADYEN_PAYMENT_MERCHANT_REFERENCE` (`merchant_reference`), - KEY `ADYEN_PAYMENT_MERCHANT_ORDER_REFERENCE` (`merchant_order_reference`), - CONSTRAINT `fk.adyen_payment.order_transaction_id` - FOREIGN KEY (order_transaction_id) references `order_transaction` (id) + KEY `ADYEN_PAYMENT_MERCHANT_ORDER_REFERENCE` (`merchant_order_reference`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL; diff --git a/src/Migration/Migration1727273181AlterAdyenRefund.php b/src/Migration/Migration1727273181AlterAdyenRefund.php new file mode 100755 index 00000000..1c55593f --- /dev/null +++ b/src/Migration/Migration1727273181AlterAdyenRefund.php @@ -0,0 +1,26 @@ +executeStatement(<<executeStatement(<<executeStatement(<< Date: Thu, 26 Sep 2024 12:28:00 +0200 Subject: [PATCH 3/9] Add check if domain url exists CS-5931 --- src/Handlers/AbstractPaymentMethodHandler.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Handlers/AbstractPaymentMethodHandler.php b/src/Handlers/AbstractPaymentMethodHandler.php index d5f78b5c..316047de 100644 --- a/src/Handlers/AbstractPaymentMethodHandler.php +++ b/src/Handlers/AbstractPaymentMethodHandler.php @@ -613,12 +613,13 @@ protected function preparePaymentsRequest( !is_null($orderLine->getProductId()) ? $this->getProduct($orderLine->getProductId(), $salesChannelContext->getContext()) : null; + $domainUrl = $salesChannelContext->getSalesChannel()->getDomains()->first()->getUrl(); // Add url for only real product and not for the custom cart items. - if (!is_null($product->getId())) { + if (!is_null($product->getId()) && !is_null($domainUrl)) { $productUrl = sprintf( "%s/detail/%s", - $salesChannelContext->getSalesChannel()->getDomains()->first()->getUrl(), + $domainUrl, $product->getId() ); } else { @@ -640,7 +641,7 @@ protected function preparePaymentsRequest( $currency = $salesChannelContext->getCurrency(); //Building open invoice line - + $lineItem = new LineItem(); $lineItem->setDescription($productName); @@ -836,7 +837,7 @@ private function getSplitStreetAddressHouseNumber(string $address): array */ public function handleAdyenOrderPayment( AsyncPaymentTransactionStruct $transaction, - $adyenOrderResponse, + $adyenOrderResponse, SalesChannelContext $salesChannelContext ): void { if (empty($adyenOrderResponse)) { From 3c0d44fbc93515a5b7478d0d1e252f5c2db0c0f1 Mon Sep 17 00:00:00 2001 From: Marija Date: Fri, 27 Sep 2024 16:02:46 +0200 Subject: [PATCH 4/9] Add check if domain url exists CS-5931 --- src/Handlers/AbstractPaymentMethodHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handlers/AbstractPaymentMethodHandler.php b/src/Handlers/AbstractPaymentMethodHandler.php index 316047de..1d3d5f8d 100644 --- a/src/Handlers/AbstractPaymentMethodHandler.php +++ b/src/Handlers/AbstractPaymentMethodHandler.php @@ -613,7 +613,7 @@ protected function preparePaymentsRequest( !is_null($orderLine->getProductId()) ? $this->getProduct($orderLine->getProductId(), $salesChannelContext->getContext()) : null; - $domainUrl = $salesChannelContext->getSalesChannel()->getDomains()->first()->getUrl(); + $domainUrl = $salesChannelContext->getSalesChannel()->getDomains()?->first()?->getUrl(); // Add url for only real product and not for the custom cart items. if (!is_null($product->getId()) && !is_null($domainUrl)) { From 97ab214a22233b30d51f7399a1b9955568a417dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Campos?= Date: Mon, 30 Sep 2024 09:04:06 +0200 Subject: [PATCH 5/9] Update CODEOWNERS (#554) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4d4d1c6d..33a67474 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @Adyen/plugin-developers +* @brankologeecom @MarijaIv @tamaralogeecom @AleksandarBoljanovic @goran-stamenkovski-logeecom @teodoratimoti @DamjanLogeecom From 78998c94f827dcbd08cff459c81063a1deed1ced Mon Sep 17 00:00:00 2001 From: Marija Date: Mon, 30 Sep 2024 10:54:19 +0200 Subject: [PATCH 6/9] Fix PHP code sniffer issue --- src/Handlers/AbstractPaymentMethodHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handlers/AbstractPaymentMethodHandler.php b/src/Handlers/AbstractPaymentMethodHandler.php index 1d3d5f8d..ce295919 100644 --- a/src/Handlers/AbstractPaymentMethodHandler.php +++ b/src/Handlers/AbstractPaymentMethodHandler.php @@ -837,7 +837,7 @@ private function getSplitStreetAddressHouseNumber(string $address): array */ public function handleAdyenOrderPayment( AsyncPaymentTransactionStruct $transaction, - $adyenOrderResponse, + $adyenOrderResponse, SalesChannelContext $salesChannelContext ): void { if (empty($adyenOrderResponse)) { From 2e50b64c287e06d021fe9684d90c95920fe75068 Mon Sep 17 00:00:00 2001 From: Marija Date: Mon, 30 Sep 2024 11:23:02 +0200 Subject: [PATCH 7/9] Fix SonarCloud issue --- src/Migration/Migration1727273181AlterAdyenRefund.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Migration/Migration1727273181AlterAdyenRefund.php b/src/Migration/Migration1727273181AlterAdyenRefund.php index 1c55593f..c7a4d6c2 100755 --- a/src/Migration/Migration1727273181AlterAdyenRefund.php +++ b/src/Migration/Migration1727273181AlterAdyenRefund.php @@ -21,6 +21,7 @@ public function update(Connection $connection): void SQL ); } catch (Exception) { + // Intentionally left empty, if foreign key is missing, the migration should be skipped. } } } From 2e28e75be78349930177eeb455852e821123dbe1 Mon Sep 17 00:00:00 2001 From: Marija Date: Mon, 30 Sep 2024 11:24:19 +0200 Subject: [PATCH 8/9] Fix SonarCloud issues --- src/Migration/Migration1727273183AlterAdyenPaymentCapture.php | 1 + src/Migration/Migration1727273187AlterAdyenPayment.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Migration/Migration1727273183AlterAdyenPaymentCapture.php b/src/Migration/Migration1727273183AlterAdyenPaymentCapture.php index 730c7e5d..ecbe5033 100755 --- a/src/Migration/Migration1727273183AlterAdyenPaymentCapture.php +++ b/src/Migration/Migration1727273183AlterAdyenPaymentCapture.php @@ -21,6 +21,7 @@ public function update(Connection $connection): void SQL ); } catch (Exception) { + // Intentionally left empty, if foreign key is missing, the migration should be skipped. } } } diff --git a/src/Migration/Migration1727273187AlterAdyenPayment.php b/src/Migration/Migration1727273187AlterAdyenPayment.php index 6cfce34c..59a4bd41 100755 --- a/src/Migration/Migration1727273187AlterAdyenPayment.php +++ b/src/Migration/Migration1727273187AlterAdyenPayment.php @@ -21,6 +21,7 @@ public function update(Connection $connection): void SQL ); } catch (Exception) { + // Intentionally left empty, if foreign key is missing, the migration should be skipped. } } } From 7ae47328142112a4d8ca9649d6ecd4e80e0dcc11 Mon Sep 17 00:00:00 2001 From: Goran Stamenkovski Date: Mon, 30 Sep 2024 13:23:47 +0200 Subject: [PATCH 9/9] Version bump ISSUE: CS-5938 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b0a45663..64df2db8 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ } ], "description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen", - "version": "4.1.1", + "version": "4.1.2", "type": "shopware-platform-plugin", "license": "MIT", "require": {