repzo-sap-absjo 1.0.46 → 1.0.49

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.
@@ -308,6 +308,12 @@ export const create_invoice = async (event, options) => {
308
308
  " | ",
309
309
  all_promotions
310
310
  ),
311
+ PromotionCode: getUniqueConcatenatedValues(
312
+ item,
313
+ "_id",
314
+ " | ",
315
+ all_promotions
316
+ ),
311
317
  ItemCode: item.variant.variant_name,
312
318
  Quantity: item.qty,
313
319
  TaxCode: repzo_tax.integration_meta.TaxCode,
@@ -337,6 +343,7 @@ export const create_invoice = async (event, options) => {
337
343
  RefNum:
338
344
  repzo_invoice.advanced_serial_number ||
339
345
  repzo_invoice.serial_number.formatted,
346
+ ExternalSerial: repzo_invoice.external_serial_number,
340
347
  SalPersCode:
341
348
  repzo_rep === null || repzo_rep === void 0
342
349
  ? void 0
@@ -347,6 +354,9 @@ export const create_invoice = async (event, options) => {
347
354
  DocDueDate: moment(repzo_invoice.due_date, "YYYY-MM-DD").format(
348
355
  "YYYYMMDD"
349
356
  ),
357
+ ExpectedDeliveryDate:
358
+ repzo_invoice.delivery_date &&
359
+ moment(repzo_invoice.delivery_date, "YYYY-MM-DD").format("YYYYMMDD"),
350
360
  ClientCode: repzo_client.client_code,
351
361
  DiscountPerc: "0",
352
362
  Note: repzo_invoice.comment,
@@ -286,6 +286,12 @@ export const create_proforma = async (event, options) => {
286
286
  " | ",
287
287
  all_promotions
288
288
  ),
289
+ PromotionCode: getUniqueConcatenatedValues(
290
+ item,
291
+ "_id",
292
+ " | ",
293
+ all_promotions
294
+ ),
289
295
  ItemCode: item.variant.variant_name,
290
296
  Quantity: item.qty,
291
297
  TaxCode: repzo_tax.integration_meta.TaxCode,
@@ -313,6 +319,7 @@ export const create_proforma = async (event, options) => {
313
319
  const sap_invoice = {
314
320
  RepzoSerial: repzo_proforma.serial_number.formatted,
315
321
  RefNum: repzo_proforma.serial_number.formatted,
322
+ ExternalSerial: repzo_proforma.external_serial_number,
316
323
  SalPersCode: repzo_rep
317
324
  ? repzo_rep.integration_id
318
325
  : (_s = options.data) === null || _s === void 0
@@ -324,6 +331,9 @@ export const create_proforma = async (event, options) => {
324
331
  DocDueDate: moment(repzo_proforma.issue_date, "YYYY-MM-DD").format(
325
332
  "YYYYMMDD"
326
333
  ),
334
+ ExpectedDeliveryDate:
335
+ repzo_proforma.delivery_date &&
336
+ moment(repzo_proforma.delivery_date, "YYYY-MM-DD").format("YYYYMMDD"),
327
337
  ClientCode: repzo_client.client_code,
328
338
  DiscountPerc: "0",
329
339
  Note: repzo_proforma.comment,
package/lib/util.d.ts CHANGED
@@ -82,7 +82,7 @@ export declare const send_command_to_marketplace: ({
82
82
  }) => Promise<void>;
83
83
  export declare const getUniqueConcatenatedValues: (
84
84
  item: Service.Item.Schema,
85
- key: "name" | "ref",
85
+ key: "name" | "ref" | "_id",
86
86
  delimiter: string,
87
87
  all_promos: {
88
88
  [promo_id: string]: {
package/lib/util.js CHANGED
@@ -202,6 +202,9 @@ export const getUniqueConcatenatedValues = function (
202
202
  item.general_promotions = item.general_promotions || [];
203
203
  item.used_promotions = item.used_promotions || [];
204
204
  const allPromotions = [...item.general_promotions, ...item.used_promotions];
205
+ allPromotions.forEach((promo) => {
206
+ promo._id = promo._id || promo.id;
207
+ });
205
208
  if ((_a = item.promotions) === null || _a === void 0 ? void 0 : _a.isGet) {
206
209
  const promo_id =
207
210
  (_c =
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "repzo-sap-absjo",
3
3
  "description": "repzo SAP ABS jo integration",
4
- "version": "1.0.46",
4
+ "version": "1.0.49",
5
5
  "homepage": "",
6
6
  "keywords": [],
7
7
  "author": {
@@ -45,7 +45,7 @@
45
45
  "jsonwebtoken": "^8.5.1",
46
46
  "lodash": "^4.17.21",
47
47
  "moment-timezone": "^0.5.34",
48
- "repzo": "^1.0.193",
48
+ "repzo": "^1.0.196",
49
49
  "uuid": "^8.3.2"
50
50
  }
51
51
  }
@@ -24,6 +24,7 @@ interface SAPInvoiceItem {
24
24
  Department: string; // "D6";
25
25
  MEO_Serial: string; //"used_promotion_ref1 | used_promotion_ref2"
26
26
  Promotion_Name: string; //"used_promotion_name1 | used_promotion_name2"
27
+ PromotionCode?: string; // String, Promotion _id
27
28
  }
28
29
 
29
30
  interface SAPInvoice {
@@ -38,6 +39,8 @@ interface SAPInvoice {
38
39
  WarehouseCode?: string; // "VS21"; // Required
39
40
  LinesDetails: SAPInvoiceItem[];
40
41
  U_ISTDQR?: string;
42
+ ExpectedDeliveryDate?: string; // DateTime => "20211229",
43
+ ExternalSerial?: string; // String
41
44
  }
42
45
 
43
46
  export interface SAPOpenInvoice {
@@ -271,6 +274,12 @@ export const create_invoice = async (event: EVENT, options: Config) => {
271
274
  " | ",
272
275
  all_promotions
273
276
  ),
277
+ PromotionCode: getUniqueConcatenatedValues(
278
+ item,
279
+ "_id",
280
+ " | ",
281
+ all_promotions
282
+ ),
274
283
  ItemCode: item.variant.variant_name,
275
284
  Quantity: item.qty,
276
285
  TaxCode: repzo_tax.integration_meta.TaxCode,
@@ -291,6 +300,7 @@ export const create_invoice = async (event: EVENT, options: Config) => {
291
300
  RefNum:
292
301
  repzo_invoice.advanced_serial_number ||
293
302
  repzo_invoice.serial_number.formatted,
303
+ ExternalSerial: repzo_invoice.external_serial_number,
294
304
  SalPersCode: repzo_rep?.integration_id,
295
305
  DocDate: moment(repzo_invoice.issue_date, "YYYY-MM-DD").format(
296
306
  "YYYYMMDD"
@@ -298,6 +308,9 @@ export const create_invoice = async (event: EVENT, options: Config) => {
298
308
  DocDueDate: moment(repzo_invoice.due_date, "YYYY-MM-DD").format(
299
309
  "YYYYMMDD"
300
310
  ),
311
+ ExpectedDeliveryDate:
312
+ repzo_invoice.delivery_date &&
313
+ moment(repzo_invoice.delivery_date, "YYYY-MM-DD").format("YYYYMMDD"),
301
314
  ClientCode: repzo_client.client_code,
302
315
  DiscountPerc: "0",
303
316
  Note: repzo_invoice.comment,
@@ -15,6 +15,7 @@ import moment from "moment-timezone";
15
15
  interface SAPProformaItem {
16
16
  MEO_Serial: string; // "INV-1021-4 | 010-LAG-PO0002";
17
17
  Promotion_Name: string; // "INV-1021-4 | 010-LAG-PO0002";
18
+ PromotionCode?: string; // String, Promotion _id
18
19
  ItemCode: string; // "010-LAG-PO0002";
19
20
  Quantity: number; // 10;
20
21
  TaxCode: string; // "S16";
@@ -37,6 +38,8 @@ interface SAPProforma {
37
38
  Note?: string; // "",
38
39
  WarehouseCode?: string; // "VS21";
39
40
  LinesDetails: SAPProformaItem[];
41
+ ExpectedDeliveryDate?: string; // DateTime => "20211229",
42
+ ExternalSerial?: string; // String
40
43
  }
41
44
 
42
45
  export const create_proforma = async (event: EVENT, options: Config) => {
@@ -209,6 +212,12 @@ export const create_proforma = async (event: EVENT, options: Config) => {
209
212
  " | ",
210
213
  all_promotions
211
214
  ),
215
+ PromotionCode: getUniqueConcatenatedValues(
216
+ item,
217
+ "_id",
218
+ " | ",
219
+ all_promotions
220
+ ),
212
221
  ItemCode: item.variant.variant_name,
213
222
  Quantity: item.qty,
214
223
  TaxCode: repzo_tax.integration_meta.TaxCode,
@@ -227,6 +236,7 @@ export const create_proforma = async (event: EVENT, options: Config) => {
227
236
  const sap_invoice: SAPProforma = {
228
237
  RepzoSerial: repzo_proforma.serial_number.formatted,
229
238
  RefNum: repzo_proforma.serial_number.formatted,
239
+ ExternalSerial: repzo_proforma.external_serial_number,
230
240
  SalPersCode: repzo_rep
231
241
  ? repzo_rep.integration_id
232
242
  : options.data?.SalPersCode, // "111",
@@ -236,6 +246,9 @@ export const create_proforma = async (event: EVENT, options: Config) => {
236
246
  DocDueDate: moment(repzo_proforma.issue_date, "YYYY-MM-DD").format(
237
247
  "YYYYMMDD"
238
248
  ),
249
+ ExpectedDeliveryDate:
250
+ repzo_proforma.delivery_date &&
251
+ moment(repzo_proforma.delivery_date, "YYYY-MM-DD").format("YYYYMMDD"),
239
252
  ClientCode: repzo_client.client_code,
240
253
  DiscountPerc: "0",
241
254
  Note: repzo_proforma.comment,
package/src/util.ts CHANGED
@@ -244,7 +244,7 @@ export const send_command_to_marketplace = async ({
244
244
 
245
245
  export const getUniqueConcatenatedValues = function (
246
246
  item: Service.Item.Schema,
247
- key: "name" | "ref",
247
+ key: "name" | "ref" | "_id",
248
248
  delimiter: string,
249
249
  all_promos: {
250
250
  [promo_id: string]: { _id: string; name: string; ref?: string };
@@ -256,6 +256,9 @@ export const getUniqueConcatenatedValues = function (
256
256
  ...item.general_promotions,
257
257
  ...item.used_promotions,
258
258
  ];
259
+ allPromotions.forEach((promo) => {
260
+ promo._id = promo._id || promo.id;
261
+ });
259
262
  if (item.promotions?.isGet) {
260
263
  const promo_id = item.promotions.bookings?.[0]?.promotion;
261
264
  if (promo_id && all_promos[promo_id])