Skip to content

Commit

Permalink
Fix checking if order exists for multistore, add queue.json in zip an…
Browse files Browse the repository at this point in the history
…d release 5.0.6

ISSUE: CS-4704
  • Loading branch information
AleksandarBoljanovic committed Nov 9, 2023
1 parent 7c86de8 commit 59b1758
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/adyenofficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion src/classes/Services/Integration/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' &&
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/classes/Utility/ZipGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*"
},
Expand Down
12 changes: 6 additions & 6 deletions src/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/controllers/admin/AdyenSystemInfoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/views/js/StateController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 59b1758

Please sign in to comment.