@pinelab/vendure-plugin-qls-fulfillment 1.0.0-beta.13 → 1.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/custom-fields.d.ts
CHANGED
package/dist/custom-fields.js
CHANGED
|
@@ -23,6 +23,28 @@ exports.orderCustomFields = [
|
|
|
23
23
|
readonly: false,
|
|
24
24
|
ui: { tab: 'QLS' },
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
name: 'syncedToQls',
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
label: [
|
|
30
|
+
{ value: 'Created in QLS', languageCode: core_1.LanguageCode.en },
|
|
31
|
+
{ value: 'Aangemaakt in QLS', languageCode: core_1.LanguageCode.nl },
|
|
32
|
+
],
|
|
33
|
+
description: [
|
|
34
|
+
{
|
|
35
|
+
value: 'Uncheck this to be able to push the order to QLS again',
|
|
36
|
+
languageCode: core_1.LanguageCode.en,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: 'Vink dit uit om de order opnieuw naar QLS te sturen',
|
|
40
|
+
languageCode: core_1.LanguageCode.nl,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
nullable: true,
|
|
44
|
+
public: false,
|
|
45
|
+
readonly: false,
|
|
46
|
+
ui: { tab: 'QLS' },
|
|
47
|
+
},
|
|
26
48
|
{
|
|
27
49
|
name: 'qlsServicePointDetails',
|
|
28
50
|
type: 'string',
|
|
@@ -82,6 +82,9 @@ let QlsOrderService = class QlsOrderService {
|
|
|
82
82
|
if (!order) {
|
|
83
83
|
throw new Error(`No order with id ${orderId} not found`);
|
|
84
84
|
}
|
|
85
|
+
if (order.customFields.syncedToQls) {
|
|
86
|
+
throw new core_2.UserInputError(`Order '${order.code}' has already been synced to QLS`);
|
|
87
|
+
}
|
|
85
88
|
try {
|
|
86
89
|
// Check if all products are available in QLS
|
|
87
90
|
const qlsProducts = order.lines.map((line) => {
|
|
@@ -133,6 +136,9 @@ let QlsOrderService = class QlsOrderService {
|
|
|
133
136
|
...(additionalOrderFields ?? {}),
|
|
134
137
|
};
|
|
135
138
|
const result = await client.createFulfillmentOrder(qlsOrder);
|
|
139
|
+
await this.orderService.updateCustomFields(ctx, orderId, {
|
|
140
|
+
syncedToQls: true,
|
|
141
|
+
});
|
|
136
142
|
core_2.Logger.info(`Successfully created order '${order.code}' in QLS with id '${result.id}'`, constants_1.loggerCtx);
|
|
137
143
|
await this.orderService.addNoteToOrder(ctx, {
|
|
138
144
|
id: orderId,
|
|
@@ -183,7 +189,7 @@ let QlsOrderService = class QlsOrderService {
|
|
|
183
189
|
action: 'push-order',
|
|
184
190
|
ctx: ctx.serialize(),
|
|
185
191
|
orderId,
|
|
186
|
-
}, { retries:
|
|
192
|
+
}, { retries: 3 });
|
|
187
193
|
}
|
|
188
194
|
async getServicePoints(ctx, input) {
|
|
189
195
|
const client = await (0, qls_client_1.getQlsClient)(ctx, this.options);
|
|
@@ -225,7 +225,7 @@ let QlsProductService = class QlsProductService {
|
|
|
225
225
|
action: 'sync-products',
|
|
226
226
|
ctx: ctx.serialize(),
|
|
227
227
|
productVariantIds,
|
|
228
|
-
}, { retries:
|
|
228
|
+
}, { retries: 1 });
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
231
|
* Update the stock level for a variant based on the given available stock
|