From 59b1758cf818b4d873abf679d05b1603b4fe9712 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasa Boljanovic Date: Thu, 9 Nov 2023 13:42:13 +0100 Subject: [PATCH] Fix checking if order exists for multistore, add queue.json in zip and release 5.0.6 ISSUE: CS-4704 --- src/adyenofficial.php | 2 +- src/classes/Services/Integration/OrderService.php | 8 +++++++- src/classes/Utility/ZipGenerator.php | 4 ++++ src/composer.json | 2 +- src/composer.lock | 12 ++++++------ src/controllers/admin/AdyenSystemInfoController.php | 3 ++- src/views/js/StateController.js | 2 +- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/adyenofficial.php b/src/adyenofficial.php index 913ed8d5..c937e020 100755 --- a/src/adyenofficial.php +++ b/src/adyenofficial.php @@ -46,7 +46,7 @@ public function __construct() { $this->name = 'adyenofficial'; $this->tab = 'payments_gateways'; - $this->version = '5.0.5'; + $this->version = '5.0.6'; $this->author = $this->l('Adyen'); $this->need_instance = 0; diff --git a/src/classes/Services/Integration/OrderService.php b/src/classes/Services/Integration/OrderService.php index fb2e4455..ffaf011b 100644 --- a/src/classes/Services/Integration/OrderService.php +++ b/src/classes/Services/Integration/OrderService.php @@ -51,11 +51,15 @@ public function __construct(TransactionHistoryRepository $transactionLogReposito * @param string $merchantReference * * @return bool + * + * @throws PrestaShopDatabaseException + * @throws PrestaShopException */ public function orderExists(string $merchantReference): bool { $cart = new Cart((int)$merchantReference); - $order = Order::getByCartId($merchantReference); + $idOrder = (int)$this->getIdByCartId((int)$merchantReference); + $order = new Order($idOrder); return $cart->orderExists() && $order->module === 'adyenofficial' && @@ -126,6 +130,8 @@ public function getOrderUrl(string $merchantReference): string } /** + * This function must be used for fetching order id from cart because PrestaShop function: Order::getByCartId won't work for multistore. + * * @param int $cartId * * @return false|string|null diff --git a/src/classes/Utility/ZipGenerator.php b/src/classes/Utility/ZipGenerator.php index a9ba062f..e98d482f 100644 --- a/src/classes/Utility/ZipGenerator.php +++ b/src/classes/Utility/ZipGenerator.php @@ -46,6 +46,10 @@ public static function createZip(array $info, array $autoTestReport, string $log $filesNames['AUTO_TEST'], json_encode($autoTestReport, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ); + $zip->addFromString( + $filesNames['QUEUE'], + json_encode($info['queueItems'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) + ); $zip->addFromString($filesNames['LOGS'], $logs); $zip->close(); diff --git a/src/composer.json b/src/composer.json index 9c989b2e..49f98d69 100755 --- a/src/composer.json +++ b/src/composer.json @@ -41,7 +41,7 @@ "php": "^7.2|^7.4|^8.0", "ext-json": "*", "ext-zip": "*", - "adyen/integration-core": "1.0.4", + "adyen/integration-core": "1.0.5", "ext-simplexml": "*", "ext-openssl": "*" }, diff --git a/src/composer.lock b/src/composer.lock index 5f6b4248..84b80141 100755 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0e22affdf98f64a9efaf9d2edaec5f49", + "content-hash": "0a05f14ebc9d4bf1e2c7745be88f1b49", "packages": [ { "name": "adyen/integration-core", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "git@github.com:Adyen/adyen-php-plugin-core.git", - "reference": "caf90c37d782550006cc2197c9b3151779f365ad" + "reference": "71d5b164cf6d11c1c683d400924aa897b889b6e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Adyen/adyen-php-plugin-core/zipball/caf90c37d782550006cc2197c9b3151779f365ad", - "reference": "caf90c37d782550006cc2197c9b3151779f365ad", + "url": "https://api.github.com/repos/Adyen/adyen-php-plugin-core/zipball/71d5b164cf6d11c1c683d400924aa897b889b6e9", + "reference": "71d5b164cf6d11c1c683d400924aa897b889b6e9", "shasum": "" }, "require": { @@ -48,7 +48,7 @@ "proprietary" ], "description": "Core Adyen integration library", - "time": "2023-11-02T11:21:31+00:00" + "time": "2023-11-09T11:55:44+00:00" }, { "name": "adyen/php-webhook-module", diff --git a/src/controllers/admin/AdyenSystemInfoController.php b/src/controllers/admin/AdyenSystemInfoController.php index b3eccc85..96c90e64 100755 --- a/src/controllers/admin/AdyenSystemInfoController.php +++ b/src/controllers/admin/AdyenSystemInfoController.php @@ -24,7 +24,8 @@ class AdyenSystemInfoController extends AdyenBaseController 'AUTO_TEST' => 'auto-test.json', 'CONNECTION_SETTINGS' => 'connection-settings.json', 'WEBHOOK_VALIDATION' => 'webhook-validation.json', - 'LOGS' => 'logs.json' + 'LOGS' => 'logs.json', + 'QUEUE' => 'queue.json' ]; /** diff --git a/src/views/js/StateController.js b/src/views/js/StateController.js index 2a46c4c4..b6485490 100644 --- a/src/views/js/StateController.js +++ b/src/views/js/StateController.js @@ -60,7 +60,7 @@ if (!window.AdyenFE) { window.addEventListener('hashchange', updateStateOnHashChange, false); - api.get(!getStoreId() ? configuration.currentStoreUrl : configuration.storesUrl, () => null, true) + api.get(configuration.currentStoreUrl, () => null, true) .then( /** @param {Store|Store[]} response */ (response) => {