repzo-sap-absjo 1.0.1

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 (157) hide show
  1. package/README.md +3 -0
  2. package/changelog.md +17 -0
  3. package/lib/actions/create_invoice.d.ts +26 -0
  4. package/lib/actions/create_invoice.js +311 -0
  5. package/lib/actions/create_payment.d.ts +5 -0
  6. package/lib/actions/create_payment.js +177 -0
  7. package/lib/actions/create_proforma.d.ts +5 -0
  8. package/lib/actions/create_proforma.js +241 -0
  9. package/lib/actions/create_return_invoice.d.ts +5 -0
  10. package/lib/actions/create_return_invoice.js +268 -0
  11. package/lib/actions/create_transfer.d.ts +5 -0
  12. package/lib/actions/create_transfer.js +171 -0
  13. package/lib/actions/index.d.ts +3 -0
  14. package/lib/actions/index.js +31 -0
  15. package/lib/commands/adjust_inventory.d.ts +6 -0
  16. package/lib/commands/adjust_inventory.js +303 -0
  17. package/lib/commands/bank.d.ts +7 -0
  18. package/lib/commands/bank.js +301 -0
  19. package/lib/commands/basic.d.ts +2 -0
  20. package/lib/commands/basic.js +73 -0
  21. package/lib/commands/category.d.ts +4 -0
  22. package/lib/commands/category.js +193 -0
  23. package/lib/commands/channel.d.ts +4 -0
  24. package/lib/commands/channel.js +213 -0
  25. package/lib/commands/client.d.ts +39 -0
  26. package/lib/commands/client.js +410 -0
  27. package/lib/commands/client_disabled.d.ts +4 -0
  28. package/lib/commands/client_disabled.js +183 -0
  29. package/lib/commands/index.d.ts +23 -0
  30. package/lib/commands/index.js +82 -0
  31. package/lib/commands/join.d.ts +2 -0
  32. package/lib/commands/join.js +134 -0
  33. package/lib/commands/measureunit.d.ts +23 -0
  34. package/lib/commands/measureunit.js +314 -0
  35. package/lib/commands/measureunit_family.d.ts +12 -0
  36. package/lib/commands/measureunit_family.js +263 -0
  37. package/lib/commands/payment_term.d.ts +4 -0
  38. package/lib/commands/payment_term.js +217 -0
  39. package/lib/commands/price_list.d.ts +18 -0
  40. package/lib/commands/price_list.js +608 -0
  41. package/lib/commands/product.d.ts +39 -0
  42. package/lib/commands/product.js +454 -0
  43. package/lib/commands/product_disabled.d.ts +4 -0
  44. package/lib/commands/product_disabled.js +178 -0
  45. package/lib/commands/rep.d.ts +2 -0
  46. package/lib/commands/rep.js +246 -0
  47. package/lib/commands/tag.d.ts +2 -0
  48. package/lib/commands/tag.js +195 -0
  49. package/lib/commands/tax.d.ts +2 -0
  50. package/lib/commands/tax.js +198 -0
  51. package/lib/commands/warehouse.d.ts +4 -0
  52. package/lib/commands/warehouse.js +221 -0
  53. package/lib/index.d.ts +29 -0
  54. package/lib/index.js +6 -0
  55. package/lib/test/actions/create_invoice.d.ts +1 -0
  56. package/lib/test/actions/create_invoice.js +214 -0
  57. package/lib/test/actions/create_payment.d.ts +1 -0
  58. package/lib/test/actions/create_payment.js +131 -0
  59. package/lib/test/actions/create_proforma.d.ts +1 -0
  60. package/lib/test/actions/create_proforma.js +242 -0
  61. package/lib/test/actions/create_return_invoice.d.ts +1 -0
  62. package/lib/test/actions/create_return_invoice.js +226 -0
  63. package/lib/test/actions/create_transfer.d.ts +1 -0
  64. package/lib/test/actions/create_transfer.js +142 -0
  65. package/lib/test/commands/adjust_inventory.d.ts +1 -0
  66. package/lib/test/commands/adjust_inventory.js +97 -0
  67. package/lib/test/commands/bank.d.ts +1 -0
  68. package/lib/test/commands/bank.js +97 -0
  69. package/lib/test/commands/basic.d.ts +1 -0
  70. package/lib/test/commands/basic.js +339 -0
  71. package/lib/test/commands/category.d.ts +1 -0
  72. package/lib/test/commands/category.js +97 -0
  73. package/lib/test/commands/channel.d.ts +1 -0
  74. package/lib/test/commands/channel.js +97 -0
  75. package/lib/test/commands/client.d.ts +1 -0
  76. package/lib/test/commands/client.js +97 -0
  77. package/lib/test/commands/client_disabled.d.ts +1 -0
  78. package/lib/test/commands/client_disabled.js +97 -0
  79. package/lib/test/commands/join.d.ts +1 -0
  80. package/lib/test/commands/join.js +339 -0
  81. package/lib/test/commands/measureunit.d.ts +1 -0
  82. package/lib/test/commands/measureunit.js +97 -0
  83. package/lib/test/commands/measureunit_family.d.ts +1 -0
  84. package/lib/test/commands/measureunit_family.js +97 -0
  85. package/lib/test/commands/payment_term.d.ts +1 -0
  86. package/lib/test/commands/payment_term.js +97 -0
  87. package/lib/test/commands/price_list.d.ts +1 -0
  88. package/lib/test/commands/price_list.js +97 -0
  89. package/lib/test/commands/product.d.ts +1 -0
  90. package/lib/test/commands/product.js +97 -0
  91. package/lib/test/commands/product_disabled.d.ts +1 -0
  92. package/lib/test/commands/product_disabled.js +97 -0
  93. package/lib/test/commands/rep.d.ts +1 -0
  94. package/lib/test/commands/rep.js +97 -0
  95. package/lib/test/commands/tag.d.ts +1 -0
  96. package/lib/test/commands/tag.js +97 -0
  97. package/lib/test/commands/tax.d.ts +1 -0
  98. package/lib/test/commands/tax.js +97 -0
  99. package/lib/test/commands/warehouse.d.ts +1 -0
  100. package/lib/test/commands/warehouse.js +97 -0
  101. package/lib/types.d.ts +77 -0
  102. package/lib/types.js +1 -0
  103. package/lib/util.d.ts +70 -0
  104. package/lib/util.js +164 -0
  105. package/package.json +51 -0
  106. package/src/actions/create_invoice.ts +275 -0
  107. package/src/actions/create_payment.ts +138 -0
  108. package/src/actions/create_proforma.ts +187 -0
  109. package/src/actions/create_return_invoice.ts +217 -0
  110. package/src/actions/create_transfer.ts +160 -0
  111. package/src/actions/index.ts +27 -0
  112. package/src/commands/adjust_inventory.ts +250 -0
  113. package/src/commands/bank.ts +243 -0
  114. package/src/commands/basic.ts +64 -0
  115. package/src/commands/category.ts +176 -0
  116. package/src/commands/channel.ts +219 -0
  117. package/src/commands/client.ts +368 -0
  118. package/src/commands/client_disabled.ts +158 -0
  119. package/src/commands/index.ts +87 -0
  120. package/src/commands/join.ts +80 -0
  121. package/src/commands/measureunit.ts +276 -0
  122. package/src/commands/measureunit_family.ts +209 -0
  123. package/src/commands/payment_term.ts +224 -0
  124. package/src/commands/price_list.ts +434 -0
  125. package/src/commands/product.ts +359 -0
  126. package/src/commands/product_disabled.ts +152 -0
  127. package/src/commands/rep.ts +209 -0
  128. package/src/commands/tag.ts +173 -0
  129. package/src/commands/tax.ts +178 -0
  130. package/src/commands/warehouse.ts +204 -0
  131. package/src/index.ts +7 -0
  132. package/src/test/actions/create_invoice.ts +214 -0
  133. package/src/test/actions/create_payment.ts +131 -0
  134. package/src/test/actions/create_proforma.ts +242 -0
  135. package/src/test/actions/create_return_invoice.ts +226 -0
  136. package/src/test/actions/create_transfer.ts +142 -0
  137. package/src/test/commands/adjust_inventory.ts +100 -0
  138. package/src/test/commands/bank.ts +100 -0
  139. package/src/test/commands/basic.ts +342 -0
  140. package/src/test/commands/category.ts +100 -0
  141. package/src/test/commands/channel.ts +100 -0
  142. package/src/test/commands/client.ts +100 -0
  143. package/src/test/commands/client_disabled.ts +100 -0
  144. package/src/test/commands/join.ts +342 -0
  145. package/src/test/commands/measureunit.ts +100 -0
  146. package/src/test/commands/measureunit_family.ts +100 -0
  147. package/src/test/commands/payment_term.ts +100 -0
  148. package/src/test/commands/price_list.ts +100 -0
  149. package/src/test/commands/product.ts +100 -0
  150. package/src/test/commands/product_disabled.ts +100 -0
  151. package/src/test/commands/rep.ts +100 -0
  152. package/src/test/commands/tag.ts +100 -0
  153. package/src/test/commands/tax.ts +100 -0
  154. package/src/test/commands/warehouse.ts +100 -0
  155. package/src/types.ts +76 -0
  156. package/src/util.ts +205 -0
  157. package/tsconfig.json +15 -0
