fix(prestashop): import dates in the shop time zone (1.1.15)
This commit is contained in:
@@ -115,10 +115,33 @@ test('payment sync appends only the cumulative delta with a deterministic transa
|
||||
assert.equal(result.amount, 35);
|
||||
assert.equal(calls[1].method, 'payments.upsert');
|
||||
assert.equal(calls[1].params.payment.amount, 35);
|
||||
assert.equal(calls[1].params.payment.date.toISOString(), '2026-01-02T11:00:00.000Z');
|
||||
assert.equal(calls[1].params.payment.transactionId, 'prestashop:shop-a:44:paid:5500');
|
||||
assert.equal(updates[0][1].$set.paymentTotalSynced, 55);
|
||||
});
|
||||
|
||||
test('import waits for the 30-second stability window using shop time without guessing an offset', async () => {
|
||||
for (const [timeZone, localHour] of [['Europe/Warsaw', '11'], ['UTC', '09']]) {
|
||||
const imported = [], cursors = [];
|
||||
const result = await importOrdersForShop({ _id: 'default', lastOrderId: 10, timeZone }, {
|
||||
makeRequest: async () => ({ orders: [
|
||||
{ id: 11, reference: 'R11', date_add: `2026-09-25 ${localHour}:00:29` },
|
||||
{ id: 12, reference: 'R12', date_add: `2026-09-25 ${localHour}:00:45` },
|
||||
{ id: 13, reference: 'R13', date_add: '2026-09-25 15:00:00' },
|
||||
] }),
|
||||
}, {
|
||||
Core: { callModule: async () => ({ data: [] }) },
|
||||
importFromPSOrder: async id => { imported.push(id); return { status: 'imported' }; },
|
||||
setLastOrderId: async id => cursors.push(id),
|
||||
now: () => Date.parse('2026-09-25T09:01:00Z'),
|
||||
Log: silentLog,
|
||||
});
|
||||
assert.deepEqual(imported, [11]);
|
||||
assert.deepEqual(cursors, [11]);
|
||||
assert.equal(result.cursor, 11);
|
||||
}
|
||||
});
|
||||
|
||||
test('legacy mapping establishes a conservative baseline instead of duplicating a payment', async () => {
|
||||
const methods = [];
|
||||
const updates = [];
|
||||
|
||||
Reference in New Issue
Block a user