repzo-sap-absjo 1.0.7 → 1.0.8

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.
Files changed (78) hide show
  1. package/changelog.md +1 -0
  2. package/lib/actions/create_invoice.d.ts +13 -19
  3. package/lib/actions/create_invoice.js +214 -371
  4. package/lib/actions/create_payment.d.ts +1 -4
  5. package/lib/actions/create_payment.js +125 -208
  6. package/lib/actions/create_proforma.d.ts +1 -4
  7. package/lib/actions/create_proforma.js +165 -305
  8. package/lib/actions/create_return_invoice.d.ts +1 -4
  9. package/lib/actions/create_return_invoice.js +177 -332
  10. package/lib/actions/create_transfer.d.ts +1 -4
  11. package/lib/actions/create_transfer.js +142 -234
  12. package/lib/actions/index.js +15 -23
  13. package/lib/commands/adjust_inventory.d.ts +2 -4
  14. package/lib/commands/adjust_inventory.js +160 -290
  15. package/lib/commands/bank.d.ts +2 -4
  16. package/lib/commands/bank.js +157 -279
  17. package/lib/commands/basic.js +47 -66
  18. package/lib/commands/category.d.ts +1 -3
  19. package/lib/commands/category.js +104 -178
  20. package/lib/commands/channel.d.ts +1 -3
  21. package/lib/commands/channel.js +117 -198
  22. package/lib/commands/client.d.ts +32 -34
  23. package/lib/commands/client.js +244 -404
  24. package/lib/commands/client_disabled.d.ts +1 -3
  25. package/lib/commands/client_disabled.js +94 -163
  26. package/lib/commands/index.d.ts +11 -15
  27. package/lib/commands/index.js +60 -60
  28. package/lib/commands/join.js +66 -192
  29. package/lib/commands/measureunit.d.ts +14 -19
  30. package/lib/commands/measureunit.js +191 -289
  31. package/lib/commands/measureunit_family.d.ts +8 -10
  32. package/lib/commands/measureunit_family.js +138 -250
  33. package/lib/commands/payment_term.d.ts +1 -3
  34. package/lib/commands/payment_term.js +123 -202
  35. package/lib/commands/price_list.d.ts +15 -15
  36. package/lib/commands/price_list.js +326 -612
  37. package/lib/commands/product.d.ts +30 -32
  38. package/lib/commands/product.js +243 -425
  39. package/lib/commands/product_disabled.d.ts +1 -3
  40. package/lib/commands/product_disabled.js +94 -164
  41. package/lib/commands/rep.js +141 -221
  42. package/lib/commands/tag.js +109 -174
  43. package/lib/commands/tax.js +112 -177
  44. package/lib/commands/warehouse.d.ts +1 -3
  45. package/lib/commands/warehouse.js +119 -207
  46. package/lib/index.d.ts +12 -21
  47. package/lib/test/actions/create_invoice.js +188 -193
  48. package/lib/test/actions/create_payment.js +107 -112
  49. package/lib/test/actions/create_proforma.js +216 -220
  50. package/lib/test/actions/create_return_invoice.js +200 -205
  51. package/lib/test/actions/create_transfer.js +115 -120
  52. package/lib/test/commands/adjust_inventory.js +90 -90
  53. package/lib/test/commands/bank.js +90 -90
  54. package/lib/test/commands/basic.js +327 -328
  55. package/lib/test/commands/category.js +90 -90
  56. package/lib/test/commands/channel.js +90 -90
  57. package/lib/test/commands/client.js +353 -355
  58. package/lib/test/commands/client_disabled.js +90 -90
  59. package/lib/test/commands/join.js +327 -328
  60. package/lib/test/commands/measureunit.js +90 -90
  61. package/lib/test/commands/measureunit_family.js +90 -90
  62. package/lib/test/commands/payment_term.js +90 -90
  63. package/lib/test/commands/price_list.js +334 -337
  64. package/lib/test/commands/product.js +90 -90
  65. package/lib/test/commands/product_disabled.js +90 -90
  66. package/lib/test/commands/rep.js +344 -346
  67. package/lib/test/commands/tag.js +90 -90
  68. package/lib/test/commands/tax.js +90 -90
  69. package/lib/test/commands/warehouse.js +90 -90
  70. package/lib/types.d.ts +60 -83
  71. package/lib/util.d.ts +19 -70
  72. package/lib/util.js +144 -170
  73. package/package.json +1 -1
  74. package/src/actions/create_invoice.ts +2 -1
  75. package/src/actions/create_payment.ts +2 -1
  76. package/src/actions/create_proforma.ts +2 -1
  77. package/src/actions/create_return_invoice.ts +2 -1
  78. package/src/actions/create_transfer.ts +2 -1
