repzo-sap-absjo 1.0.8 → 1.0.9

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 (77) hide show
  1. package/lib/actions/create_invoice.d.ts +19 -13
  2. package/lib/actions/create_invoice.js +363 -214
  3. package/lib/actions/create_payment.d.ts +4 -1
  4. package/lib/actions/create_payment.js +200 -125
  5. package/lib/actions/create_proforma.d.ts +4 -1
  6. package/lib/actions/create_proforma.js +290 -165
  7. package/lib/actions/create_return_invoice.d.ts +4 -1
  8. package/lib/actions/create_return_invoice.js +321 -177
  9. package/lib/actions/create_transfer.d.ts +4 -1
  10. package/lib/actions/create_transfer.js +220 -143
  11. package/lib/actions/index.js +23 -15
  12. package/lib/commands/adjust_inventory.d.ts +4 -2
  13. package/lib/commands/adjust_inventory.js +290 -160
  14. package/lib/commands/bank.d.ts +4 -2
  15. package/lib/commands/bank.js +279 -157
  16. package/lib/commands/basic.js +66 -47
  17. package/lib/commands/category.d.ts +3 -1
  18. package/lib/commands/category.js +178 -104
  19. package/lib/commands/channel.d.ts +3 -1
  20. package/lib/commands/channel.js +198 -117
  21. package/lib/commands/client.d.ts +34 -32
  22. package/lib/commands/client.js +404 -244
  23. package/lib/commands/client_disabled.d.ts +3 -1
  24. package/lib/commands/client_disabled.js +163 -94
  25. package/lib/commands/index.d.ts +15 -11
  26. package/lib/commands/index.js +60 -60
  27. package/lib/commands/join.js +192 -66
  28. package/lib/commands/measureunit.d.ts +19 -14
  29. package/lib/commands/measureunit.js +289 -191
  30. package/lib/commands/measureunit_family.d.ts +10 -8
  31. package/lib/commands/measureunit_family.js +250 -138
  32. package/lib/commands/payment_term.d.ts +3 -1
  33. package/lib/commands/payment_term.js +202 -123
  34. package/lib/commands/price_list.d.ts +15 -15
  35. package/lib/commands/price_list.js +612 -326
  36. package/lib/commands/product.d.ts +32 -30
  37. package/lib/commands/product.js +425 -243
  38. package/lib/commands/product_disabled.d.ts +3 -1
  39. package/lib/commands/product_disabled.js +164 -94
  40. package/lib/commands/rep.js +221 -141
  41. package/lib/commands/tag.js +174 -109
  42. package/lib/commands/tax.js +177 -112
  43. package/lib/commands/warehouse.d.ts +3 -1
  44. package/lib/commands/warehouse.js +207 -119
  45. package/lib/index.d.ts +21 -12
  46. package/lib/test/actions/create_invoice.js +193 -188
  47. package/lib/test/actions/create_payment.js +112 -107
  48. package/lib/test/actions/create_proforma.js +220 -216
  49. package/lib/test/actions/create_return_invoice.js +205 -200
  50. package/lib/test/actions/create_transfer.js +120 -115
  51. package/lib/test/commands/adjust_inventory.js +90 -90
  52. package/lib/test/commands/bank.js +90 -90
  53. package/lib/test/commands/basic.js +328 -327
  54. package/lib/test/commands/category.js +90 -90
  55. package/lib/test/commands/channel.js +90 -90
  56. package/lib/test/commands/client.js +355 -353
  57. package/lib/test/commands/client_disabled.js +90 -90
  58. package/lib/test/commands/join.js +328 -327
  59. package/lib/test/commands/measureunit.js +90 -90
  60. package/lib/test/commands/measureunit_family.js +90 -90
  61. package/lib/test/commands/payment_term.js +90 -90
  62. package/lib/test/commands/price_list.js +337 -334
  63. package/lib/test/commands/product.js +90 -90
  64. package/lib/test/commands/product_disabled.js +90 -90
  65. package/lib/test/commands/rep.js +346 -344
  66. package/lib/test/commands/tag.js +90 -90
  67. package/lib/test/commands/tax.js +90 -90
  68. package/lib/test/commands/warehouse.js +90 -90
  69. package/lib/types.d.ts +83 -60
  70. package/lib/util.d.ts +70 -19
  71. package/lib/util.js +170 -144
  72. package/package.json +1 -1
  73. package/src/actions/create_invoice.ts +4 -13
  74. package/src/actions/create_payment.ts +4 -13
  75. package/src/actions/create_proforma.ts +28 -40
  76. package/src/actions/create_return_invoice.ts +4 -16
  77. package/src/actions/create_transfer.ts +24 -36
@@ -49,11 +49,6 @@ export const create_payment = async (event: EVENT, options: Config) => {
49
49
  }
