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.
- package/README.md +3 -0
- package/changelog.md +17 -0
- package/lib/actions/create_invoice.d.ts +26 -0
- package/lib/actions/create_invoice.js +311 -0
- package/lib/actions/create_payment.d.ts +5 -0
- package/lib/actions/create_payment.js +177 -0
- package/lib/actions/create_proforma.d.ts +5 -0
- package/lib/actions/create_proforma.js +241 -0
- package/lib/actions/create_return_invoice.d.ts +5 -0
- package/lib/actions/create_return_invoice.js +268 -0
- package/lib/actions/create_transfer.d.ts +5 -0
- package/lib/actions/create_transfer.js +171 -0
- package/lib/actions/index.d.ts +3 -0
- package/lib/actions/index.js +31 -0
- package/lib/commands/adjust_inventory.d.ts +6 -0
- package/lib/commands/adjust_inventory.js +303 -0
- package/lib/commands/bank.d.ts +7 -0
- package/lib/commands/bank.js +301 -0
- package/lib/commands/basic.d.ts +2 -0
- package/lib/commands/basic.js +73 -0
- package/lib/commands/category.d.ts +4 -0
- package/lib/commands/category.js +193 -0
- package/lib/commands/channel.d.ts +4 -0
- package/lib/commands/channel.js +213 -0
- package/lib/commands/client.d.ts +39 -0
- package/lib/commands/client.js +410 -0
- package/lib/commands/client_disabled.d.ts +4 -0
- package/lib/commands/client_disabled.js +183 -0
- package/lib/commands/index.d.ts +23 -0
- package/lib/commands/index.js +82 -0
- package/lib/commands/join.d.ts +2 -0
- package/lib/commands/join.js +134 -0
- package/lib/commands/measureunit.d.ts +23 -0
- package/lib/commands/measureunit.js +314 -0
- package/lib/commands/measureunit_family.d.ts +12 -0
- package/lib/commands/measureunit_family.js +263 -0
- package/lib/commands/payment_term.d.ts +4 -0
- package/lib/commands/payment_term.js +217 -0
- package/lib/commands/price_list.d.ts +18 -0
- package/lib/commands/price_list.js +608 -0
- package/lib/commands/product.d.ts +39 -0
- package/lib/commands/product.js +454 -0
- package/lib/commands/product_disabled.d.ts +4 -0
- package/lib/commands/product_disabled.js +178 -0
- package/lib/commands/rep.d.ts +2 -0
- package/lib/commands/rep.js +246 -0
- package/lib/commands/tag.d.ts +2 -0
- package/lib/commands/tag.js +195 -0
- package/lib/commands/tax.d.ts +2 -0
- package/lib/commands/tax.js +198 -0
- package/lib/commands/warehouse.d.ts +4 -0
- package/lib/commands/warehouse.js +221 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.js +6 -0
- package/lib/test/actions/create_invoice.d.ts +1 -0
- package/lib/test/actions/create_invoice.js +214 -0
- package/lib/test/actions/create_payment.d.ts +1 -0
- package/lib/test/actions/create_payment.js +131 -0
- package/lib/test/actions/create_proforma.d.ts +1 -0
- package/lib/test/actions/create_proforma.js +242 -0
- package/lib/test/actions/create_return_invoice.d.ts +1 -0
- package/lib/test/actions/create_return_invoice.js +226 -0
- package/lib/test/actions/create_transfer.d.ts +1 -0
- package/lib/test/actions/create_transfer.js +142 -0
- package/lib/test/commands/adjust_inventory.d.ts +1 -0
- package/lib/test/commands/adjust_inventory.js +97 -0
- package/lib/test/commands/bank.d.ts +1 -0
- package/lib/test/commands/bank.js +97 -0
- package/lib/test/commands/basic.d.ts +1 -0
- package/lib/test/commands/basic.js +339 -0
- package/lib/test/commands/category.d.ts +1 -0
- package/lib/test/commands/category.js +97 -0
- package/lib/test/commands/channel.d.ts +1 -0
- package/lib/test/commands/channel.js +97 -0
- package/lib/test/commands/client.d.ts +1 -0
- package/lib/test/commands/client.js +97 -0
- package/lib/test/commands/client_disabled.d.ts +1 -0
- package/lib/test/commands/client_disabled.js +97 -0
- package/lib/test/commands/join.d.ts +1 -0
- package/lib/test/commands/join.js +339 -0
- package/lib/test/commands/measureunit.d.ts +1 -0
- package/lib/test/commands/measureunit.js +97 -0
- package/lib/test/commands/measureunit_family.d.ts +1 -0
- package/lib/test/commands/measureunit_family.js +97 -0
- package/lib/test/commands/payment_term.d.ts +1 -0
- package/lib/test/commands/payment_term.js +97 -0
- package/lib/test/commands/price_list.d.ts +1 -0
- package/lib/test/commands/price_list.js +97 -0
- package/lib/test/commands/product.d.ts +1 -0
- package/lib/test/commands/product.js +97 -0
- package/lib/test/commands/product_disabled.d.ts +1 -0
- package/lib/test/commands/product_disabled.js +97 -0
- package/lib/test/commands/rep.d.ts +1 -0
- package/lib/test/commands/rep.js +97 -0
- package/lib/test/commands/tag.d.ts +1 -0
- package/lib/test/commands/tag.js +97 -0
- package/lib/test/commands/tax.d.ts +1 -0
- package/lib/test/commands/tax.js +97 -0
- package/lib/test/commands/warehouse.d.ts +1 -0
- package/lib/test/commands/warehouse.js +97 -0
- package/lib/types.d.ts +77 -0
- package/lib/types.js +1 -0
- package/lib/util.d.ts +70 -0
- package/lib/util.js +164 -0
- package/package.json +51 -0
- package/src/actions/create_invoice.ts +275 -0
- package/src/actions/create_payment.ts +138 -0
- package/src/actions/create_proforma.ts +187 -0
- package/src/actions/create_return_invoice.ts +217 -0
- package/src/actions/create_transfer.ts +160 -0
- package/src/actions/index.ts +27 -0
- package/src/commands/adjust_inventory.ts +250 -0
- package/src/commands/bank.ts +243 -0
- package/src/commands/basic.ts +64 -0
- package/src/commands/category.ts +176 -0
- package/src/commands/channel.ts +219 -0
- package/src/commands/client.ts +368 -0
- package/src/commands/client_disabled.ts +158 -0
- package/src/commands/index.ts +87 -0
- package/src/commands/join.ts +80 -0
- package/src/commands/measureunit.ts +276 -0
- package/src/commands/measureunit_family.ts +209 -0
- package/src/commands/payment_term.ts +224 -0
- package/src/commands/price_list.ts +434 -0
- package/src/commands/product.ts +359 -0
- package/src/commands/product_disabled.ts +152 -0
- package/src/commands/rep.ts +209 -0
- package/src/commands/tag.ts +173 -0
- package/src/commands/tax.ts +178 -0
- package/src/commands/warehouse.ts +204 -0
- package/src/index.ts +7 -0
- package/src/test/actions/create_invoice.ts +214 -0
- package/src/test/actions/create_payment.ts +131 -0
- package/src/test/actions/create_proforma.ts +242 -0
- package/src/test/actions/create_return_invoice.ts +226 -0
- package/src/test/actions/create_transfer.ts +142 -0
- package/src/test/commands/adjust_inventory.ts +100 -0
- package/src/test/commands/bank.ts +100 -0
- package/src/test/commands/basic.ts +342 -0
- package/src/test/commands/category.ts +100 -0
- package/src/test/commands/channel.ts +100 -0
- package/src/test/commands/client.ts +100 -0
- package/src/test/commands/client_disabled.ts +100 -0
- package/src/test/commands/join.ts +342 -0
- package/src/test/commands/measureunit.ts +100 -0
- package/src/test/commands/measureunit_family.ts +100 -0
- package/src/test/commands/payment_term.ts +100 -0
- package/src/test/commands/price_list.ts +100 -0
- package/src/test/commands/product.ts +100 -0
- package/src/test/commands/product_disabled.ts +100 -0
- package/src/test/commands/rep.ts +100 -0
- package/src/test/commands/tag.ts +100 -0
- package/src/test/commands/tax.ts +100 -0
- package/src/test/commands/warehouse.ts +100 -0
- package/src/types.ts +76 -0
- package/src/util.ts +205 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import Repzo from "repzo";
|
|
2
|
+
import DataSet from "data-set-query";
|
|
3
|
+
import {
|
|
4
|
+
_create,
|
|
5
|
+
update_bench_time,
|
|
6
|
+
date_formatting,
|
|
7
|
+
set_error,
|
|
8
|
+
} from "../util.js";
|
|
9
|
+
export const sync_warehouse = async (commandEvent) => {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
|
+
const repzo = new Repzo(
|
|
12
|
+
(_a = commandEvent.app.formData) === null || _a === void 0
|
|
13
|
+
? void 0
|
|
14
|
+
: _a.repzoApiKey,
|
|
15
|
+
{
|
|
16
|
+
env: commandEvent.env,
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
const commandLog = new Repzo.CommandLog(
|
|
20
|
+
repzo,
|
|
21
|
+
commandEvent.app,
|
|
22
|
+
commandEvent.command
|
|
23
|
+
);
|
|
24
|
+
try {
|
|
25
|
+
console.log("sync_warehouse");
|
|
26
|
+
const new_bench_time = new Date().toISOString();
|
|
27
|
+
const bench_time_key = "bench_time_warehouse";
|
|
28
|
+
await commandLog.load(commandEvent.sync_id);
|
|
29
|
+
await commandLog
|
|
30
|
+
.addDetail("Repzo SAP: Started Syncing Warehouses")
|
|
31
|
+
.commit();
|
|
32
|
+
const nameSpace = commandEvent.nameSpace.join("_");
|
|
33
|
+
const result = {
|
|
34
|
+
sap_total: 0,
|
|
35
|
+
repzo_total: 0,
|
|
36
|
+
created: 0,
|
|
37
|
+
updated: 0,
|
|
38
|
+
failed: 0,
|
|
39
|
+
};
|
|
40
|
+
const failed_docs_report = [];
|
|
41
|
+
const sap_warehouses = await get_sap_warehouses(
|
|
42
|
+
commandEvent.app.formData.sapHostUrl,
|
|
43
|
+
{
|
|
44
|
+
updateAt:
|
|
45
|
+
commandEvent.app.formData.warehouseDefaultUpdateDate ||
|
|
46
|
+
commandEvent.app.options_formData[bench_time_key],
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
result.sap_total =
|
|
50
|
+
(_b =
|
|
51
|
+
sap_warehouses === null || sap_warehouses === void 0
|
|
52
|
+
? void 0
|
|
53
|
+
: sap_warehouses.Warehouses) === null || _b === void 0
|
|
54
|
+
? void 0
|
|
55
|
+
: _b.length;
|
|
56
|
+
await commandLog
|
|
57
|
+
.addDetail(
|
|
58
|
+
`${
|
|
59
|
+
(_c =
|
|
60
|
+
sap_warehouses === null || sap_warehouses === void 0
|
|
61
|
+
? void 0
|
|
62
|
+
: sap_warehouses.Warehouses) === null || _c === void 0
|
|
63
|
+
? void 0
|
|
64
|
+
: _c.length
|
|
65
|
+
} warehouses changed since ${
|
|
66
|
+
commandEvent.app.formData.warehouseDefaultUpdateDate ||
|
|
67
|
+
commandEvent.app.options_formData[bench_time_key] ||
|
|
68
|
+
"ever"
|
|
69
|
+
}`
|
|
70
|
+
)
|
|
71
|
+
.commit();
|
|
72
|
+
const db = new DataSet([], { autoIndex: false });
|
|
73
|
+
db.createIndex({
|
|
74
|
+
WAREHOUSECODE: true,
|
|
75
|
+
WAREHOUSENAME: true,
|
|
76
|
+
});
|
|
77
|
+
db.load(
|
|
78
|
+
sap_warehouses === null || sap_warehouses === void 0
|
|
79
|
+
? void 0
|
|
80
|
+
: sap_warehouses.Warehouses
|
|
81
|
+
);
|
|
82
|
+
const repzo_warehouses = await repzo.warehouse.find({ per_page: 50000 });
|
|
83
|
+
result.repzo_total =
|
|
84
|
+
(_d =
|
|
85
|
+
repzo_warehouses === null || repzo_warehouses === void 0
|
|
86
|
+
? void 0
|
|
87
|
+
: repzo_warehouses.data) === null || _d === void 0
|
|
88
|
+
? void 0
|
|
89
|
+
: _d.length;
|
|
90
|
+
await commandLog
|
|
91
|
+
.addDetail(
|
|
92
|
+
`${
|
|
93
|
+
(_e =
|
|
94
|
+
repzo_warehouses === null || repzo_warehouses === void 0
|
|
95
|
+
? void 0
|
|
96
|
+
: repzo_warehouses.data) === null || _e === void 0
|
|
97
|
+
? void 0
|
|
98
|
+
: _e.length
|
|
99
|
+
} warehouses in Repzo`
|
|
100
|
+
)
|
|
101
|
+
.commit();
|
|
102
|
+
for (
|
|
103
|
+
let i = 0;
|
|
104
|
+
i <
|
|
105
|
+
((_f =
|
|
106
|
+
sap_warehouses === null || sap_warehouses === void 0
|
|
107
|
+
? void 0
|
|
108
|
+
: sap_warehouses.Warehouses) === null || _f === void 0
|
|
109
|
+
? void 0
|
|
110
|
+
: _f.length);
|
|
111
|
+
i++
|
|
112
|
+
) {
|
|
113
|
+
const sap_warehouse = sap_warehouses.Warehouses[i];
|
|
114
|
+
const repzo_warehouse = repzo_warehouses.data.find(
|
|
115
|
+
(r_warehouse) =>
|
|
116
|
+
r_warehouse.code == sap_warehouse.WAREHOUSECODE ||
|
|
117
|
+
r_warehouse.name == sap_warehouse.WAREHOUSENAME
|
|
118
|
+
);
|
|
119
|
+
const body = {
|
|
120
|
+
_id:
|
|
121
|
+
repzo_warehouse === null || repzo_warehouse === void 0
|
|
122
|
+
? void 0
|
|
123
|
+
: repzo_warehouse._id,
|
|
124
|
+
name: sap_warehouse.WAREHOUSENAME,
|
|
125
|
+
code: sap_warehouse.WAREHOUSECODE,
|
|
126
|
+
type:
|
|
127
|
+
sap_warehouse.WAREHOUSECODE.indexOf("VS") == 0 ||
|
|
128
|
+
sap_warehouse.WAREHOUSECODE.indexOf("COOPS1") == 0
|
|
129
|
+
? "van"
|
|
130
|
+
: "main",
|
|
131
|
+
disabled: sap_warehouse.INACTIVE == "N" ? false : true,
|
|
132
|
+
};
|
|
133
|
+
if (!repzo_warehouse) {
|
|
134
|
+
// Create
|
|
135
|
+
try {
|
|
136
|
+
const created_warehouse = await repzo.warehouse.create(body);
|
|
137
|
+
result.created++;
|
|
138
|
+
} catch (e) {
|
|
139
|
+
console.log(
|
|
140
|
+
"Create warehouse Failed >> ",
|
|
141
|
+
e === null || e === void 0 ? void 0 : e.response,
|
|
142
|
+
body
|
|
143
|
+
);
|
|
144
|
+
failed_docs_report.push({
|
|
145
|
+
method: "create",
|
|
146
|
+
doc: body,
|
|
147
|
+
error_message: set_error(e),
|
|
148
|
+
});
|
|
149
|
+
result.failed++;
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
const found_identical_docs = db.search({
|
|
153
|
+
WAREHOUSECODE: repzo_warehouse.code,
|
|
154
|
+
WAREHOUSENAME: repzo_warehouse.name,
|
|
155
|
+
});
|
|
156
|
+
if (found_identical_docs.length) continue; // Nothing has changed so no need for updates
|
|
157
|
+
// Update
|
|
158
|
+
try {
|
|
159
|
+
const updated_warehouse = await repzo.warehouse.update(
|
|
160
|
+
repzo_warehouse._id,
|
|
161
|
+
body
|
|
162
|
+
);
|
|
163
|
+
result.updated++;
|
|
164
|
+
} catch (e) {
|
|
165
|
+
console.log("Update warehouse Failed >> ", e, body);
|
|
166
|
+
failed_docs_report.push({
|
|
167
|
+
method: "update",
|
|
168
|
+
doc_id:
|
|
169
|
+
repzo_warehouse === null || repzo_warehouse === void 0
|
|
170
|
+
? void 0
|
|
171
|
+
: repzo_warehouse._id,
|
|
172
|
+
doc: body,
|
|
173
|
+
error_message: set_error(e),
|
|
174
|
+
});
|
|
175
|
+
result.failed++;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// console.log(result);
|
|
180
|
+
await update_bench_time(
|
|
181
|
+
repzo,
|
|
182
|
+
commandEvent.app._id,
|
|
183
|
+
bench_time_key,
|
|
184
|
+
new_bench_time,
|
|
185
|
+
"YYYY-MM-DD"
|
|
186
|
+
);
|
|
187
|
+
await commandLog
|
|
188
|
+
.setStatus(
|
|
189
|
+
"success",
|
|
190
|
+
failed_docs_report.length ? failed_docs_report : null
|
|
191
|
+
)
|
|
192
|
+
.setBody(result)
|
|
193
|
+
.commit();
|
|
194
|
+
return result;
|
|
195
|
+
} catch (e) {
|
|
196
|
+
//@ts-ignore
|
|
197
|
+
console.error(
|
|
198
|
+
((_g = e === null || e === void 0 ? void 0 : e.response) === null ||
|
|
199
|
+
_g === void 0
|
|
200
|
+
? void 0
|
|
201
|
+
: _g.data) || e
|
|
202
|
+
);
|
|
203
|
+
await commandLog.setStatus("fail", e).commit();
|
|
204
|
+
throw e === null || e === void 0 ? void 0 : e.response;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const get_sap_warehouses = async (serviceEndPoint, query) => {
|
|
208
|
+
try {
|
|
209
|
+
const sap_warehouses = await _create(serviceEndPoint, "/Warehouses", {
|
|
210
|
+
UpdateAt: date_formatting(
|
|
211
|
+
query === null || query === void 0 ? void 0 : query.updateAt,
|
|
212
|
+
"YYYYMMDD"
|
|
213
|
+
),
|
|
214
|
+
Inactive: "N",
|
|
215
|
+
Locked: "N",
|
|
216
|
+
});
|
|
217
|
+
return sap_warehouses;
|
|
218
|
+
} catch (e) {
|
|
219
|
+
throw e;
|
|
220
|
+
}
|
|
221
|
+
};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const Actions: (
|
|
2
|
+
event: any,
|
|
3
|
+
options: import("./types.js").Config
|
|
4
|
+
) => Promise<any>;
|
|
5
|
+
export declare const ActionsList: import("./types.js").Action[];
|
|
6
|
+
export declare const Commands: (
|
|
7
|
+
CommandEvent: import("./types.js").CommandEvent
|
|
8
|
+
) => Promise<
|
|
9
|
+
| void
|
|
10
|
+
| import("./types.js").Result
|
|
11
|
+
| {
|
|
12
|
+
PL: {
|
|
13
|
+
created: number;
|
|
14
|
+
updated: number;
|
|
15
|
+
failed: number;
|
|
16
|
+
};
|
|
17
|
+
PL_items: {
|
|
18
|
+
created: number;
|
|
19
|
+
updated: number;
|
|
20
|
+
failed: number;
|
|
21
|
+
};
|
|
22
|
+
sap_total: number;
|
|
23
|
+
repzo_total: number;
|
|
24
|
+
repzo_PL_items: number;
|
|
25
|
+
sap_UoMs_total: number;
|
|
26
|
+
repzo_products_total: number;
|
|
27
|
+
}
|
|
28
|
+
>;
|
|
29
|
+
export declare const CommandsList: import("./types.js").Command[];
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { actions, actionsList } from "./actions/index.js";
|
|
2
|
+
export const Actions = actions;
|
|
3
|
+
export const ActionsList = actionsList;
|
|
4
|
+
import { commands, commandsList } from "./commands/index.js";
|
|
5
|
+
export const Commands = commands;
|
|
6
|
+
export const CommandsList = commandsList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Actions } from "../../index.js";
|
|
2
|
+
Actions(
|
|
3
|
+
{
|
|
4
|
+
version: "2.0",
|
|
5
|
+
routeKey: "POST /actions",
|
|
6
|
+
rawPath: "/actions",
|
|
7
|
+
rawQueryString: "app=repzo-sap-absjo&action=create_invoice",
|
|
8
|
+
headers: {
|
|
9
|
+
action_sync_id: "Actions-0000001",
|
|
10
|
+
accept: "*/*",
|
|
11
|
+
"accept-encoding": "gzip, deflate",
|
|
12
|
+
"content-length": "3658",
|
|
13
|
+
"content-type": "application/json",
|
|
14
|
+
host: "staging.marketplace.api.repzo.me",
|
|
15
|
+
"svix-id": "msg_29I1By29ETyPiZ4SNrc99KIg7D6",
|
|
16
|
+
"svix-signature": "v1,OkktM+dibxzeb0M6383POFjBr7DX14HECpBIh17FQnU=",
|
|
17
|
+
"svix-timestamp": "1652785653",
|
|
18
|
+
"user-agent": "Svix-Webhooks/1.4",
|
|
19
|
+
"x-amzn-trace-id": "Root=1-628381f6-0b2c6f346d2eb5d207b582ee",
|
|
20
|
+
"x-forwarded-for": "52.215.16.239",
|
|
21
|
+
"x-forwarded-port": "443",
|
|
22
|
+
"x-forwarded-proto": "https",
|
|
23
|
+
},
|
|
24
|
+
queryStringParameters: {
|
|
25
|
+
action: "create_invoice",
|
|
26
|
+
app: "repzo-sap-absjo",
|
|
27
|
+
},
|
|
28
|
+
requestContext: {
|
|
29
|
+
accountId: "478266140170",
|
|
30
|
+
apiId: "ulkb1ikop2",
|
|
31
|
+
domainName: "staging.marketplace.api.repzo.me",
|
|
32
|
+
domainPrefix: "staging",
|
|
33
|
+
http: {
|
|
34
|
+
method: "POST",
|
|
35
|
+
path: "/actions",
|
|
36
|
+
protocol: "HTTP/1.1",
|
|
37
|
+
sourceIp: "52.215.16.239",
|
|
38
|
+
userAgent: "Svix-Webhooks/1.4",
|
|
39
|
+
},
|
|
40
|
+
requestId: "SRE-ejb6IAMEPWQ=",
|
|
41
|
+
routeKey: "POST /actions",
|
|
42
|
+
stage: "$default",
|
|
43
|
+
time: "17/May/2022:11:07:34 +0000",
|
|
44
|
+
timeEpoch: 1652785654069,
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
__v: 0,
|
|
48
|
+
_id: "639eaf634428fb70bdc0f1cd",
|
|
49
|
+
authorization:
|
|
50
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0aW1lem9uZSI6IkFzaWEvUml5YWRoIiwidXNlcm5hbWUiOiJ1bmlwYWxqbzIwNCIsIm5hbWUiOiJWUyBBeWVzaCBJYnJhaGltICBBbGxib29uIiwic2NvcGUiOiJyZXAiLCJuYW1lU3BhY2UiOlsidW5pcGFsam8iXSwidGVhbSI6WyI2MzhjOWNlOWRmOWRjNzcyOTFiMWQyNzgiXSwiaWRlbnRpZmllciI6MTE2NSwiaWQiOiI2MzZhNWY3ZjYyNmJiOTU5Mzc1NzM1NWQiLCJhcHBfY29kZSI6InJlcHpvX3BybyIsImNvdW50cnlfY29kZSI6WyJKTyJdLCJwZXJtYVN0cmluZyI6InZ2djB2dnZ2djB2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnYwdnZ2dnZ2djAwMDB2MHYwdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2MHZ2dnZ2MHZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2MHYwdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnYiLCJpYXQiOjE2NzEzMzg2NzksImV4cCI6MTY3MTM4MTg3OX0.E2H5w7-idnhtU5bGNcdo5_8E94z5TUdzTqXXNCEr7oA",
|
|
51
|
+
business_day: "2022-12-18",
|
|
52
|
+
client_id: "639ad007506dfca71556d892",
|
|
53
|
+
client_name: "الاصدقاء - الظليل",
|
|
54
|
+
comment: "",
|
|
55
|
+
company_namespace: ["unisap"],
|
|
56
|
+
createdAt: "2022-12-18T06:13:24.425Z",
|
|
57
|
+
creator: {
|
|
58
|
+
_id: "6395afcaa7fbbe901db1c5d9",
|
|
59
|
+
name: "VS Ayesh Ibrahim Allboon",
|
|
60
|
+
rep: "6395afcaa7fbbe901db1c5d9",
|
|
61
|
+
type: "rep",
|
|
62
|
+
},
|
|
63
|
+
currency: "JOD",
|
|
64
|
+
deductionFixed: 0,
|
|
65
|
+
deductionRatio: 0,
|
|
66
|
+
delivery_date: null,
|
|
67
|
+
discount_amount: 0,
|
|
68
|
+
due_date: "2022-12-18",
|
|
69
|
+
is_void: false,
|
|
70
|
+
issue_date: "2022-12-18",
|
|
71
|
+
items: [
|
|
72
|
+
{
|
|
73
|
+
_id: "639eaf84c843d331be3658c2",
|
|
74
|
+
applicable_promotions: [],
|
|
75
|
+
base_unit_qty: 4,
|
|
76
|
+
class: "invoice",
|
|
77
|
+
company_namespace: [],
|
|
78
|
+
deductedTax: 0,
|
|
79
|
+
deduction: 0,
|
|
80
|
+
deductionBeforeTax: 0,
|
|
81
|
+
deductionRatio: 0,
|
|
82
|
+
discount_value: 0,
|
|
83
|
+
discounted_price: 4210,
|
|
84
|
+
general_promotions: [],
|
|
85
|
+
gross_value: 4884,
|
|
86
|
+
isAdditional: false,
|
|
87
|
+
lineTotalAfterDeduction: 19534,
|
|
88
|
+
line_total: 19534,
|
|
89
|
+
line_total_without_modifiers: 19534,
|
|
90
|
+
measureunit: {
|
|
91
|
+
_id: "63981ca3bee5dd4b6b12e8c6",
|
|
92
|
+
company_namespace: [],
|
|
93
|
+
disabled: false,
|
|
94
|
+
factor: 1,
|
|
95
|
+
name: "PC",
|
|
96
|
+
parent: "63981c32e9f3eafb51d7f0af",
|
|
97
|
+
},
|
|
98
|
+
modifiers_groups: [],
|
|
99
|
+
modifiers_tax_total: 0,
|
|
100
|
+
modifiers_total: 0,
|
|
101
|
+
modifiers_total_before_tax: 0,
|
|
102
|
+
note: "",
|
|
103
|
+
overwritePrice: null,
|
|
104
|
+
price: 4210,
|
|
105
|
+
qty: 4,
|
|
106
|
+
tax: {
|
|
107
|
+
_id: "639715d5edafde008aefe936",
|
|
108
|
+
disabled: false,
|
|
109
|
+
name: "امانات ضريبة المبيعات 16%",
|
|
110
|
+
rate: 0.16,
|
|
111
|
+
type: "additive",
|
|
112
|
+
},
|
|
113
|
+
tax_amount: 674,
|
|
114
|
+
tax_total: 2694,
|
|
115
|
+
tax_total_without_modifiers: 2694,
|
|
116
|
+
total_before_tax: 16840,
|
|
117
|
+
total_before_tax_without_modifiers: 16840,
|
|
118
|
+
used_promotions: [],
|
|
119
|
+
variant: {
|
|
120
|
+
_id: "6398a6ade8a1cfdd26dc66fe",
|
|
121
|
+
listed_price: 0,
|
|
122
|
+
product_id: "6398a6ade8a1cfdd26dc66fc",
|
|
123
|
+
product_name: "BREITSAMER HONEY GOLDEN 500GR",
|
|
124
|
+
variant_id: "6398a6ade8a1cfdd26dc66fe",
|
|
125
|
+
variant_name: "010-BRE-HO0008",
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
latest: true,
|
|
130
|
+
origin_warehouse: "6391cce3f3a9fd99bd2d17e4",
|
|
131
|
+
overwriteTaxExempt: false,
|
|
132
|
+
pre_discount_amount: 0,
|
|
133
|
+
pre_subtotal: 16840,
|
|
134
|
+
pre_tax_amount: 2694,
|
|
135
|
+
pre_taxable_subtotal: 16840,
|
|
136
|
+
pre_total: 19534,
|
|
137
|
+
processable: true,
|
|
138
|
+
promotions: [],
|
|
139
|
+
return_discount_amount: 0,
|
|
140
|
+
return_items: [],
|
|
141
|
+
return_subtotal: 0,
|
|
142
|
+
return_tax_amount: 0,
|
|
143
|
+
return_taxable_subtotal: 0,
|
|
144
|
+
return_total: 0,
|
|
145
|
+
route: null,
|
|
146
|
+
serial_number: {
|
|
147
|
+
_id: "639eaf84c843d331be3658bd",
|
|
148
|
+
count: 80,
|
|
149
|
+
formatted: "INV-1165-80",
|
|
150
|
+
identifier: "1165",
|
|
151
|
+
},
|
|
152
|
+
shipping_charge: 0,
|
|
153
|
+
shipping_price: 0,
|
|
154
|
+
shipping_tax: 0,
|
|
155
|
+
signature: null,
|
|
156
|
+
status: "paid",
|
|
157
|
+
subtotal: 16840,
|
|
158
|
+
sync_id: "948ff1f9-b654-4a87-8858-9d11cb353de4",
|
|
159
|
+
tax_amount: 2694,
|
|
160
|
+
tax_exempt: false,
|
|
161
|
+
taxable_subtotal: 16840,
|
|
162
|
+
taxes: {
|
|
163
|
+
"امانات ضريبة المبيعات 16%": {
|
|
164
|
+
name: "امانات ضريبة المبيعات 16%",
|
|
165
|
+
rate: 0.16,
|
|
166
|
+
total: 2694,
|
|
167
|
+
type: "additive",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
teams: ["638c9ce9df9dc77291b1d278"],
|
|
171
|
+
time: 1671343991648,
|
|
172
|
+
total: 19534,
|
|
173
|
+
totalDeductedTax: 0,
|
|
174
|
+
totalDeduction: 0,
|
|
175
|
+
totalDeductionBeforeTax: 0,
|
|
176
|
+
total_with_charges: 19534,
|
|
177
|
+
transaction_processed: true,
|
|
178
|
+
updatedAt: "2022-12-18T06:13:29.951Z",
|
|
179
|
+
version: 2,
|
|
180
|
+
visit_id: "15c245fa-3767-4efa-ae63-f5ee962b699d",
|
|
181
|
+
}),
|
|
182
|
+
isBase64Encoded: false,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
repzoEndPoint: "",
|
|
186
|
+
serviceEndPoint: "",
|
|
187
|
+
env: "staging",
|
|
188
|
+
data: {
|
|
189
|
+
invoices: {
|
|
190
|
+
createInvoiceHook: false,
|
|
191
|
+
createReturnInvoiceHook: false,
|
|
192
|
+
},
|
|
193
|
+
payments: {
|
|
194
|
+
createPaymentHook: false,
|
|
195
|
+
},
|
|
196
|
+
proformas: {
|
|
197
|
+
createApprovedProformaHook: false,
|
|
198
|
+
},
|
|
199
|
+
transfer: {
|
|
200
|
+
createApprovedTransferHook: false,
|
|
201
|
+
},
|
|
202
|
+
repzoApiKey: "L98_Pc8qZG2R5hZIIMjxLQNUgUzT3_0aX2BuLvkyh74",
|
|
203
|
+
sapHostUrl: "http://unipal.b1pro.com:8083/api",
|
|
204
|
+
errorEmail: "maram.alshen@repzoapp.com",
|
|
205
|
+
serviceApiKey: "awdas",
|
|
206
|
+
warehouseDefaultUpdateDate: "2015-01-01",
|
|
207
|
+
DepartmentCode: "D2",
|
|
208
|
+
return_reason:
|
|
209
|
+
'[{sap_id:1,sap_name:"BarcodeIssue",repzo_name:"Barcodeissue",repzo_id:"62b074972b332895edf114fc"},{sap_id:2,sap_name:"Damaged",repzo_name:"Damaged",repzo_id:"62b074ace96258fb745982e4"},{sap_id:3,sap_name:"Nearexpiry",repzo_name:"Nearexpiry",repzo_id:"62b074c0a066173bd1c1ea0d"},{sap_id:4,sap_name:"Wrongprinting",repzo_name:"Wrongprinting",repzo_id:"62b074d79e7f41f306a4cb42"},{sap_id:5,sap_name:"experied",repzo_name:"Experied",repzo_id:"62b074faa066173bd1c1eec0"}]',
|
|
210
|
+
SalPersCode: "111",
|
|
211
|
+
SalesPersonCode: "111",
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Actions } from "../../index.js";
|
|
2
|
+
Actions(
|
|
3
|
+
{
|
|
4
|
+
version: "2.0",
|
|
5
|
+
routeKey: "POST /actions",
|
|
6
|
+
rawPath: "/actions",
|
|
7
|
+
rawQueryString: "app=repzo-sap-absjo&action=create_payment",
|
|
8
|
+
headers: {
|
|
9
|
+
action_sync_id: "Actions-0000004",
|
|
10
|
+
accept: "*/*",
|
|
11
|
+
"accept-encoding": "gzip, deflate",
|
|
12
|
+
"content-length": "3658",
|
|
13
|
+
"content-type": "application/json",
|
|
14
|
+
host: "staging.marketplace.api.repzo.me",
|
|
15
|
+
"svix-id": "msg_29I1By29ETyPiZ4SNrc99KIg7D6",
|
|
16
|
+
"svix-signature": "v1,OkktM+dibxzeb0M6383POFjBr7DX14HECpBIh17FQnU=",
|
|
17
|
+
"svix-timestamp": "1652785653",
|
|
18
|
+
"user-agent": "Svix-Webhooks/1.4",
|
|
19
|
+
"x-amzn-trace-id": "Root=1-628381f6-0b2c6f346d2eb5d207b582ee",
|
|
20
|
+
"x-forwarded-for": "52.215.16.239",
|
|
21
|
+
"x-forwarded-port": "443",
|
|
22
|
+
"x-forwarded-proto": "https",
|
|
23
|
+
},
|
|
24
|
+
queryStringParameters: {
|
|
25
|
+
action: "create_payment",
|
|
26
|
+
app: "repzo-sap-absjo",
|
|
27
|
+
},
|
|
28
|
+
requestContext: {
|
|
29
|
+
accountId: "478266140170",
|
|
30
|
+
apiId: "ulkb1ikop2",
|
|
31
|
+
domainName: "staging.marketplace.api.repzo.me",
|
|
32
|
+
domainPrefix: "staging",
|
|
33
|
+
http: {
|
|
34
|
+
method: "POST",
|
|
35
|
+
path: "/actions",
|
|
36
|
+
protocol: "HTTP/1.1",
|
|
37
|
+
sourceIp: "52.215.16.239",
|
|
38
|
+
userAgent: "Svix-Webhooks/1.4",
|
|
39
|
+
},
|
|
40
|
+
requestId: "SRE-ejb6IAMEPWQ=",
|
|
41
|
+
routeKey: "POST /actions",
|
|
42
|
+
stage: "$default",
|
|
43
|
+
time: "17/May/2022:11:07:34 +0000",
|
|
44
|
+
timeEpoch: 1652785654069,
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
_id: "639da8a8298f9ea4d6d543dd",
|
|
48
|
+
status: "unconsumed",
|
|
49
|
+
remainder: 3651631,
|
|
50
|
+
amount: 3651631,
|
|
51
|
+
client_id: "639adef7b4dc172fc503645e",
|
|
52
|
+
client_name: "ماي ماركت _ مسكه لتجارة المواد الغذائية",
|
|
53
|
+
creator: {
|
|
54
|
+
_id: "6395af44a7fbbe901db1c2aa",
|
|
55
|
+
type: "rep",
|
|
56
|
+
name: "RET MUSTAFA MOHAMMAD RASHEED ABDALLAH",
|
|
57
|
+
},
|
|
58
|
+
time: 1671276710322,
|
|
59
|
+
serial_number: {
|
|
60
|
+
identifier: "1036",
|
|
61
|
+
formatted: "PAY-1036-362",
|
|
62
|
+
count: 362,
|
|
63
|
+
_id: "639da8a8298f9ea4d6d543de",
|
|
64
|
+
},
|
|
65
|
+
route: null,
|
|
66
|
+
paytime: "2022-12-17",
|
|
67
|
+
note: "",
|
|
68
|
+
currency: "JOD",
|
|
69
|
+
payment_type: "check",
|
|
70
|
+
check: {
|
|
71
|
+
drawer_name: "شركة مسكة لتجارة المواد الغذائيه ",
|
|
72
|
+
bank: "639863e6333b84929c539077",
|
|
73
|
+
bank_branch: "دابوق ",
|
|
74
|
+
check_number: 11322,
|
|
75
|
+
check_date: "2022-12-17",
|
|
76
|
+
photo:
|
|
77
|
+
"https://repzo-media-service.s3.eu-west-2.amazonaws.com/unisap/image/2022/12/17/f7027375-8e21-4b0d-baff-15bc7e642803.jpeg",
|
|
78
|
+
media: [],
|
|
79
|
+
caption: null,
|
|
80
|
+
disabled: false,
|
|
81
|
+
_id: "639da8a8298f9ea4d6d543df",
|
|
82
|
+
},
|
|
83
|
+
company_namespace: ["unisap"],
|
|
84
|
+
sync_id: "0109372a-8479-44ba-b519-5f1041afca8e",
|
|
85
|
+
teams: [],
|
|
86
|
+
paymentsData: {
|
|
87
|
+
amount: -3651631,
|
|
88
|
+
paid: 0,
|
|
89
|
+
balance: -3651631,
|
|
90
|
+
payments: [],
|
|
91
|
+
_id: "639da8a8298f9ea4d6d543e0",
|
|
92
|
+
},
|
|
93
|
+
reference: "",
|
|
94
|
+
createdAt: "2022-12-17T11:31:52.069Z",
|
|
95
|
+
updatedAt: "2022-12-17T11:31:52.069Z",
|
|
96
|
+
__v: 0,
|
|
97
|
+
balance_to_refund: 3651631,
|
|
98
|
+
}),
|
|
99
|
+
isBase64Encoded: false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
repzoEndPoint: "",
|
|
103
|
+
serviceEndPoint: "",
|
|
104
|
+
env: "staging",
|
|
105
|
+
data: {
|
|
106
|
+
invoices: {
|
|
107
|
+
createInvoiceHook: false,
|
|
108
|
+
createReturnInvoiceHook: false,
|
|
109
|
+
},
|
|
110
|
+
payments: {
|
|
111
|
+
createPaymentHook: false,
|
|
112
|
+
},
|
|
113
|
+
proformas: {
|
|
114
|
+
createApprovedProformaHook: false,
|
|
115
|
+
},
|
|
116
|
+
transfer: {
|
|
117
|
+
createApprovedTransferHook: false,
|
|
118
|
+
},
|
|
119
|
+
repzoApiKey: "L98_Pc8qZG2R5hZIIMjxLQNUgUzT3_0aX2BuLvkyh74",
|
|
120
|
+
sapHostUrl: "http://unipal.b1pro.com:8083/api",
|
|
121
|
+
errorEmail: "maram.alshen@repzoapp.com",
|
|
122
|
+
serviceApiKey: "awdas",
|
|
123
|
+
warehouseDefaultUpdateDate: "2015-01-01",
|
|
124
|
+
DepartmentCode: "D2",
|
|
125
|
+
return_reason:
|
|
126
|
+
'[{sap_id:1,sap_name:"BarcodeIssue",repzo_name:"Barcodeissue",repzo_id:"62b074972b332895edf114fc"},{sap_id:2,sap_name:"Damaged",repzo_name:"Damaged",repzo_id:"62b074ace96258fb745982e4"},{sap_id:3,sap_name:"Nearexpiry",repzo_name:"Nearexpiry",repzo_id:"62b074c0a066173bd1c1ea0d"},{sap_id:4,sap_name:"Wrongprinting",repzo_name:"Wrongprinting",repzo_id:"62b074d79e7f41f306a4cb42"},{sap_id:5,sap_name:"experied",repzo_name:"Experied",repzo_id:"62b074faa066173bd1c1eec0"}]',
|
|
127
|
+
SalPersCode: "111",
|
|
128
|
+
SalesPersonCode: "111",
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|