From de9c551d98b64996026ac7c06eed30b2802cdb06 Mon Sep 17 00:00:00 2001 From: Aziya <89023248+aziya-im@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:29:03 +0200 Subject: [PATCH 1/6] Update README.md (#2751) I have update the support dates for version 9 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a13985118..0c64e125b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The schedule for the current maintained branches is: | Plugin Major Version | Release Date | Level 1 Support ends | Level 2 Support ends | Level 3 Support ends | | :----- |:--------------|:---------------------|:---------------------|:---------------------| | Version 8 | November 2021 | January 2024 | May 2024 | January 2025 | -| Version 9 | October 2023 | -- | -- | -- | +| Version 9 | October 2023 | December 2025 | May 2026 | December 2026 | Or, visualised as a calendar: From d42bf5325036d7237612e48fecf6160aa5cec538 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:16:07 +0200 Subject: [PATCH 2/6] chore(deps): update elasticsearch docker tag to v7.17.23 (#2747) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Can Demiralp --- .github/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml index 2b99bcfb0..21c4b69c9 100644 --- a/.github/docker-compose.yml +++ b/.github/docker-compose.yml @@ -12,7 +12,7 @@ services: MARIADB_USER: magento MARIADB_PASSWORD: magento elastic: - image: elasticsearch:7.17.22 + image: elasticsearch:7.17.23 container_name: elasticsearch networks: - backend From 9991d27f0598082d47ba3e3308d0ac4619cbb110 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:36:14 +0200 Subject: [PATCH 3/6] chore(deps): update mcr.microsoft.com/playwright docker tag to v1.47.2 (#2746) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/docker-compose.e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/docker-compose.e2e.yml b/.github/docker-compose.e2e.yml index 7a4b18fee..f5f51a866 100644 --- a/.github/docker-compose.e2e.yml +++ b/.github/docker-compose.e2e.yml @@ -1,7 +1,7 @@ version: '3' services: playwright: - image: mcr.microsoft.com/playwright:v1.47.0 + image: mcr.microsoft.com/playwright:v1.47.2 shm_size: 1gb ipc: host cap_add: From 4d2c0994ff101d88b50696b33f720a39ca26f954 Mon Sep 17 00:00:00 2001 From: Dimitri BOUTEILLE <34821762+dimitriBouteille@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:47:40 +0200 Subject: [PATCH 4/6] Fix bad StoreLocale resolver (#2743) * Fix errors in StoreLocale.php * Rename property --------- Co-authored-by: Dimitri BOUTEILLE Co-authored-by: Peter Ojo Co-authored-by: Can Demiralp --- Model/Resolver/StoreConfig/StoreLocale.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Model/Resolver/StoreConfig/StoreLocale.php b/Model/Resolver/StoreConfig/StoreLocale.php index 0babfee08..f7e0ecf9f 100644 --- a/Model/Resolver/StoreConfig/StoreLocale.php +++ b/Model/Resolver/StoreConfig/StoreLocale.php @@ -19,15 +19,13 @@ use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\GraphQl\Model\Query\Context; use Magento\Store\Api\Data\StoreInterface; -use Reflet\GraphQlFaker\Attribute\FakeResolver; -use Reflet\GraphQlFaker\Model\Resolver\NullResolver; class StoreLocale implements ResolverInterface { - protected Data $dataHelper; + protected Data $adyenHelper; /** - * @param Data $adyenHelper + * @param \Adyen\Payment\Helper\Data $adyenHelper */ public function __construct( Data $adyenHelper From 4c4378cff91ed67dd74d05b990323786ca4c7757 Mon Sep 17 00:00:00 2001 From: John Marlo Factorin <2919310+factorin-j@users.noreply.github.com> Date: Fri, 27 Sep 2024 19:04:53 +0800 Subject: [PATCH 5/6] [ECP-8518] Unset amqp in config to use default queue connection (#2654) * Abstracting the code, removing the console.logs * Fixes ECP-8518 - remove amqp in queue xml config to use default (db) if amqp service is not installed. - include additional admin message when using 'queue' notification processing - add unit tests * Revert "Abstracting the code, removing the console.logs" This reverts commit 495ec493dbc4c707c444f635666407f355e24374. * Remove changes from irrelevant file --------- Co-authored-by: khushboos Co-authored-by: Can Demiralp Co-authored-by: Can Demiralp --- Cron/WebhookProcessor.php | 6 +- Model/Queue/Notification/Publisher.php | 20 +++++- .../Model/Queue/Notification/ConsumerTest.php | 67 +++++++++++++++++++ .../Queue/Notification/PublisherTest.php | 31 +++++++++ .../system/adyen_testing_performance.xml | 2 +- etc/queue_consumer.xml | 1 - etc/queue_publisher.xml | 4 +- etc/queue_topology.xml | 2 +- 8 files changed, 123 insertions(+), 10 deletions(-) create mode 100644 Test/Unit/Model/Queue/Notification/ConsumerTest.php create mode 100644 Test/Unit/Model/Queue/Notification/PublisherTest.php diff --git a/Cron/WebhookProcessor.php b/Cron/WebhookProcessor.php index f8353a3fd..6ac491c10 100755 --- a/Cron/WebhookProcessor.php +++ b/Cron/WebhookProcessor.php @@ -99,6 +99,8 @@ public function doProcessWebhook() // Loop through and process notifications. $count = 0; + $queued = 0; + /** @var Notification[] $notifications */ foreach ($notifications as $notification) { // ignore duplicate notification @@ -128,6 +130,7 @@ public function doProcessWebhook() if ($this->configHelper->useQueueProcessor()) { $this->notificationPublisher->execute($notification); + $queued++; $count++; } elseif ($this->webhookHelper->processNotification($notification)) { $count++; @@ -139,7 +142,8 @@ public function doProcessWebhook() "Cronjob updated %s notification(s)", $count ), [ 'pspReference' => $notification->getPspreference(), - 'merchantReference' => $notification->getMerchantReference() + 'merchantReference' => $notification->getMerchantReference(), + 'queued' => $queued ]); } } diff --git a/Model/Queue/Notification/Publisher.php b/Model/Queue/Notification/Publisher.php index b8eef3588..263b72f93 100644 --- a/Model/Queue/Notification/Publisher.php +++ b/Model/Queue/Notification/Publisher.php @@ -3,29 +3,43 @@ namespace Adyen\Payment\Model\Queue\Notification; use Adyen\Payment\Api\Data\NotificationInterface; +use Adyen\Payment\Model\ResourceModel\Notification; +use Exception; use Magento\Framework\MessageQueue\PublisherInterface; class Publisher { - private const TOPIC_NAME = "adyen.notification"; + public const TOPIC_NAME = "adyen.notification"; /** @var PublisherInterface $publisher */ private $publisher; + /** @var Notification $notificationResource */ + private $notificationResource; + /** * @param PublisherInterface $publisher + * @param Notification $notificationResource */ - public function __construct(PublisherInterface $publisher) - { + public function __construct( + PublisherInterface $publisher, + Notification $notificationResource + ) { $this->publisher = $publisher; + $this->notificationResource = $notificationResource; } /** * @param NotificationInterface $notification * @return void + * @throws Exception */ public function execute(NotificationInterface $notification): void { + // Set processing=true to skip adding duplicate queue entries + $notification->setProcessing(true); + $this->notificationResource->save($notification); + $this->publisher->publish(self::TOPIC_NAME, $notification); } } diff --git a/Test/Unit/Model/Queue/Notification/ConsumerTest.php b/Test/Unit/Model/Queue/Notification/ConsumerTest.php new file mode 100644 index 000000000..de0995beb --- /dev/null +++ b/Test/Unit/Model/Queue/Notification/ConsumerTest.php @@ -0,0 +1,67 @@ +webhookMock = $this->createMock(Webhook::class); + $this->adyenLoggerMock = $this->createMock(AdyenLogger::class); + $this->notificationMock = $this->createMock(Notification::class); + $this->consumer = new Consumer($this->webhookMock, $this->adyenLoggerMock); + } + + /** + * @return void + * @throws Exception + */ + public function testExecute(): void + { + $this->webhookMock->expects($this->once()) + ->method('processNotification') + ->with($this->notificationMock) + ->willReturn(true); + + $this->assertTrue($this->consumer->execute($this->notificationMock)); + } + + /** + * @return void + * @throws Exception + */ + public function testExecuteThrowsException(): void + { + $this->webhookMock->expects($this->once()) + ->method('processNotification') + ->with($this->notificationMock) + ->willThrowException(new Exception()); + $this->adyenLoggerMock->expects($this->once())->method('addAdyenWarning'); + + $this->expectException(Exception::class); + $this->consumer->execute($this->notificationMock); + } +} diff --git a/Test/Unit/Model/Queue/Notification/PublisherTest.php b/Test/Unit/Model/Queue/Notification/PublisherTest.php new file mode 100644 index 000000000..974367eed --- /dev/null +++ b/Test/Unit/Model/Queue/Notification/PublisherTest.php @@ -0,0 +1,31 @@ +createMock(PublisherInterface::class); + $notificationResourceMock = $this->createMock(NotificationResourceModel::class); + $notificationMock = $this->createMock(Notification::class); + + $notificationMock->expects($this->once())->method('setProcessing')->with(true); + $notificationResourceMock->expects($this->once())->method('save')->with($notificationMock); + $publisherMock->expects($this->once())->method('publish')->with(Publisher::TOPIC_NAME, $notificationMock); + + $publisher = new Publisher($publisherMock, $notificationResourceMock); + $publisher->execute($notificationMock); + } +} diff --git a/etc/adminhtml/system/adyen_testing_performance.xml b/etc/adminhtml/system/adyen_testing_performance.xml index dba8e4646..c38442884 100644 --- a/etc/adminhtml/system/adyen_testing_performance.xml +++ b/etc/adminhtml/system/adyen_testing_performance.xml @@ -42,7 +42,7 @@ Adyen\Payment\Model\Config\Source\NotificationProcessor payment/adyen_abstract/webhook_notification_processor - Use cron or queue (async) to process webhook notifications + Use cron or queue (async) to process webhook notifications. Queue performs better if you have AMQP service installed, like RabbitMQ. diff --git a/etc/queue_consumer.xml b/etc/queue_consumer.xml index cc75a4705..3fc53aa23 100644 --- a/etc/queue_consumer.xml +++ b/etc/queue_consumer.xml @@ -3,6 +3,5 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd"> diff --git a/etc/queue_publisher.xml b/etc/queue_publisher.xml index 7fc9f88c8..485ed39bf 100644 --- a/etc/queue_publisher.xml +++ b/etc/queue_publisher.xml @@ -1,7 +1,5 @@ - - - + diff --git a/etc/queue_topology.xml b/etc/queue_topology.xml index c34b01f70..f12c9de92 100644 --- a/etc/queue_topology.xml +++ b/etc/queue_topology.xml @@ -1,7 +1,7 @@ - + Date: Mon, 30 Sep 2024 09:56:33 +0200 Subject: [PATCH 6/6] [ECP-9152] Update Magento versions on the workflows (#2623) * [ECP-9152] Use OpenSearch and PHP 8.3 * [ECP-9152] Define OpenSearch environment variables * [ECP-9152] Update container name * [ECP-9152] Use Bitnami image of OpenSearch * [ECP-9152] Remove redundant variable * [ECP-9152] Implement matrix for test workflows * [ECP-9152] Bump Magento 2 version * [ECP-9152] Update test init command * [ECP-9152] Fix MFTF tests * [ECP-9152] Downgrade Magento 2 version * Revert "[ECP-9152] Update test init command" This reverts commit b91b0354cac4f73165d6b97dbd215c6d2956cc32. * [ECP-9152] Update test matrix for workflows * [ECP-9152] Downgrade PHP version * Bump Magento version in REST functional tests --------- Co-authored-by: Can Demiralp Co-authored-by: Peter Ojo --- .github/Dockerfile | 8 +++---- .github/Makefile | 1 - .github/docker-compose.yml | 10 ++++---- .github/scripts/install_magento.sh | 24 ++++++++----------- .github/workflows/e2e-test-dispatch.yml | 4 ++-- .../workflows/e2e-test-express-checkout.yml | 4 ++-- .github/workflows/e2e-test.yml | 8 +++++-- .github/workflows/graphql-test.yml | 4 ++-- .github/workflows/mftf-test.yml | 4 ++-- .github/workflows/restapi-test.yml | 4 ++-- 10 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.github/Dockerfile b/.github/Dockerfile index 8170eec15..4b181e872 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -9,10 +9,10 @@ DB_NAME=magento \ DB_USER=magento \ DB_PASSWORD=magento \ DB_PREFIX=m2_ \ -ELASTICSEARCH_SERVER="" \ -ELASTICSEARCH_PORT=9200 \ -ELASTICSEARCH_INDEX_PREFIX=magento2 \ -ELASTICSEARCH_TIMEOUT=15 \ +OPENSEARCH_SERVER="" \ +OPENSEARCH_PORT=9200 \ +OPENSEARCH_INDEX_PREFIX=magento2 \ +OPENSEARCH_TIMEOUT=15 \ ADMIN_NAME=admin \ ADMIN_LASTNAME=admin \ ADMIN_EMAIL=admin@example.com \ diff --git a/.github/Makefile b/.github/Makefile index 04fe1c8b1..ba3317602 100644 --- a/.github/Makefile +++ b/.github/Makefile @@ -115,7 +115,6 @@ setup-mftf: --MAGENTO_BASE_URL "https://${MAGENTO_HOST}/" \ --MAGENTO_BACKEND_NAME "${ADMIN_URLEXT}" \ --MAGENTO_ADMIN_USERNAME "${ADMIN_USERNAME}" \ - --MAGENTO_ADMIN_PASSWORD "${ADMIN_PASSWORD}" \ --BROWSER chrome \ --ELASTICSEARCH_VERSION 7; echo 'SELENIUM_HOST=selenium' >> dev/tests/acceptance/.env; diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml index 21c4b69c9..7cac6d405 100644 --- a/.github/docker-compose.yml +++ b/.github/docker-compose.yml @@ -11,9 +11,9 @@ services: MARIADB_DATABASE: magento MARIADB_USER: magento MARIADB_PASSWORD: magento - elastic: - image: elasticsearch:7.17.23 - container_name: elasticsearch + opensearch: + image: bitnami/opensearch:2 + container_name: opensearch-container networks: - backend ports: @@ -37,7 +37,7 @@ services: - magento2.test.com environment: DB_SERVER: mariadb - ELASTICSEARCH_SERVER: elasticsearch + OPENSEARCH_SERVER: opensearch-container MAGENTO_HOST: magento2.test.com VIRTUAL_HOST: magento2.test.com COMPOSER_MEMORY_LIMIT: -1 @@ -52,7 +52,7 @@ services: MAGENTO_VERSION: depends_on: - db - - elastic + - opensearch volumes: - ../:/data/extensions/workdir - ./Makefile:/var/www/html/Makefile diff --git a/.github/scripts/install_magento.sh b/.github/scripts/install_magento.sh index 7daeb32f0..ad81930bc 100644 --- a/.github/scripts/install_magento.sh +++ b/.github/scripts/install_magento.sh @@ -20,29 +20,25 @@ else exit 1 fi -USE_ELASTICSEARCH='1' -if [[ "$MAGENTO_VERSION" =~ ^2\.3 ]]; then - USE_ELASTICSEARCH='0' -fi - -if [ "$USE_ELASTICSEARCH" == '1' ] && [ "$ELASTICSEARCH_SERVER" != "" ]; then +if [ "$OPENSEARCH_SERVER" != "" ]; then MAGENTO_INSTALL_ARGS=$(echo \ - --elasticsearch-host="$ELASTICSEARCH_SERVER" \ - --elasticsearch-port="$ELASTICSEARCH_PORT" \ - --elasticsearch-index-prefix="$ELASTICSEARCH_INDEX_PREFIX" \ - --elasticsearch-timeout="$ELASTICSEARCH_TIMEOUT") + --search-engine="opensearch" \ + --opensearch-host="$OPENSEARCH_SERVER" \ + --opensearch-port="$OPENSEARCH_PORT" \ + --opensearch-index-prefix="$OPENSEARCH_INDEX_PREFIX" \ + --opensearch-timeout="$OPENSEARCH_TIMEOUT") RET=1 while [ $RET -ne 0 ]; do - echo "Checking if $ELASTICSEARCH_SERVER is available." - curl -XGET "$ELASTICSEARCH_SERVER:$ELASTICSEARCH_PORT/_cat/health?v&pretty" >/dev/null 2>&1 + echo "Checking if $OPENSEARCH_SERVER is available." + curl -XGET "$OPENSEARCH_SERVER:$OPENSEARCH_PORT/_cat/health?v&pretty" >/dev/null 2>&1 RET=$? if [ $RET -ne 0 ]; then - echo "Connection to Elasticsearch is pending." + echo "Connection to OpenSearch is pending." sleep 5 fi done - echo "Elasticsearch server $ELASTICSEARCH_SERVER is available." + echo "OpenSearch server $OPENSEARCH_SERVER is available." fi if [[ -e /tmp/magento.tar.gz ]]; then diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index 81a78c862..32a92e084 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -29,8 +29,8 @@ jobs: labels: ubuntu-latest-8-cores timeout-minutes: 25 env: - PHP_VERSION: "8.1" - MAGENTO_VERSION: "2.4.5" + PHP_VERSION: "8.3" + MAGENTO_VERSION: "2.4.7-p2" ADYEN_API_KEY: ${{secrets.ADYEN_API_KEY}} ADYEN_CLIENT_KEY: ${{secrets.ADYEN_CLIENT_KEY}} ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}} diff --git a/.github/workflows/e2e-test-express-checkout.yml b/.github/workflows/e2e-test-express-checkout.yml index 48e9ff722..94b855c69 100644 --- a/.github/workflows/e2e-test-express-checkout.yml +++ b/.github/workflows/e2e-test-express-checkout.yml @@ -17,8 +17,8 @@ jobs: labels: ubuntu-latest-8-cores timeout-minutes: 20 env: - PHP_VERSION: "8.1" - MAGENTO_VERSION: "2.4.5" + PHP_VERSION: "8.3" + MAGENTO_VERSION: "2.4.7-p2" ADYEN_API_KEY: ${{secrets.ADYEN_API_KEY}} ADYEN_CLIENT_KEY: ${{secrets.ADYEN_CLIENT_KEY}} ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}} diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 09824636c..0652ca6ab 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -6,13 +6,17 @@ jobs: build: if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} + strategy: + matrix: + php-version: ["8.3"] + magento-version: ["2.4.7-p2"] runs-on: group: larger-runners labels: ubuntu-latest-8-cores timeout-minutes: 25 env: - PHP_VERSION: "8.1" - MAGENTO_VERSION: "2.4.5" + PHP_VERSION: ${{ matrix.php-version }} + MAGENTO_VERSION: ${{ matrix.magento-version }} ADYEN_API_KEY: ${{secrets.ADYEN_API_KEY}} ADYEN_CLIENT_KEY: ${{secrets.ADYEN_CLIENT_KEY}} ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}} diff --git a/.github/workflows/graphql-test.yml b/.github/workflows/graphql-test.yml index 0b7a25ab7..891800cfb 100644 --- a/.github/workflows/graphql-test.yml +++ b/.github/workflows/graphql-test.yml @@ -7,8 +7,8 @@ jobs: environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} strategy: matrix: - php-version: ["8.1"] - magento-version: ["2.4.5"] + php-version: ["8.2"] + magento-version: ["2.4.6-p7"] runs-on: ubuntu-latest env: PHP_VERSION: ${{ matrix.php-version }} diff --git a/.github/workflows/mftf-test.yml b/.github/workflows/mftf-test.yml index b6c177073..e73cfd6b0 100644 --- a/.github/workflows/mftf-test.yml +++ b/.github/workflows/mftf-test.yml @@ -13,8 +13,8 @@ jobs: strategy: matrix: include: - - php-version: '8.1' - magento-version: '2.4.5' + - php-version: '8.3' + magento-version: '2.4.7-p2' runs-on: ubuntu-latest env: PHP_VERSION: ${{ matrix.php-version }} diff --git a/.github/workflows/restapi-test.yml b/.github/workflows/restapi-test.yml index 3c04bb810..538ba5da5 100644 --- a/.github/workflows/restapi-test.yml +++ b/.github/workflows/restapi-test.yml @@ -7,8 +7,8 @@ jobs: environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} strategy: matrix: - php-version: ["8.1"] - magento-version: ["2.4.5"] + php-version: [8.3] + magento-version: [2.4.7-p2] runs-on: ubuntu-latest env: PHP_VERSION: ${{ matrix.php-version }}