repzo-sap-absjo 1.0.7 → 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.
- package/changelog.md +1 -0
- package/lib/actions/create_invoice.js +6 -14
- package/lib/actions/create_payment.js +6 -14
- package/lib/actions/create_proforma.js +28 -43
- package/lib/actions/create_return_invoice.js +6 -17
- package/lib/actions/create_transfer.js +24 -39
- package/package.json +1 -1
- package/src/actions/create_invoice.ts +6 -14
- package/src/actions/create_payment.ts +6 -14
- package/src/actions/create_proforma.ts +28 -39
- package/src/actions/create_return_invoice.ts +6 -17
- package/src/actions/create_transfer.ts +24 -35
package/changelog.md
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
- [command/measureunit-family] use _.xor instead or _.difference @maramalshen
|
|
17
17
|
- [command/price_list] fix bug in priceList-item @maramalshen
|
|
18
|
+
- [actions/**] don't update integration_meta.sync_to_sap_succeeded if it is already true @maramalshen
|
|
18
19
|
|
|
19
20
|
### Removed
|
|
20
21
|
|
|
@@ -33,18 +33,14 @@ export const create_invoice = async (event, options) => {
|
|
|
33
33
|
(body === null || body === void 0 ? void 0 : body.integration_meta) ||
|
|
34
34
|
{};
|
|
35
35
|
body.integration_meta.sync_to_sap_started = true;
|
|
36
|
-
body.integration_meta.sync_to_sap_succeeded =
|
|
36
|
+
body.integration_meta.sync_to_sap_succeeded =
|
|
37
|
+
body.integration_meta.sync_to_sap_succeeded || false;
|
|
37
38
|
await repzo.invoice.update(body._id, {
|
|
38
39
|
integration_meta: body.integration_meta,
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
} catch (e) {
|
|
42
43
|
console.error(e);
|
|
43
|
-
await actionLog
|
|
44
|
-
.addDetail(
|
|
45
|
-
`Failed updating integration_meta of Invoice: ${repzo_serial_number}`
|
|
46
|
-
)
|
|
47
|
-
.commit();
|
|
48
44
|
}
|
|
49
45
|
await actionLog
|
|
50
46
|
.addDetail(
|
|
@@ -333,9 +329,10 @@ export const create_invoice = async (event, options) => {
|
|
|
333
329
|
LinesDetails: items,
|
|
334
330
|
};
|
|
335
331
|
// console.dir(sap_invoice, { depth: null });
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
332
|
+
actionLog.addDetail(
|
|
333
|
+
`Repzo => SAP: Invoice - ${repzo_serial_number}`,
|
|
334
|
+
sap_invoice
|
|
335
|
+
);
|
|
339
336
|
const result = await _create(SAP_HOST_URL, "/AddInvoice", sap_invoice);
|
|
340
337
|
// console.log(result);
|
|
341
338
|
try {
|
|
@@ -350,11 +347,6 @@ export const create_invoice = async (event, options) => {
|
|
|
350
347
|
}
|
|
351
348
|
} catch (e) {
|
|
352
349
|
console.error(e);
|
|
353
|
-
await actionLog
|
|
354
|
-
.addDetail(
|
|
355
|
-
`Failed updating integration_meta of Invoice: ${repzo_serial_number}`
|
|
356
|
-
)
|
|
357
|
-
.commit();
|
|
358
350
|
}
|
|
359
351
|
await actionLog
|
|
360
352
|
.addDetail(`SAP Responded with `, result)
|
|
@@ -34,18 +34,14 @@ export const create_payment = async (event, options) => {
|
|
|
34
34
|
(body === null || body === void 0 ? void 0 : body.integration_meta) ||
|
|
35
35
|
{};
|
|
36
36
|
body.integration_meta.sync_to_sap_started = true;
|
|
37
|
-
body.integration_meta.sync_to_sap_succeeded =
|
|
37
|
+
body.integration_meta.sync_to_sap_succeeded =
|
|
38
|
+
body.integration_meta.sync_to_sap_succeeded || false;
|
|
38
39
|
await repzo.payment.update(body._id, {
|
|
39
40
|
integration_meta: body.integration_meta,
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
} catch (e) {
|
|
43
44
|
console.error(e);
|
|
44
|
-
await actionLog
|
|
45
|
-
.addDetail(
|
|
46
|
-
`Failed updating integration_meta of Payment: ${repzo_serial_number}`
|
|
47
|
-
)
|
|
48
|
-
.commit();
|
|
49
45
|
}
|
|
50
46
|
await actionLog
|
|
51
47
|
.addDetail(
|
|
@@ -180,9 +176,10 @@ export const create_payment = async (event, options) => {
|
|
|
180
176
|
: _q.USERCASHACCOUNT;
|
|
181
177
|
}
|
|
182
178
|
// console.dir(sap_payment, { depth: null });
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
actionLog.addDetail(
|
|
180
|
+
`Repzo => SAP: Payment - ${repzo_serial_number}`,
|
|
181
|
+
sap_payment
|
|
182
|
+
);
|
|
186
183
|
const result = await _create(SAP_HOST_URL, "/AddPayment", sap_payment);
|
|
187
184
|
// console.log(result);
|
|
188
185
|
try {
|
|
@@ -197,11 +194,6 @@ export const create_payment = async (event, options) => {
|
|
|
197
194
|
}
|
|
198
195
|
} catch (e) {
|
|
199
196
|
console.error(e);
|
|
200
|
-
await actionLog
|
|
201
|
-
.addDetail(
|
|
202
|
-
`Failed updating integration_meta of Payment: ${repzo_serial_number}`
|
|
203
|
-
)
|
|
204
|
-
.commit();
|
|
205
197
|
}
|
|
206
198
|
await actionLog
|
|
207
199
|
.addDetail(`SAP Responded with `, result)
|
|
@@ -27,25 +27,19 @@ export const create_proforma = async (event, options) => {
|
|
|
27
27
|
null || _c === void 0
|
|
28
28
|
? void 0
|
|
29
29
|
: _c.formatted;
|
|
30
|
-
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
await actionLog
|
|
44
|
-
.addDetail(
|
|
45
|
-
`Failed updating integration_meta of SalesOrder: ${repzo_serial_number}`
|
|
46
|
-
)
|
|
47
|
-
.commit();
|
|
48
|
-
}
|
|
30
|
+
// try {
|
|
31
|
+
// if (body?._id) {
|
|
32
|
+
// body.integration_meta = body?.integration_meta || {};
|
|
33
|
+
// body.integration_meta.sync_to_sap_started = true;
|
|
34
|
+
// body.integration_meta.sync_to_sap_succeeded =
|
|
35
|
+
// body.integration_meta.sync_to_sap_succeeded || false;
|
|
36
|
+
// await repzo.proforma.update(body._id, {
|
|
37
|
+
// integration_meta: body.integration_meta,
|
|
38
|
+
// });
|
|
39
|
+
// }
|
|
40
|
+
// } catch (e) {
|
|
41
|
+
// console.error(e);
|
|
42
|
+
// }
|
|
49
43
|
await actionLog
|
|
50
44
|
.addDetail(
|
|
51
45
|
`SalesOrder - ${repzo_serial_number} => ${
|
|
@@ -274,32 +268,23 @@ export const create_proforma = async (event, options) => {
|
|
|
274
268
|
LinesDetails: items,
|
|
275
269
|
};
|
|
276
270
|
// console.dir(sap_invoice, { depth: null });
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
)
|
|
282
|
-
.commit();
|
|
271
|
+
actionLog.addDetail(
|
|
272
|
+
`Repzo => SAP: SalesOrder - ${repzo_serial_number}`,
|
|
273
|
+
sap_invoice
|
|
274
|
+
); // .commit();
|
|
283
275
|
const result = await _create(SAP_HOST_URL, "/AddOrder", sap_invoice);
|
|
284
276
|
// console.log(result);
|
|
285
|
-
try {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
console.error(e);
|
|
297
|
-
await actionLog
|
|
298
|
-
.addDetail(
|
|
299
|
-
`Failed updating integration_meta of SalesOrder: ${repzo_serial_number}`
|
|
300
|
-
)
|
|
301
|
-
.commit();
|
|
302
|
-
}
|
|
277
|
+
// try {
|
|
278
|
+
// if (body?._id) {
|
|
279
|
+
// body.integration_meta = body?.integration_meta || {};
|
|
280
|
+
// body.integration_meta.sync_to_sap_succeeded = true;
|
|
281
|
+
// await repzo.proforma.update(body._id, {
|
|
282
|
+
// integration_meta: body.integration_meta,
|
|
283
|
+
// });
|
|
284
|
+
// }
|
|
285
|
+
// } catch (e) {
|
|
286
|
+
// console.error(e);
|
|
287
|
+
// }
|
|
303
288
|
await actionLog
|
|
304
289
|
.addDetail(`SAP Responded with `, result)
|
|
305
290
|
.addDetail(`Repzo => SAP: SalesOrder - ${repzo_serial_number}`)
|
|
@@ -33,18 +33,14 @@ export const create_return_invoice = async (event, options) => {
|
|
|
33
33
|
(body === null || body === void 0 ? void 0 : body.integration_meta) ||
|
|
34
34
|
{};
|
|
35
35
|
body.integration_meta.sync_to_sap_started = true;
|
|
36
|
-
body.integration_meta.sync_to_sap_succeeded =
|
|
36
|
+
body.integration_meta.sync_to_sap_succeeded =
|
|
37
|
+
body.integration_meta.sync_to_sap_succeeded || false;
|
|
37
38
|
await repzo.invoice.update(body._id, {
|
|
38
39
|
integration_meta: body.integration_meta,
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
} catch (e) {
|
|
42
43
|
console.error(e);
|
|
43
|
-
await actionLog
|
|
44
|
-
.addDetail(
|
|
45
|
-
`Failed updating integration_meta of Return Invoice: ${repzo_serial_number}`
|
|
46
|
-
)
|
|
47
|
-
.commit();
|
|
48
44
|
}
|
|
49
45
|
await actionLog
|
|
50
46
|
.addDetail(
|
|
@@ -297,12 +293,10 @@ export const create_return_invoice = async (event, options) => {
|
|
|
297
293
|
LinesDetails: return_items,
|
|
298
294
|
};
|
|
299
295
|
// console.dir(sap_return_invoice, { depth: null });
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
)
|
|
305
|
-
.commit();
|
|
296
|
+
actionLog.addDetail(
|
|
297
|
+
`Repzo => SAP: Invoice - ${repzo_serial_number}`,
|
|
298
|
+
sap_return_invoice
|
|
299
|
+
);
|
|
306
300
|
const result = await _create(
|
|
307
301
|
SAP_HOST_URL,
|
|
308
302
|
"/AddCreditMemo",
|
|
@@ -321,11 +315,6 @@ export const create_return_invoice = async (event, options) => {
|
|
|
321
315
|
}
|
|
322
316
|
} catch (e) {
|
|
323
317
|
console.error(e);
|
|
324
|
-
await actionLog
|
|
325
|
-
.addDetail(
|
|
326
|
-
`Failed updating integration_meta of Return Invoice: ${repzo_serial_number}`
|
|
327
|
-
)
|
|
328
|
-
.commit();
|
|
329
318
|
}
|
|
330
319
|
await actionLog
|
|
331
320
|
.addDetail(`SAP Responded with `, result)
|
|
@@ -26,25 +26,19 @@ export const create_transfer = async (event, options) => {
|
|
|
26
26
|
null || _c === void 0
|
|
27
27
|
? void 0
|
|
28
28
|
: _c.formatted;
|
|
29
|
-
try {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
await actionLog
|
|
43
|
-
.addDetail(
|
|
44
|
-
`Failed updating integration_meta of Transfer: ${repzo_serial_number}`
|
|
45
|
-
)
|
|
46
|
-
.commit();
|
|
47
|
-
}
|
|
29
|
+
// try {
|
|
30
|
+
// if (body?._id) {
|
|
31
|
+
// body.integration_meta = body?.integration_meta || {};
|
|
32
|
+
// body.integration_meta.sync_to_sap_started = true;
|
|
33
|
+
// body.integration_meta.sync_to_sap_succeeded =
|
|
34
|
+
// body.integration_meta.sync_to_sap_succeeded || false;
|
|
35
|
+
// await repzo.transfer.update(body._id, {
|
|
36
|
+
// integration_meta: body.integration_meta,
|
|
37
|
+
// });
|
|
38
|
+
// }
|
|
39
|
+
// } catch (e) {
|
|
40
|
+
// console.error(e);
|
|
41
|
+
// }
|
|
48
42
|
await actionLog
|
|
49
43
|
.addDetail(
|
|
50
44
|
`Transfer - ${repzo_serial_number} => ${
|
|
@@ -177,12 +171,10 @@ export const create_transfer = async (event, options) => {
|
|
|
177
171
|
RepzoStockTransferLines: variants,
|
|
178
172
|
};
|
|
179
173
|
// console.dir(sap_transfer, { depth: null });
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
)
|
|
185
|
-
.commit();
|
|
174
|
+
actionLog.addDetail(
|
|
175
|
+
`Repzo => SAP: Transfer - ${repzo_serial_number}`,
|
|
176
|
+
sap_transfer
|
|
177
|
+
);
|
|
186
178
|
const result = await _create(
|
|
187
179
|
SAP_HOST_URL,
|
|
188
180
|
"/AddStockTransfer",
|
|
@@ -190,22 +182,15 @@ export const create_transfer = async (event, options) => {
|
|
|
190
182
|
);
|
|
191
183
|
// console.log(result);
|
|
192
184
|
try {
|
|
193
|
-
if (body
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
}
|
|
185
|
+
// if (body?._id) {
|
|
186
|
+
// body.integration_meta = body?.integration_meta || {};
|
|
187
|
+
// body.integration_meta.sync_to_sap_succeeded = true;
|
|
188
|
+
// await repzo.transfer.update(body._id, {
|
|
189
|
+
// integration_meta: body.integration_meta,
|
|
190
|
+
// });
|
|
191
|
+
// }
|
|
202
192
|
} catch (e) {
|
|
203
193
|
console.error(e);
|
|
204
|
-
await actionLog
|
|
205
|
-
.addDetail(
|
|
206
|
-
`Failed updating integration_meta of Transfer: ${repzo_serial_number}`
|
|
207
|
-
)
|
|
208
|
-
.commit();
|
|
209
194
|
}
|
|
210
195
|
await actionLog
|
|
211
196
|
.addDetail(`SAP Responded with `, result)
|
package/package.json
CHANGED
|
@@ -66,18 +66,14 @@ export const create_invoice = async (event: EVENT, options: Config) => {
|
|
|
66
66
|
if (body?._id) {
|
|
67
67
|
body.integration_meta = body?.integration_meta || {};
|
|
68
68
|
body.integration_meta.sync_to_sap_started = true;
|
|
69
|
-
body.integration_meta.sync_to_sap_succeeded =
|
|
69
|
+
body.integration_meta.sync_to_sap_succeeded =
|
|
70
|
+
body.integration_meta.sync_to_sap_succeeded || false;
|
|
70
71
|
await repzo.invoice.update(body._id, {
|
|
71
72
|
integration_meta: body.integration_meta,
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
} catch (e) {
|
|
75
76
|
console.error(e);
|
|
76
|
-
await actionLog
|
|
77
|
-
.addDetail(
|
|
78
|
-
`Failed updating integration_meta of Invoice: ${repzo_serial_number}`
|
|
79
|
-
)
|
|
80
|
-
.commit();
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
await actionLog
|
|
@@ -275,9 +271,10 @@ export const create_invoice = async (event: EVENT, options: Config) => {
|
|
|
275
271
|
|
|
276
272
|
// console.dir(sap_invoice, { depth: null });
|
|
277
273
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
274
|
+
actionLog.addDetail(
|
|
275
|
+
`Repzo => SAP: Invoice - ${repzo_serial_number}`,
|
|
276
|
+
sap_invoice
|
|
277
|
+
);
|
|
281
278
|
|
|
282
279
|
const result = await _create(SAP_HOST_URL, "/AddInvoice", sap_invoice);
|
|
283
280
|
|
|
@@ -293,11 +290,6 @@ export const create_invoice = async (event: EVENT, options: Config) => {
|
|
|
293
290
|
}
|
|
294
291
|
} catch (e) {
|
|
295
292
|
console.error(e);
|
|
296
|
-
await actionLog
|
|
297
|
-
.addDetail(
|
|
298
|
-
`Failed updating integration_meta of Invoice: ${repzo_serial_number}`
|
|
299
|
-
)
|
|
300
|
-
.commit();
|
|
301
293
|
}
|
|
302
294
|
|
|
303
295
|
await actionLog
|
|
@@ -41,18 +41,14 @@ export const create_payment = async (event: EVENT, options: Config) => {
|
|
|
41
41
|
if (body?._id) {
|
|
42
42
|
body.integration_meta = body?.integration_meta || {};
|
|
43
43
|
body.integration_meta.sync_to_sap_started = true;
|
|
44
|
-
body.integration_meta.sync_to_sap_succeeded =
|
|
44
|
+
body.integration_meta.sync_to_sap_succeeded =
|
|
45
|
+
body.integration_meta.sync_to_sap_succeeded || false;
|
|
45
46
|
await repzo.payment.update(body._id, {
|
|
46
47
|
integration_meta: body.integration_meta,
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
} catch (e) {
|
|
50
51
|
console.error(e);
|
|
51
|
-
await actionLog
|
|
52
|
-
.addDetail(
|
|
53
|
-
`Failed updating integration_meta of Payment: ${repzo_serial_number}`
|
|
54
|
-
)
|
|
55
|
-
.commit();
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
await actionLog
|
|
@@ -132,9 +128,10 @@ export const create_payment = async (event: EVENT, options: Config) => {
|
|
|
132
128
|
|
|
133
129
|
// console.dir(sap_payment, { depth: null });
|
|
134
130
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
actionLog.addDetail(
|
|
132
|
+
`Repzo => SAP: Payment - ${repzo_serial_number}`,
|
|
133
|
+
sap_payment
|
|
134
|
+
);
|
|
138
135
|
|
|
139
136
|
const result = await _create(SAP_HOST_URL, "/AddPayment", sap_payment);
|
|
140
137
|
|
|
@@ -150,11 +147,6 @@ export const create_payment = async (event: EVENT, options: Config) => {
|
|
|
150
147
|
}
|
|
151
148
|
} catch (e) {
|
|
152
149
|
console.error(e);
|
|
153
|
-
await actionLog
|
|
154
|
-
.addDetail(
|
|
155
|
-
`Failed updating integration_meta of Payment: ${repzo_serial_number}`
|
|
156
|
-
)
|
|
157
|
-
.commit();
|
|
158
150
|
}
|
|
159
151
|
|
|
160
152
|
await actionLog
|
|
@@ -44,23 +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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
`Failed updating integration_meta of SalesOrder: ${repzo_serial_number}`
|
|
61
|
-
)
|
|
62
|
-
.commit();
|
|
63
|
-
}
|
|
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
|
+
// }
|
|
64
60
|
|
|
65
61
|
await actionLog
|
|
66
62
|
.addDetail(`SalesOrder - ${repzo_serial_number} => ${body?.sync_id}`)
|
|
@@ -203,33 +199,26 @@ export const create_proforma = async (event: EVENT, options: Config) => {
|
|
|
203
199
|
|
|
204
200
|
// console.dir(sap_invoice, { depth: null });
|
|
205
201
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
)
|
|
211
|
-
.commit();
|
|
202
|
+
actionLog.addDetail(
|
|
203
|
+
`Repzo => SAP: SalesOrder - ${repzo_serial_number}`,
|
|
204
|
+
sap_invoice
|
|
205
|
+
); // .commit();
|
|
212
206
|
|
|
213
207
|
const result = await _create(SAP_HOST_URL, "/AddOrder", sap_invoice);
|
|
214
208
|
|
|
215
209
|
// console.log(result);
|
|
216
210
|
|
|
217
|
-
try {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
} catch (e) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
.addDetail(
|
|
229
|
-
`Failed updating integration_meta of SalesOrder: ${repzo_serial_number}`
|
|
230
|
-
)
|
|
231
|
-
.commit();
|
|
232
|
-
}
|
|
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
|
+
// }
|
|
233
222
|
|
|
234
223
|
await actionLog
|
|
235
224
|
.addDetail(`SAP Responded with `, result)
|
|
@@ -56,18 +56,14 @@ export const create_return_invoice = async (event: EVENT, options: Config) => {
|
|
|
56
56
|
if (body?._id) {
|
|
57
57
|
body.integration_meta = body?.integration_meta || {};
|
|
58
58
|
body.integration_meta.sync_to_sap_started = true;
|
|
59
|
-
body.integration_meta.sync_to_sap_succeeded =
|
|
59
|
+
body.integration_meta.sync_to_sap_succeeded =
|
|
60
|
+
body.integration_meta.sync_to_sap_succeeded || false;
|
|
60
61
|
await repzo.invoice.update(body._id, {
|
|
61
62
|
integration_meta: body.integration_meta,
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
} catch (e) {
|
|
65
66
|
console.error(e);
|
|
66
|
-
await actionLog
|
|
67
|
-
.addDetail(
|
|
68
|
-
`Failed updating integration_meta of Return Invoice: ${repzo_serial_number}`
|
|
69
|
-
)
|
|
70
|
-
.commit();
|
|
71
67
|
}
|
|
72
68
|
|
|
73
69
|
await actionLog
|
|
@@ -230,12 +226,10 @@ export const create_return_invoice = async (event: EVENT, options: Config) => {
|
|
|
230
226
|
|
|
231
227
|
// console.dir(sap_return_invoice, { depth: null });
|
|
232
228
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
)
|
|
238
|
-
.commit();
|
|
229
|
+
actionLog.addDetail(
|
|
230
|
+
`Repzo => SAP: Invoice - ${repzo_serial_number}`,
|
|
231
|
+
sap_return_invoice
|
|
232
|
+
);
|
|
239
233
|
|
|
240
234
|
const result = await _create(
|
|
241
235
|
SAP_HOST_URL,
|
|
@@ -255,11 +249,6 @@ export const create_return_invoice = async (event: EVENT, options: Config) => {
|
|
|
255
249
|
}
|
|
256
250
|
} catch (e) {
|
|
257
251
|
console.error(e);
|
|
258
|
-
await actionLog
|
|
259
|
-
.addDetail(
|
|
260
|
-
`Failed updating integration_meta of Return Invoice: ${repzo_serial_number}`
|
|
261
|
-
)
|
|
262
|
-
.commit();
|
|
263
252
|
}
|
|
264
253
|
|
|
265
254
|
await actionLog
|
|
@@ -41,23 +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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`Failed updating integration_meta of Transfer: ${repzo_serial_number}`
|
|
58
|
-
)
|
|
59
|
-
.commit();
|
|
60
|
-
}
|
|
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
|
+
// }
|
|
61
57
|
|
|
62
58
|
await actionLog
|
|
63
59
|
.addDetail(`Transfer - ${repzo_serial_number} => ${body?.sync_id}`)
|
|
@@ -160,12 +156,10 @@ export const create_transfer = async (event: EVENT, options: Config) => {
|
|
|
160
156
|
|
|
161
157
|
// console.dir(sap_transfer, { depth: null });
|
|
162
158
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
)
|
|
168
|
-
.commit();
|
|
159
|
+
actionLog.addDetail(
|
|
160
|
+
`Repzo => SAP: Transfer - ${repzo_serial_number}`,
|
|
161
|
+
sap_transfer
|
|
162
|
+
);
|
|
169
163
|
|
|
170
164
|
const result = await _create(
|
|
171
165
|
SAP_HOST_URL,
|
|
@@ -175,20 +169,15 @@ export const create_transfer = async (event: EVENT, options: Config) => {
|
|
|
175
169
|
|
|
176
170
|
// console.log(result);
|
|
177
171
|
try {
|
|
178
|
-
if (body?._id) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
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
|
+
// }
|
|
185
179
|
} catch (e) {
|
|
186
180
|
console.error(e);
|
|
187
|
-
await actionLog
|
|
188
|
-
.addDetail(
|
|
189
|
-
`Failed updating integration_meta of Transfer: ${repzo_serial_number}`
|
|
190
|
-
)
|
|
191
|
-
.commit();
|
|
192
181
|
}
|
|
193
182
|
|
|
194
183
|
await actionLog
|