50
50
  } catch (e) {
51
51
  console.error(e);
52
- await actionLog
53
- .addDetail(
54
- `Failed updating integration_meta of Payment: ${repzo_serial_number}`
55
- )
56
- .commit();
57
52
  }
58
53
 
59
54
  await actionLog
@@ -133,9 +128,10 @@ export const create_payment = async (event: EVENT, options: Config) => {
133
128
 
134
129
  // console.dir(sap_payment, { depth: null });
135
130
 
136
- await actionLog
137
- .addDetail(`Repzo => SAP: Payment - ${repzo_serial_number}`, sap_payment)
138
- .commit();
131
+ actionLog.addDetail(
132
+ `Repzo => SAP: Payment - ${repzo_serial_number}`,
133
+ sap_payment
134
+ );
139
135
 
140
136
  const result = await _create(SAP_HOST_URL, "/AddPayment", sap_payment);
141
137
 
@@ -151,11 +147,6 @@ export const create_payment = async (event: EVENT, options: Config) => {
151
147
  }
152
148
  } catch (e) {
153
149
  console.error(e);
154
- await actionLog
155
- .addDetail(
156
- `Failed updating integration_meta of Payment: ${repzo_serial_number}`
157
- )
158
- .commit();
159
150
  }
160
151
 
161
152
  await actionLog
@@ -44,24 +44,19 @@ export const create_proforma = async (event: EVENT, options: Config) => {
44
44
  } catch (e) {}
45
45
 
46
46
  const repzo_serial_number = body?.serial_number?.formatted;
47
- try {
48
- if (body?._id) {
49
- body.integration_meta = body?.integration_meta || {};
50
- body.integration_meta.sync_to_sap_started = true;
51
- body.integration_meta.sync_to_sap_succeeded =
52
- body.integration_meta.sync_to_sap_succeeded || false;
53
- await repzo.proforma.update(body._id, {
54
- integration_meta: body.integration_meta,
55
- });
56
- }
57
- } catch (e) {
58
- console.error(e);
59
- await actionLog
60
- .addDetail(
61
- `Failed updating integration_meta of SalesOrder: ${repzo_serial_number}`
62
- )
63
- .commit();
64
- }
47
+ // try {
48
+ // if (body?._id) {
49
+ // body.integration_meta = body?.integration_meta || {};
50
+ // body.integration_meta.sync_to_sap_started = true;
51
+ // body.integration_meta.sync_to_sap_succeeded =
52
+ // body.integration_meta.sync_to_sap_succeeded || false;
53
+ // await repzo.proforma.update(body._id, {
54
+ // integration_meta: body.integration_meta,
55
+ // });
56
+ // }
57
+ // } catch (e) {
58
+ // console.error(e);
59
+ // }
65
60
 
66
61
  await actionLog
67
62
  .addDetail(`SalesOrder - ${repzo_serial_number} => ${body?.sync_id}`)
@@ -204,33 +199,26 @@ export const create_proforma = async (event: EVENT, options: Config) => {
204
199
 
205
200
  // console.dir(sap_invoice, { depth: null });
206
201
 
207
- await actionLog
208
- .addDetail(
209
- `Repzo => SAP: SalesOrder - ${repzo_serial_number}`,
210
- sap_invoice
211
- )
212
- .commit();
202
+ actionLog.addDetail(
203
+ `Repzo => SAP: SalesOrder - ${repzo_serial_number}`,
204
+ sap_invoice
205
+ ); // .commit();
213
206
 
214
207
  const result = await _create(SAP_HOST_URL, "/AddOrder", sap_invoice);
215
208
 
216
209
  // console.log(result);
217
210
 
218
- try {
219
- if (body?._id) {
220
- body.integration_meta = body?.integration_meta || {};
221
- body.integration_meta.sync_to_sap_succeeded = true;
222
- await repzo.proforma.update(body._id, {
223
- integration_meta: body.integration_meta,
224
- });
225
- }
226
- } catch (e) {
227
- console.error(e);
228
- await actionLog
229
- .addDetail(
230
- `Failed updating integration_meta of SalesOrder: ${repzo_serial_number}`
231
- )
232
- .commit();
233
- }
211
+ // try {
212
+ // if (body?._id) {
213
+ // body.integration_meta = body?.integration_meta || {};
214
+ // body.integration_meta.sync_to_sap_succeeded = true;
215
+ // await repzo.proforma.update(body._id, {
216
+ // integration_meta: body.integration_meta,
217
+ // });
218
+ // }
219
+ // } catch (e) {
220
+ // console.error(e);
221
+ // }
234
222
 
235
223
  await actionLog
236
224
  .addDetail(`SAP Responded with `, result)
@@ -64,11 +64,6 @@ export const create_return_invoice = async (event: EVENT, options: Config) => {
64
64
  }
65
65
  } catch (e) {
66
66
  console.error(e);
67
- await actionLog
68
- .addDetail(
69
- `Failed updating integration_meta of Return Invoice: ${repzo_serial_number}`
70
- )
71
- .commit();
72
67
  }
