repzo-sap-absjo 1.0.45 → 1.0.48

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,
@@ -311,7 +317,9 @@ export const create_proforma = async (event, options) => {
311
317
  });
312
318
  }
313
319
  const sap_invoice = {
320
+ RepzoSerial: repzo_proforma.serial_number.formatted,
314
321
  RefNum: repzo_proforma.serial_number.formatted,
322
+ ExternalSerial: repzo_proforma.external_serial_number,
315
323
  SalPersCode: repzo_rep
316
324
  ? repzo_rep.integration_id
317
325
  : (_s = options.data) === null || _s === void 0
@@ -323,6 +331,9 @@ export const create_proforma = async (event, options) => {
323
331
  DocDueDate: moment(repzo_proforma.issue_date, "YYYY-MM-DD").format(
324
332
  "YYYYMMDD"
325
333
  ),
334
+ ExpectedDeliveryDate:
335
+ repzo_proforma.delivery_date &&
336
+ moment(repzo_proforma.delivery_date, "YYYY-MM-DD").format("YYYYMMDD"),
326
337
  ClientCode: repzo_client.client_code,
327
338
  DiscountPerc: "0",
328
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/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.45",
4
+ "version": "1.0.48",
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.188",
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";
@@ -27,6 +28,7 @@ interface SAPProformaItem {
27
28
  }
28
29
 
29
30
  interface SAPProforma {
31
+ RepzoSerial: string; // "INV-1021-4",
30
32
  RefNum: string; // "INV-1021-4",
31
33
  SalPersCode: string; // "106",
32
34
  DocDate: string; // "20211229",
@@ -36,6 +38,8 @@ interface SAPProforma {
36
38
  Note?: string; // "",
37
39
  WarehouseCode?: string; // "VS21";
38
40
  LinesDetails: SAPProformaItem[];
41
+ ExpectedDeliveryDate?: string; // DateTime => "20211229",
42
+ ExternalSerial?: string; // String
39
43
  }
40
44
 
41
45
  export const create_proforma = async (event: EVENT, options: Config) => {
@@ -208,6 +212,12 @@ export const create_proforma = async (event: EVENT, options: Config) => {
208
212
  " | ",
209
213
  all_promotions
210
214
  ),
215
+ PromotionCode: getUniqueConcatenatedValues(
216
+ item,
217
+ "_id",
218
+ " | ",
219
+ all_promotions
220
+ ),
211
221
  ItemCode: item.variant.variant_name,
212
222
  Quantity: item.qty,
213
223
  TaxCode: repzo_tax.integration_meta.TaxCode,
@@ -224,7 +234,9 @@ export const create_proforma = async (event: EVENT, options: Config) => {
224
234
  }
225
235
 
226
236
  const sap_invoice: SAPProforma = {
237
+ RepzoSerial: repzo_proforma.serial_number.formatted,
227
238
  RefNum: repzo_proforma.serial_number.formatted,
239
+ ExternalSerial: repzo_proforma.external_serial_number,
228
240
  SalPersCode: repzo_rep
229
241
  ? repzo_rep.integration_id
230
242
  : options.data?.SalPersCode, // "111",
@@ -234,6 +246,9 @@ export const create_proforma = async (event: EVENT, options: Config) => {
234
246
  DocDueDate: moment(repzo_proforma.issue_date, "YYYY-MM-DD").format(
235
247
  "YYYYMMDD"
236
248
  ),
249
+ ExpectedDeliveryDate:
250
+ repzo_proforma.delivery_date &&
251
+ moment(repzo_proforma.delivery_date, "YYYY-MM-DD").format("YYYYMMDD"),
237
252
  ClientCode: repzo_client.client_code,
238
253
  DiscountPerc: "0",
239
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 };