From 519f8daeb0edef321acaddc49d32c0618f076c56 Mon Sep 17 00:00:00 2001 From: fatequod Date: Fri, 11 Sep 2026 09:57:20 +0200 Subject: [PATCH] fix(prestashop): support customer note sorting in 1.1.9 --- module.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/PrestaApi.js | 4 ++-- test/presta-api.test.js | 5 +++++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/module.json b/module.json index 8640e1a..a7947e4 100644 --- a/module.json +++ b/module.json @@ -1,6 +1,6 @@ { "name": "core/prestashop", - "version": "1.1.8", + "version": "1.1.9", "singleton": false, "dependsOn": [ "core/orders", diff --git a/package-lock.json b/package-lock.json index 7e2b190..ac69d0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "core.prestashop", - "version": "1.1.8", + "version": "1.1.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "core.prestashop", - "version": "1.1.8", + "version": "1.1.9", "license": "ISC", "dependencies": { "@orbito/api-lib": "^3.3.3", diff --git a/package.json b/package.json index ac56aca..ce37125 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "core.prestashop", - "version": "1.1.8", + "version": "1.1.9", "description": "Integracja zamówień i płatności PrestaShop", "main": "index.js", "scripts": { diff --git a/src/PrestaApi.js b/src/PrestaApi.js index 313c963..01c35c7 100644 --- a/src/PrestaApi.js +++ b/src/PrestaApi.js @@ -340,7 +340,7 @@ module.exports = class PrestashopApi { const res = await this.makeRequest('messages', 'GET', { output_format: 'JSON', display: 'full', - sort: 'date_add_ASC', + sort: 'id_ASC', [`filter[${field}]`]: `[${id}]`, }); const messages = Array.isArray(res?.messages) ? res.messages : []; @@ -368,7 +368,7 @@ module.exports = class PrestashopApi { .map(threadId => this.makeRequest('customer_messages', 'GET', { output_format: 'JSON', display: 'full', - sort: 'date_add_ASC', + sort: 'id_ASC', 'filter[id_customer_thread]': `[${threadId}]`, }))); diff --git a/test/presta-api.test.js b/test/presta-api.test.js index 991dfe9..0ffe68e 100644 --- a/test/presta-api.test.js +++ b/test/presta-api.test.js @@ -162,6 +162,11 @@ test('collects public customer notes from order, cart and customer thread withou 'Kod bramy: 1234', ]); assert.equal(calls.filter(call => call.pathname.endsWith('/customer_messages')).length, 1); + assert.equal(calls.filter(call => call.pathname.endsWith('/messages')).length, 2); + for (const call of calls.filter(call => call.pathname.endsWith('/messages') + || call.pathname.endsWith('/customer_messages'))) { + assert.equal(call.searchParams.get('sort'), 'id_ASC'); + } }); test('keeps notes from available sources when one customer-note endpoint is forbidden', async t => {