@@ -0,0 +1,73 @@
1
+ import Repzo from "repzo";
2
+ import { commands, commandsList } from "./index.js";
3
+ export const basic = async (commandEvent) => {
4
+ var _a, _b;
5
+ const repzo = new Repzo(
6
+ (_a = commandEvent.app.formData) === null || _a === void 0
7
+ ? void 0
8
+ : _a.repzoApiKey,
9
+ {
10
+ env: commandEvent.env,
11
+ }
12
+ );
13
+ const commandLog = new Repzo.CommandLog(
14
+ repzo,
15
+ commandEvent.app,
16
+ commandEvent.command
17
+ );
18
+ try {
19
+ console.log("basic sync");
20
+ await commandLog.load(commandEvent.sync_id);
21
+ await commandLog.addDetail("Repzo SAP: Basic Sync").commit();
22
+ const required_syncing_commands = [
23
+ "join",
24
+ "warehouse",
25
+ "rep",
26
+ "tax",
27
+ "tag",
28
+ "measureunit",
29
+ "measureunit_family",
30
+ "category",
31
+ "channel",
32
+ "payment_term",
33
+ "bank",
34
+ "product",
35
+ "disabled_product",
36
+ "price_list",
37
+ "client",
38
+ "disabled_client",
39
+ ];
40
+ for (let i = 0; i < required_syncing_commands.length; i++) {
41
+ const command = required_syncing_commands[i];
42
+ const commandDes = commandsList.find((c) => c.command == command);
43
+ const event = JSON.parse(JSON.stringify(commandEvent));
44
+ event.command = command;
45
+ await commandLog
46
+ .addDetail(
47
+ `Start Syncing: ${
48
+ (commandDes === null || commandDes === void 0
49
+ ? void 0
50
+ : commandDes.name) || command
51
+ }`
52
+ )
53
+ .commit();
54
+ await commands(event);
55
+ await commandLog.load(commandEvent.sync_id);
56
+ }
57
+ await commandLog
58
+ .setStatus("success")
59
+ .setBody({ message: "Basic Sync: Completed" })
60
+ .commit();
61
+ } catch (e) {
62
+ //@ts-ignore
63
+ console.error(
64
+ ((_b = e === null || e === void 0 ? void 0 : e.response) === null ||
65
+ _b === void 0
66
+ ? void 0
67
+ : _b.data) || e
68
+ );
69
+ await commandLog.load(commandEvent.sync_id);
70
+ await commandLog.setStatus("fail", e).commit();
71
+ throw e;
72
+ }
73
+ };
@@ -0,0 +1,4 @@
1
+ import { CommandEvent, Result } from "../types";
2
+ export declare const sync_category: (
3
+ commandEvent: CommandEvent
4
+ ) => Promise<Result>;
@@ -0,0 +1,193 @@
1
+ import Repzo from "repzo";
2
+ import { _create, update_bench_time, set_error } from "../util.js";
3
+ export const sync_category = async (commandEvent) => {
4
+ var _a, _b, _c, _d, _e, _f, _g;
5
+ const repzo = new Repzo(
6
+ (_a = commandEvent.app.formData) === null || _a === void 0
7
+ ? void 0
8
+ : _a.repzoApiKey,
9
+ {
10
+ env: commandEvent.env,
11
+ }
12
+ );
13
+ const commandLog = new Repzo.CommandLog(
14
+ repzo,
15
+ commandEvent.app,
16
+ commandEvent.command
17
+ );
18
+ try {
19
+ console.log("sync_category");
20
+ const new_bench_time = new Date().toISOString();
21
+ const bench_time_key = "bench_time_category";
22
+ await commandLog.load(commandEvent.sync_id);
23
+ await commandLog
24
+ .addDetail("Repzo SAP: Started Syncing Product Categories")
25
+ .commit();
26
+ const nameSpace = commandEvent.nameSpace.join("_");
27
+ const result = {
28
+ sap_total: 0,
29
+ repzo_total: 0,
30
+ created: 0,
31
+ updated: 0,
32
+ failed: 0,
33
+ };
34
+ const failed_docs_report = [];
35
+ const sap_categories = await get_sap_categories(
36
+ commandEvent.app.formData.sapHostUrl,
37
+ {}
38
+ );
39
+ result.sap_total =
40
+ sap_categories === null || sap_categories === void 0
41
+ ? void 0
42
+ : sap_categories.length;
43
+ await commandLog
44
+ .addDetail(`${result.sap_total} Item Groups in SAP`)
45
+ .commit();
46
+ const repzo_categories = await repzo.category.find({
47
+ per_page: 50000,
48
+ });
49
+ result.repzo_total =
50
+ (_b =
51
+ repzo_categories === null || repzo_categories === void 0
52
+ ? void 0
53
+ : repzo_categories.data) === null || _b === void 0
54
+ ? void 0
55
+ : _b.length;
56
+ await commandLog
57
+ .addDetail(
58
+ `${
59
+ (_c =
60
+ repzo_categories === null || repzo_categories === void 0
61
+ ? void 0
62
+ : repzo_categories.data) === null || _c === void 0
63
+ ? void 0
64
+ : _c.length
65
+ } Product Category in Repzo`
66
+ )
67
+ .commit();
68
+ for (
69
+ let i = 0;
70
+ i <
71
+ (sap_categories === null || sap_categories === void 0
72
+ ? void 0
73
+ : sap_categories.length);
74
+ i++
75
+ ) {
76
+ const sap_category = sap_categories[i];
77
+ const repzo_category = repzo_categories.data.find((r_cat) => {
78
+ var _a;
79
+ return (
80
+ ((_a = r_cat.integration_meta) === null || _a === void 0
81
+ ? void 0
82
+ : _a.id) == `${nameSpace}_${sap_category.GROUPCODE}`
83
+ );
84
+ });
85
+ const body = {
86
+ name: sap_category.GROUPDESC,
87
+ disabled: false,
88
+ integration_meta: { id: `${nameSpace}_${sap_category.GROUPCODE}` },
89
+ company_namespace: [nameSpace],
90
+ };
91
+ if (!repzo_category) {
92
+ // Create
93
+ try {
94
+ const created_category = await repzo.category.create(body);
95
+ result.created++;
96
+ } catch (e) {
97
+ console.log(
98
+ "Create Product Category Failed >> ",
99
+ e === null || e === void 0 ? void 0 : e.response,
100
+ body
101
+ );
102
+ failed_docs_report.push({
103
+ method: "create",
104
+ doc: body,
105
+ error_message: set_error(e),
106
+ });
107
+ result.failed++;
108
+ }
109
+ } else {
110
+ if (
111
+ ((_d =
112
+ repzo_category === null || repzo_category === void 0
113
+ ? void 0
114
+ : repzo_category.integration_meta) === null || _d === void 0
115
+ ? void 0
116
+ : _d.id) ==
117
+ ((_e =
118
+ body === null || body === void 0
119
+ ? void 0
120
+ : body.integration_meta) === null || _e === void 0
121
+ ? void 0
122
+ : _e.id) &&
123
+ (repzo_category === null || repzo_category === void 0
124
+ ? void 0
125
+ : repzo_category.name) ==
126
+ (body === null || body === void 0 ? void 0 : body.name)
127
+ ) {
128
+ continue;
129
+ }
130
+ // Update
131
+ try {
132
+ const updated_category = await repzo.category.update(
133
+ repzo_category._id,
134
+ body
135
+ );
136
+ result.updated++;
137
+ } catch (e) {
138
+ console.log(
139
+ "Update Product Category Failed >> ",
140
+ (_f = e === null || e === void 0 ? void 0 : e.response) === null ||
141
+ _f === void 0
142
+ ? void 0
143
+ : _f.data,
144
+ body
145
+ );
146
+ failed_docs_report.push({
147
+ method: "update",
148
+ doc_id:
149
+ repzo_category === null || repzo_category === void 0
150
+ ? void 0
151
+ : repzo_category._id,
152
+ doc: body,
153
+ error_message: set_error(e),
154
+ });
155
+ result.failed++;
156
+ }
157
+ }
158
+ }
159
+ // console.log(result);
160
+ await update_bench_time(
161
+ repzo,
162
+ commandEvent.app._id,
163
+ bench_time_key,
164
+ new_bench_time
165
+ );
166
+ await commandLog
167
+ .setStatus(
168
+ "success",
169
+ failed_docs_report.length ? failed_docs_report : null
170
+ )
171
+ .setBody(result)
172
+ .commit();
173
+ return result;
174
+ } catch (e) {
175
+ //@ts-ignore
176
+ console.error(
177
+ ((_g = e === null || e === void 0 ? void 0 : e.response) === null ||
178
+ _g === void 0
179
+ ? void 0
180
+ : _g.data) || e
181
+ );
182
+ await commandLog.setStatus("fail", e).commit();
183
+ throw e;
184
+ }
185
+ };
186
+ const get_sap_categories = async (serviceEndPoint, query) => {
187
+ try {
188
+ const sap_categories = await _create(serviceEndPoint, "/ItemGroup", {});
189
+ return sap_categories.ItemGroup;
190
+ } catch (e) {
191
+ throw e;
192
+ }
193
+ };
@@ -0,0 +1,4 @@
1
+ import { CommandEvent, Result } from "../types";
2
+ export declare const sync_channel: (
3
+ commandEvent: CommandEvent
4
+ ) => Promise<Result>;
@@ -0,0 +1,213 @@
1
+ import Repzo from "repzo";
2
+ import {
3
+ _create,
4
+ update_bench_time,
5
+ date_formatting,
6
+ set_error,
7
+ } from "../util.js";
8
+ export const sync_channel = async (commandEvent) => {
9
+ var _a, _b, _c, _d, _e;
10
+ const repzo = new Repzo(
11
+ (_a = commandEvent.app.formData) === null || _a === void 0
12
+ ? void 0
13
+ : _a.repzoApiKey,
14
+ {
15
+ env: commandEvent.env,
16
+ }
17
+ );
18
+ const commandLog = new Repzo.CommandLog(
19
+ repzo,
20
+ commandEvent.app,
21
+ commandEvent.command
22
+ );
23
+ try {
24
+ console.log("sync_channel");
25
+ const new_bench_time = new Date().toISOString();
26
+ const bench_time_key = "bench_time_channel";
27
+ await commandLog.load(commandEvent.sync_id);
28
+ await commandLog
29
+ .addDetail("Repzo SAP: Started Syncing Client Channels")
30
+ .commit();
31
+ const nameSpace = commandEvent.nameSpace.join("_");
32
+ const result = {
33
+ sap_total: 0,
34
+ repzo_total: 0,
35
+ created: 0,
36
+ updated: 0,
37
+ failed: 0,
38
+ };
39
+ const failed_docs_report = [];
40
+ const sap_clients = await get_sap_clients(
41
+ commandEvent.app.formData.sapHostUrl,
42
+ {
43
+ updateAt: commandEvent.app.options_formData[bench_time_key],
44
+ GroupCode: commandEvent.app.formData.GroupCode,
45
+ }
46
+ );
47
+ const sap_unique_channels = {};
48
+ sap_clients === null || sap_clients === void 0
49
+ ? void 0
50
+ : sap_clients.forEach((client) => {
51
+ const channel = client.CLIENTGROUP;
52
+ sap_unique_channels[channel] = true;
53
+ });
54
+ const sap_channels = Object.keys(sap_unique_channels);
55
+ result.sap_total =
56
+ sap_channels === null || sap_channels === void 0
57
+ ? void 0
58
+ : sap_channels.length;
59
+ await commandLog
60
+ .addDetail(
61
+ `${result.sap_total} Client Channels in SAP changed since ${
62
+ commandEvent.app.options_formData[bench_time_key] || "ever"
63
+ }`
64
+ )
65
+ .commit();
66
+ const repzo_channels = await repzo.channel.find({ per_page: 50000 });
67
+ result.repzo_total =
68
+ (_b =
69
+ repzo_channels === null || repzo_channels === void 0
70
+ ? void 0
71
+ : repzo_channels.data) === null || _b === void 0
72
+ ? void 0
73
+ : _b.length;
74
+ await commandLog
75
+ .addDetail(
76
+ `${
77
+ (_c =
78
+ repzo_channels === null || repzo_channels === void 0
79
+ ? void 0
80
+ : repzo_channels.data) === null || _c === void 0
81
+ ? void 0
82
+ : _c.length
83
+ } Client Channels in Repzo`
84
+ )
85
+ .commit();
86
+ for (
87
+ let i = 0;
88
+ i <
89
+ (sap_channels === null || sap_channels === void 0
90
+ ? void 0
91
+ : sap_channels.length);
92
+ i++
93
+ ) {
94
+ const sap_channel = sap_channels[i];
95
+ const repzo_channel = repzo_channels.data.find((r_channel) => {
96
+ var _a;
97
+ return (
98
+ ((_a = r_channel.integration_meta) === null || _a === void 0
99
+ ? void 0
100
+ : _a.id) == `${nameSpace}_${sap_channel}`
101
+ );
102
+ });
103
+ const body = {
104
+ name: sap_channel,
105
+ disabled: false,
106
+ integration_meta: {
107
+ id: `${nameSpace}_${sap_channel}`,
108
+ },
109
+ company_namespace: [nameSpace],
110
+ };
111
+ if (!repzo_channel) {
112
+ // Create
113
+ try {
114
+ const created_channel = await repzo.channel.create(body);
115
+ result.created++;
116
+ } catch (e) {
117
+ console.log(
118
+ "Create Client Channel Failed >> ",
119
+ e === null || e === void 0 ? void 0 : e.response,
120
+ body
121
+ );
122
+ failed_docs_report.push({
123
+ method: "create",
124
+ doc: body,
125
+ error_message: set_error(e),
126
+ });
127
+ result.failed++;
128
+ }
129
+ } else {
130
+ if (
131
+ (repzo_channel === null || repzo_channel === void 0
132
+ ? void 0
133
+ : repzo_channel.name) ==
134
+ (body === null || body === void 0 ? void 0 : body.name) &&
135
+ (repzo_channel === null || repzo_channel === void 0
136
+ ? void 0
137
+ : repzo_channel.disabled) ==
138
+ (body === null || body === void 0 ? void 0 : body.disabled)
139
+ )
140
+ continue;
141
+ // Update
142
+ try {
143
+ const updated_channel = await repzo.channel.update(
144
+ repzo_channel._id,
145
+ body
146
+ );
147
+ result.updated++;
148
+ } catch (e) {
149
+ console.log(
150
+ "Update Client Channel Failed >> ",
151
+ (_d = e === null || e === void 0 ? void 0 : e.response) === null ||
152
+ _d === void 0
153
+ ? void 0
154
+ : _d.data,
155
+ body
156
+ );
157
+ failed_docs_report.push({
158
+ method: "update",
159
+ doc_id:
160
+ repzo_channel === null || repzo_channel === void 0
161
+ ? void 0
162
+ : repzo_channel._id,
163
+ doc: body,
164
+ error_message: set_error(e),
165
+ });
166
+ result.failed++;
167
+ }
168
+ }
169
+ }
170
+ // console.log(result);
171
+ await update_bench_time(
172
+ repzo,
173
+ commandEvent.app._id,
174
+ bench_time_key,
175
+ new_bench_time
176
+ );
177
+ await commandLog
178
+ .setStatus(
179
+ "success",
180
+ failed_docs_report.length ? failed_docs_report : null
181
+ )
182
+ .setBody(result)
183
+ .commit();
184
+ return result;
185
+ } catch (e) {
186
+ //@ts-ignore
187
+ console.error(
188
+ ((_e = e === null || e === void 0 ? void 0 : e.response) === null ||
189
+ _e === void 0
190
+ ? void 0
191
+ : _e.data) || e
192
+ );
193
+ await commandLog.setStatus("fail", e).commit();
194
+ throw e;
195
+ }
196
+ };
197
+ const get_sap_clients = async (serviceEndPoint, query) => {
198
+ try {
199
+ const sap_clients = await _create(serviceEndPoint, "/Customers", {
200
+ Active: "Y",
201
+ Frozen: "N",
202
+ UpdateAt: date_formatting(
203
+ query === null || query === void 0 ? void 0 : query.updateAt,
204
+ "YYYYMMDD:HHmmss"
205
+ ),
206
+ GroupCode:
207
+ (query === null || query === void 0 ? void 0 : query.GroupCode) || "",
208
+ });
209
+ return sap_clients.Customers;
210
+ } catch (e) {
211
+ throw e;
212
+ }
213
+ };
@@ -0,0 +1,39 @@
1
+ import { CommandEvent, Result } from "../types";
2
+ export interface SAPClient {
3
+ CLIENTID: string;
4
+ CLIENTDESC: string;
5
+ CLIENTADDRESS?: string;
6
+ CLIENTCITY?: string;
7
+ CLIENTCOUNTRY?: string;
8
+ CLIENTCOUNTY?: string;
9
+ CLIENTGROUPCODE: number;
10
+ CLIENTGROUP: string;
11
+ PAYMENTTERM: number;
12
+ CLIENTCONTACTPERSON?: string;
13
+ CLIENTPHONE1?: string;
14
+ CLIENTPHONE2?: string;
15
+ CLIENTNOTE?: string;
16
+ CLIENTSTATUS: "N" | "Y";
17
+ CLIENTCREDITCONSUMED: number;
18
+ CLIENTMAXCHEQUEVALUE: number;
19
+ CLIENTCREDITLIMIT: number;
20
+ CLIENTPRICELISTID: number;
21
+ CLIENTADDRESSID?: string;
22
+ CLIENTDESCF?: string;
23
+ SALESPERSONCODE: number;
24
+ DISCOUNTPERCENT: number;
25
+ ACTIVE: "N" | "Y";
26
+ FROZEN: "N" | "Y";
27
+ TERRITORYID?: string;
28
+ TERRITORYNAME?: string;
29
+ CREATEDATE: string;
30
+ UPDATEDATE: string;
31
+ PARENTCODE?: string;
32
+ }
33
+ export interface SAPClients {
34
+ result: "Success";
35
+ Customers: SAPClient[];
36
+ }
37
+ export declare const sync_client: (
38
+ commandEvent: CommandEvent
39
+ ) => Promise<Result>;