73
68
 
74
69
  await actionLog
@@ -231,12 +226,10 @@ export const create_return_invoice = async (event: EVENT, options: Config) => {
231
226
 
232
227
  // console.dir(sap_return_invoice, { depth: null });
233
228
 
234
- await actionLog
235
- .addDetail(
236
- `Repzo => SAP: Invoice - ${repzo_serial_number}`,
237
- sap_return_invoice
238
- )
239
- .commit();
229
+ actionLog.addDetail(
230
+ `Repzo => SAP: Invoice - ${repzo_serial_number}`,
231
+ sap_return_invoice
232
+ );
240
233
 
241
234
  const result = await _create(
242
235
  SAP_HOST_URL,
@@ -256,11 +249,6 @@ export const create_return_invoice = async (event: EVENT, options: Config) => {
256
249
  }
257
250
  } catch (e) {
258
251
  console.error(e);
259
- await actionLog
260
- .addDetail(
261
- `Failed updating integration_meta of Return Invoice: ${repzo_serial_number}`
262
- )
263
- .commit();
264
252
  }
265
253
 
266
254
  await actionLog
@@ -41,24 +41,19 @@ export const create_transfer = async (event: EVENT, options: Config) => {
41
41
  } catch (e) {}
42
42
 
43
43
  const repzo_serial_number = body?.serial_number?.formatted;
44
- try {
45
- if (body?._id) {
46
- body.integration_meta = body?.integration_meta || {};
47
- body.integration_meta.sync_to_sap_started = true;
48
- body.integration_meta.sync_to_sap_succeeded =
49
- body.integration_meta.sync_to_sap_succeeded || false;
50
- await repzo.transfer.update(body._id, {
51
- integration_meta: body.integration_meta,
52
- });
53
- }
54
- } catch (e) {
55
- console.error(e);
56
- await actionLog
57
- .addDetail(
58
- `Failed updating integration_meta of Transfer: ${repzo_serial_number}`
59
- )
60
- .commit();
61
- }
44
+ // try {
45
+ // if (body?._id) {
46
+ // body.integration_meta = body?.integration_meta || {};
47
+ // body.integration_meta.sync_to_sap_started = true;
48
+ // body.integration_meta.sync_to_sap_succeeded =
49
+ // body.integration_meta.sync_to_sap_succeeded || false;
50
+ // await repzo.transfer.update(body._id, {
51
+ // integration_meta: body.integration_meta,
52
+ // });
53
+ // }
54
+ // } catch (e) {
55
+ // console.error(e);
56
+ // }
62
57
 
63
58
  await actionLog
64
59
  .addDetail(`Transfer - ${repzo_serial_number} => ${body?.sync_id}`)
@@ -161,12 +156,10 @@ export const create_transfer = async (event: EVENT, options: Config) => {
161
156
 
162
157
  // console.dir(sap_transfer, { depth: null });
163
158
 
164
- await actionLog
165
- .addDetail(
166
- `Repzo => SAP: Transfer - ${repzo_serial_number}`,
167
- sap_transfer
168
- )
169
- .commit();
159
+ actionLog.addDetail(
160
+ `Repzo => SAP: Transfer - ${repzo_serial_number}`,
161
+ sap_transfer
162
+ );
170
163
 
171
164
  const result = await _create(
172
165
  SAP_HOST_URL,
@@ -176,20 +169,15 @@ export const create_transfer = async (event: EVENT, options: Config) => {
176
169
 
177
170
  // console.log(result);
178
171
  try {
179
- if (body?._id) {
180
- body.integration_meta = body?.integration_meta || {};
181
- body.integration_meta.sync_to_sap_succeeded = true;
182
- await repzo.transfer.update(body._id, {
183
- integration_meta: body.integration_meta,
184
- });
185
- }
172
+ // if (body?._id) {
173
+ // body.integration_meta = body?.integration_meta || {};
174
+ // body.integration_meta.sync_to_sap_succeeded = true;
175
+ // await repzo.transfer.update(body._id, {
176
+ // integration_meta: body.integration_meta,
177
+ // });
178
+ // }
186
179
  } catch (e) {
187
180
  console.error(e);
188
- await actionLog
189
- .addDetail(
190
- `Failed updating integration_meta of Transfer: ${repzo_serial_number}`
191
- )
192
- .commit();
193
181
  }
194
182
 
195
183
  await actionLog