repzo-sap-absjo 1.0.44 → 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.
- package/lib/actions/create_invoice.js +21 -59
- package/package.json +2 -2
- package/src/actions/create_invoice.ts +14 -14
|
@@ -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
|
|
388
|
-
if (
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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 (
|
|
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 ((
|
|
389
|
+
typeof ((_r = set_error(e)) === null || _r === void 0
|
|
428
390
|
? void 0
|
|
429
|
-
:
|
|
430
|
-
((
|
|
431
|
-
(
|
|
391
|
+
: _r.message) === "string" &&
|
|
392
|
+
((_t =
|
|
393
|
+
(_s = set_error(e)) === null || _s === void 0
|
|
432
394
|
? void 0
|
|
433
|
-
:
|
|
395
|
+
: _s.message) === null || _t === void 0
|
|
434
396
|
? void 0
|
|
435
|
-
:
|
|
397
|
+
: _t.includes("this Sales Order is allready existed"))
|
|
436
398
|
) {
|
|
437
399
|
result = {
|
|
438
400
|
success: true,
|
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.
|
|
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.
|
|
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
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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 (
|
|
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
|