@pinelab/vendure-plugin-qls-fulfillment 1.0.0-beta.14 → 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.
@@ -6,6 +6,7 @@ declare module '@vendure/core' {
6
6
  interface CustomOrderFields {
7
7
  qlsServicePointId?: string;
8
8
  qlsServicePointDetails?: string;
9
+ syncedToQls?: boolean;
9
10
  }
10
11
  }
11
12
  export declare const variantCustomFields: CustomFieldConfig[];
@@ -41,7 +41,7 @@ exports.orderCustomFields = [
41
41
  },
42
42
  ],
43
43
  nullable: true,
44
- public: true,
44
+ public: false,
45
45
  readonly: false,
46
46
  ui: { tab: 'QLS' },
47
47
  },
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinelab/vendure-plugin-qls-fulfillment",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "Vendure plugin to fulfill orders via QLS.",
5
5
  "keywords": [
6
6
  "fulfillment",