@@ -1,197 +1,71 @@
1
1
  import Repzo from "repzo";
2
2
  export const join = async (commandEvent) => {
3
- var _a,
4
- _b,
5
- _c,
6
- _d,
7
- _e,
8
- _f,
9
- _g,
10
- _h,
11
- _j,
12
- _k,
13
- _l,
14
- _m,
15
- _o,
16
- _p,
17
- _q,
18
- _r,
19
- _s,
20
- _t,
21
- _u,
22
- _v,
23
- _w,
24
- _x;
25
- const repzo = new Repzo(
26
- (_a = commandEvent.app.formData) === null || _a === void 0
27
- ? void 0
28
- : _a.repzoApiKey,
29
- {
30
- env: commandEvent.env,
3
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
4
+ const repzo = new Repzo((_a = commandEvent.app.formData) === null || _a === void 0 ? void 0 : _a.repzoApiKey, {
5
+ env: commandEvent.env,
6
+ });
7
+ const commandLog = new Repzo.CommandLog(repzo, commandEvent.app, commandEvent.command);
8
+ try {
9
+ // console.log("join");
10
+ await commandLog.load(commandEvent.sync_id);
11
+ await commandLog.addDetail("Repzo SAP: Join").commit();
12
+ const body = {
13
+ data: [
14
+ // invoice
15
+ {
16
+ app: "repzo-sap-absjo",
17
+ app_id: (_b = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _b === void 0 ? void 0 : _b._id,
18
+ action: "create_invoice",
19
+ event: "invoiceItems.create",
20
+ join: ((_e = (_d = (_c = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _c === void 0 ? void 0 : _c.formData) === null || _d === void 0 ? void 0 : _d.invoices) === null || _e === void 0 ? void 0 : _e.createInvoiceHook) || false,
21
+ },
22
+ // return_invoice
23
+ {
24
+ app: "repzo-sap-absjo",
25
+ app_id: (_f = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _f === void 0 ? void 0 : _f._id,
26
+ action: "create_return_invoice",
27
+ event: "returnItems.create",
28
+ join: ((_j = (_h = (_g = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _g === void 0 ? void 0 : _g.formData) === null || _h === void 0 ? void 0 : _h.invoices) === null || _j === void 0 ? void 0 : _j.createReturnInvoiceHook) ||
29
+ false,
30
+ },
31
+ // payment
32
+ {
33
+ app: "repzo-sap-absjo",
34
+ app_id: (_k = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _k === void 0 ? void 0 : _k._id,
35
+ action: "create_payment",
36
+ event: "payment.create",
37
+ join: ((_o = (_m = (_l = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _l === void 0 ? void 0 : _l.formData) === null || _m === void 0 ? void 0 : _m.payments) === null || _o === void 0 ? void 0 : _o.createPaymentHook) || false,
38
+ },
39
+ // proforma
40
+ {
41
+ app: "repzo-sap-absjo",
42
+ app_id: (_p = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _p === void 0 ? void 0 : _p._id,
43
+ action: "create_proforma",
44
+ event: "salesorder.approve",
45
+ join: ((_s = (_r = (_q = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _q === void 0 ? void 0 : _q.formData) === null || _r === void 0 ? void 0 : _r.proformas) === null || _s === void 0 ? void 0 : _s.createApprovedProformaHook) || false,
46
+ },
47
+ // transfer
48
+ {
49
+ app: "repzo-sap-absjo",
50
+ app_id: (_t = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _t === void 0 ? void 0 : _t._id,
51
+ action: "create_transfer",
52
+ event: "transfer.approve",
53
+ join: ((_w = (_v = (_u = commandEvent === null || commandEvent === void 0 ? void 0 : commandEvent.app) === null || _u === void 0 ? void 0 : _u.formData) === null || _v === void 0 ? void 0 : _v.transfers) === null || _w === void 0 ? void 0 : _w.createApprovedTransferHook) || false,
54
+ },
55
+ ],
56
+ };
57
+ const result = await repzo.joinActionsWebHook.update(null, body);
58
+ // console.log(result);
59
+ if ((result === null || result === void 0 ? void 0 : result.status) == "failure") {
60
+ await commandLog.setStatus("fail", result.error).setBody(result).commit();
61
+ return;
62
+ }
63
+ await commandLog.setStatus("success").setBody(result).commit();
31
64
  }
32
- );
33
- const commandLog = new Repzo.CommandLog(
34
- repzo,
35
- commandEvent.app,
36
- commandEvent.command
37
- );
38
- try {
39
- // console.log("join");
40
- await commandLog.load(commandEvent.sync_id);
41
- await commandLog.addDetail("Repzo SAP: Join").commit();
42
- const body = {
43
- data: [
44
- // invoice
45
- {
46
- app: "repzo-sap-absjo",
47
- app_id:
48
- (_b =
49
- commandEvent === null || commandEvent === void 0
50
- ? void 0
51
- : commandEvent.app) === null || _b === void 0
52
- ? void 0
53
- : _b._id,
54
- action: "create_invoice",
55
- event: "invoiceItems.create",
56
- join:
57
- ((_e =
58
- (_d =
59
- (_c =
60
- commandEvent === null || commandEvent === void 0
61
- ? void 0
62
- : commandEvent.app) === null || _c === void 0
63
- ? void 0
64
- : _c.formData) === null || _d === void 0
65
- ? void 0
66
- : _d.invoices) === null || _e === void 0
67
- ? void 0
68
- : _e.createInvoiceHook) || false,
69
- },
70
- // return_invoice
71
- {
72
- app: "repzo-sap-absjo",
73
- app_id:
74
- (_f =
75
- commandEvent === null || commandEvent === void 0
76
- ? void 0
77
- : commandEvent.app) === null || _f === void 0
78
- ? void 0
79
- : _f._id,
80
- action: "create_return_invoice",
81
- event: "returnItems.create",
82
- join:
83
- ((_j =
84
- (_h =
85
- (_g =
86
- commandEvent === null || commandEvent === void 0
87
- ? void 0
88
- : commandEvent.app) === null || _g === void 0
89
- ? void 0
90
- : _g.formData) === null || _h === void 0
91
- ? void 0
92
- : _h.invoices) === null || _j === void 0
93
- ? void 0
94
- : _j.createReturnInvoiceHook) || false,
95
- },
96
- // payment
97
- {
98
- app: "repzo-sap-absjo",
99
- app_id:
100
- (_k =
101
- commandEvent === null || commandEvent === void 0
102
- ? void 0
103
- : commandEvent.app) === null || _k === void 0
104
- ? void 0
105
- : _k._id,
106
- action: "create_payment",
107
- event: "payment.create",
108
- join:
109
- ((_o =
110
- (_m =
111
- (_l =
112
- commandEvent === null || commandEvent === void 0
113
- ? void 0
114
- : commandEvent.app) === null || _l === void 0
115
- ? void 0
116
- : _l.formData) === null || _m === void 0
117
- ? void 0
118
- : _m.payments) === null || _o === void 0
119
- ? void 0
120
- : _o.createPaymentHook) || false,
121
- },
122
- // proforma
123
- {
124
- app: "repzo-sap-absjo",
125
- app_id:
126
- (_p =
127
- commandEvent === null || commandEvent === void 0
128
- ? void 0
129
- : commandEvent.app) === null || _p === void 0
130
- ? void 0
131
- : _p._id,
132
- action: "create_proforma",
133
- event: "salesorder.approve",
134
- join:
135
- ((_s =
136
- (_r =
137
- (_q =
138
- commandEvent === null || commandEvent === void 0
139
- ? void 0
140
- : commandEvent.app) === null || _q === void 0
141
- ? void 0
142
- : _q.formData) === null || _r === void 0
143
- ? void 0
144
- : _r.proformas) === null || _s === void 0
145
- ? void 0
146
- : _s.createApprovedProformaHook) || false,
147
- },
148
- // transfer
149
- {
150
- app: "repzo-sap-absjo",
151
- app_id:
152
- (_t =
153
- commandEvent === null || commandEvent === void 0
154
- ? void 0
155
- : commandEvent.app) === null || _t === void 0
156
- ? void 0
157
- : _t._id,
158
- action: "create_transfer",
159
- event: "transfer.approve",
160
- join:
161
- ((_w =
162
- (_v =
163
- (_u =
164
- commandEvent === null || commandEvent === void 0
165
- ? void 0
166
- : commandEvent.app) === null || _u === void 0
167
- ? void 0
168
- : _u.formData) === null || _v === void 0
169
- ? void 0
170
- : _v.transfers) === null || _w === void 0
171
- ? void 0
172
- : _w.createApprovedTransferHook) || false,
173
- },
174
- ],
175
- };
176
- const result = await repzo.joinActionsWebHook.update(null, body);
177
- // console.log(result);
178
- if (
179
- (result === null || result === void 0 ? void 0 : result.status) ==
180
- "failure"
181
- ) {
182
- await commandLog.setStatus("fail", result.error).setBody(result).commit();
183
- return;
65
+ catch (e) {
66
+ //@ts-ignore
67
+ console.error(((_x = e === null || e === void 0 ? void 0 : e.response) === null || _x === void 0 ? void 0 : _x.data) || e);
68
+ await commandLog.setStatus("fail", e).commit();
69
+ throw e;
184
70
  }
185
- await commandLog.setStatus("success").setBody(result).commit();
186
- } catch (e) {
187
- //@ts-ignore
188
- console.error(
189
- ((_x = e === null || e === void 0 ? void 0 : e.response) === null ||
190
- _x === void 0
191
- ? void 0
192
- : _x.data) || e
193
- );
194
- await commandLog.setStatus("fail", e).commit();
195
- throw e;
196
- }
197
71
  };
@@ -1,23 +1,18 @@
1
1
  import { CommandEvent, Result } from "../types";
2
2
  export interface SAPUoM {
3
- ITEMCODE: string;
4
- UOMGROUPENTRY: number;
5
- UOMGROUPCODE: string;
6
- UOMGROUPNAME: string;
7
- BASEUOMID: number;
8
- BASEUOMCODE: string;
9
- BASEQTY: number;
10
- ALTUOMID: number;
11
- ALTUOMCODE: string;
12
- ALTQTY: number;
13
- repzo_factor?: number;
3
+ ITEMCODE: string;
4
+ UOMGROUPENTRY: number;
5
+ UOMGROUPCODE: string;
6
+ UOMGROUPNAME: string;
7
+ BASEUOMID: number;
8
+ BASEUOMCODE: string;
9
+ BASEQTY: number;
10
+ ALTUOMID: number;
11
+ ALTUOMCODE: string;
12
+ ALTQTY: number;
13
+ repzo_factor?: number;
14
14
  }
15
- export declare const sync_measureunit: (
16
- commandEvent: CommandEvent
17
- ) => Promise<Result>;
18
- export declare const get_sap_UoMs: (
19
- serviceEndPoint: string,
20
- query?: {
15
+ export declare const sync_measureunit: (commandEvent: CommandEvent) => Promise<Result>;
16
+ export declare const get_sap_UoMs: (serviceEndPoint: string, query?: {
21
17
  updateAt?: string;
22
- }
23
- ) => Promise<SAPUoM[]>;
18
+ }) => Promise<SAPUoM[]>;