repzo-sap-absjo 1.0.43 → 1.0.45

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.
@@ -3,28 +3,7 @@ import { _create, set_error, getUniqueConcatenatedValues } from "../util.js";
3
3
  import { v4 as uuid } from "uuid";
4
4
  import moment from "moment-timezone";
5
5
  export const create_invoice = async (event, options) => {
6
- var _a,
7
- _b,
8
- _c,
9
- _d,
10
- _e,
11
- _f,
12
- _g,
13
- _h,
14
- _j,
15
- _k,
16
- _l,
17
- _m,
18
- _o,
19
- _p,
20
- _q,
21
- _r,
22
- _s,
23
- _t,
24
- _u,
25
- _v,
26
- _w,
27
- _x;
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
28
7
  const repzo = new Repzo(
29
8
  (_a = options.data) === null || _a === void 0 ? void 0 : _a.repzoApiKey,
30
9
  { env: options.env }
@@ -384,38 +363,21 @@ export const create_invoice = async (event, options) => {
384
363
  `Repzo => SAP: Invoice - ${repzo_serial_number}`,
385
364
  sap_invoice
386
365
  );
387
- let treating_invoice_as_proforma_for_etax = false;
388
- if (
389
- ((_r = body === null || body === void 0 ? void 0 : body.creator) ===
390
- null || _r === void 0
391
- ? void 0
392
- : _r.type) == "rep" &&
393
- ((_s =
394
- repzo_rep === null || repzo_rep === void 0
395
- ? void 0
396
- : repzo_rep.settings) === null || _s === void 0
397
- ? void 0
398
- : _s.treating_invoice_as_proforma_for_etax)
399
- ) {
400
- const company = await repzo.safeCrud.create({
401
- collection: "company",
402
- filters: { name_space: repzo_invoice.company_namespace },
403
- });
404
- if (
405
- (_u =
406
- (_t =
407
- company === null || company === void 0 ? void 0 : company.data) ===
408
- null || _t === void 0
409
- ? void 0
410
- : _t[0]) === null || _u === void 0
411
- ? void 0
412
- : _u.allow_treating_invoice_as_proforma_for_etax
413
- ) {
414
- treating_invoice_as_proforma_for_etax = true;
415
- }
416
- }
366
+ // let treat_invoice_as_proforma_for_etax: boolean = false;
367
+ // if (
368
+ // body?.creator?.type == "rep" &&
369
+ // repzo_rep?.settings?.treat_invoice_as_proforma_for_etax
370
+ // ) {
371
+ // const company = await repzo.safeCrud.create({
372
+ // collection: "company",
373
+ // filters: { name_space: repzo_invoice.company_namespace },
374
+ // });
375
+ // if (company?.data?.[0]?.allow_treat_invoice_as_proforma_for_etax) {
376
+ // treat_invoice_as_proforma_for_etax = true;
377
+ // }
378
+ // }
417
379
  let result;
418
- if (treating_invoice_as_proforma_for_etax) {
380
+ if (repzo_invoice.treat_invoice_as_proforma_for_etax) {
419
381
  actionLog.addDetail(
420
382
  `Repzo => SAP: Invoice - ${repzo_serial_number} - Treat Invoice as SalesOrder for eTax`,
421
383
  sap_invoice
@@ -424,15 +386,15 @@ export const create_invoice = async (event, options) => {
424
386
  result = await _create(SAP_HOST_URL, "/AddOrder", sap_invoice);
425
387
  } catch (e) {
426
388
  if (
427
- typeof ((_v = set_error(e)) === null || _v === void 0
389
+ typeof ((_r = set_error(e)) === null || _r === void 0
428
390
  ? void 0
429
- : _v.message) === "string" &&
430
- ((_x =
431
- (_w = set_error(e)) === null || _w === void 0
391
+ : _r.message) === "string" &&
392
+ ((_t =
393
+ (_s = set_error(e)) === null || _s === void 0
432
394
  ? void 0
433
- : _w.message) === null || _x === void 0
395
+ : _s.message) === null || _t === void 0
434
396
  ? void 0
435
- : _x.includes("this Sales Order is allready existed"))
397
+ : _t.includes("this Sales Order is allready existed"))
436
398
  ) {
437
399
  result = {
438
400
  success: true,
@@ -138,7 +138,7 @@ export const sync_rep = async (commandEvent) => {
138
138
  assigned_warehouse: warehouse,
139
139
  company_namespace: [nameSpace],
140
140
  "settings.treating_invoice_as_proforma_for_etax":
141
- sap_rep.INVOICESTATUS === "N" ? true : false,
141
+ sap_rep.INVOICESTATUS === "Y" ? true : false,
142
142
  };
143
143
  if (!repzo_rep) {
144
144
  // Create
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.43",
4
+ "version": "1.0.45",
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.186",
48
+ "repzo": "^1.0.188",
49
49
  "uuid": "^8.3.2"
50
50
  }
51
51
  }
@@ -317,22 +317,22 @@ export const create_invoice = async (event: EVENT, options: Config) => {
317
317
  sap_invoice
318
318
  );
319
319
 
320
- let treating_invoice_as_proforma_for_etax: boolean = false;
321
- if (
322
- body?.creator?.type == "rep" &&
323
- repzo_rep?.settings?.treating_invoice_as_proforma_for_etax
324
- ) {
325
- const company = await repzo.safeCrud.create({
326
- collection: "company",
327
- filters: { name_space: repzo_invoice.company_namespace },
328
- });
329
- if (company?.data?.[0]?.allow_treating_invoice_as_proforma_for_etax) {
330
- treating_invoice_as_proforma_for_etax = true;
331
- }
332
- }
320
+ // let treat_invoice_as_proforma_for_etax: boolean = false;
321
+ // if (
322
+ // body?.creator?.type == "rep" &&
323
+ // repzo_rep?.settings?.treat_invoice_as_proforma_for_etax
324
+ // ) {
325
+ // const company = await repzo.safeCrud.create({
326
+ // collection: "company",
327
+ // filters: { name_space: repzo_invoice.company_namespace },
328
+ // });
329
+ // if (company?.data?.[0]?.allow_treat_invoice_as_proforma_for_etax) {
330
+ // treat_invoice_as_proforma_for_etax = true;
331
+ // }
332
+ // }
333
333
 
334
334
  let result;
335
- if (treating_invoice_as_proforma_for_etax) {
335
+ if (repzo_invoice.treat_invoice_as_proforma_for_etax) {
336
336
  actionLog.addDetail(
337
337
  `Repzo => SAP: Invoice - ${repzo_serial_number} - Treat Invoice as SalesOrder for eTax`,
338
338
  sap_invoice
@@ -133,7 +133,7 @@ export const sync_rep = async (commandEvent: CommandEvent) => {
133
133
  assigned_warehouse: warehouse,
134
134
  company_namespace: [nameSpace],
135
135
  "settings.treating_invoice_as_proforma_for_etax":
136
- sap_rep.INVOICESTATUS === "N" ? true : false,
136
+ sap_rep.INVOICESTATUS === "Y" ? true : false,
137
137
  };
138
138
 
139
139
  if (!repzo_rep) {