repzo-sap-absjo 1.0.3 → 1.0.5
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 +15 -0
- package/lib/actions/create_invoice.js +61 -28
- package/lib/actions/create_proforma.js +63 -30
- package/lib/actions/create_return_invoice.js +61 -28
- package/lib/actions/create_transfer.js +47 -33
- package/lib/commands/client.js +7 -9
- package/lib/commands/client_disabled.js +22 -28
- package/lib/commands/join.js +7 -0
- package/lib/commands/rep.js +37 -41
- package/lib/types.d.ts +3 -3
- package/package.json +2 -2
- package/src/actions/create_invoice.ts +42 -16
- package/src/actions/create_payment.ts +1 -1
- package/src/actions/create_proforma.ts +41 -16
- package/src/actions/create_return_invoice.ts +42 -16
- package/src/actions/create_transfer.ts +13 -7
- package/src/commands/client.ts +8 -10
- package/src/commands/client_disabled.ts +16 -15
- package/src/commands/join.ts +5 -0
- package/src/commands/rep.ts +11 -11
- package/src/types.ts +3 -3
|
@@ -66,28 +66,29 @@ export const sync_disabled_client = async (commandEvent: CommandEvent) => {
|
|
|
66
66
|
(client) => `${nameSpace}_${client.CLIENTID}`
|
|
67
67
|
);
|
|
68
68
|
|
|
69
|
-
const repzo_disabled_clients =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
const repzo_disabled_clients = await repzo.patchAction.create(
|
|
70
|
+
{
|
|
71
|
+
slug: "client",
|
|
72
|
+
readQuery: [
|
|
73
|
+
{ key: "disabled", value: [false], operator: "eq" },
|
|
74
|
+
{
|
|
75
|
+
key: "integration_meta.id",
|
|
76
|
+
value: sap_client_query,
|
|
77
|
+
operator: "in",
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{ per_page: 50000, project: ["_id", "integration_meta"] }
|
|
82
|
+
);
|
|
82
83
|
|
|
83
|
-
result.repzo_total = repzo_disabled_clients?.length;
|
|
84
|
+
result.repzo_total = repzo_disabled_clients.data?.length;
|
|
84
85
|
await commandLog
|
|
85
86
|
.addDetail(`${result.repzo_total} Matched Active Clients in Repzo`)
|
|
86
87
|
.commit();
|
|
87
88
|
|
|
88
89
|
for (let i = 0; i < sap_disabled_clients?.length; i++) {
|
|
89
90
|
const sap_client: SAPClient = sap_disabled_clients[i];
|
|
90
|
-
const repzo_client = repzo_disabled_clients?.find(
|
|
91
|
+
const repzo_client = repzo_disabled_clients.data?.find(
|
|
91
92
|
(r_client) =>
|
|
92
93
|
r_client.integration_meta?.id == `${nameSpace}_${sap_client.CLIENTID}`
|
|
93
94
|
);
|
package/src/commands/join.ts
CHANGED
|
@@ -75,6 +75,11 @@ export const join = async (commandEvent: CommandEvent) => {
|
|
|
75
75
|
const result = await repzo.joinActionsWebHook.update(null, body);
|
|
76
76
|
// console.log(result);
|
|
77
77
|
|
|
78
|
+
if (result?.status == "failure") {
|
|
79
|
+
await commandLog.setStatus("fail", result.error).setBody(result).commit();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
await commandLog.setStatus("success").setBody(result).commit();
|
|
79
84
|
} catch (e: any) {
|
|
80
85
|
//@ts-ignore
|
package/src/commands/rep.ts
CHANGED
|
@@ -63,17 +63,17 @@ export const sync_rep = async (commandEvent: CommandEvent) => {
|
|
|
63
63
|
await commandLog.addDetail(`${result.sap_total} reps in SAP`).commit();
|
|
64
64
|
|
|
65
65
|
// hard code ************************************
|
|
66
|
-
sap_reps?.Users?.forEach((sap_rep) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
66
|
+
// sap_reps?.Users?.forEach((sap_rep) => {
|
|
67
|
+
// if (
|
|
68
|
+
// sap_rep.USERDESC.startsWith("WS ") ||
|
|
69
|
+
// sap_rep.USERDESC.startsWith("RET ")
|
|
70
|
+
// ) {
|
|
71
|
+
// sap_rep.USERWHSCODE = "1";
|
|
72
|
+
// }
|
|
73
|
+
// if (sap_rep.USERDESC.startsWith("MT ")) {
|
|
74
|
+
// sap_rep.USERWHSCODE = "K.A";
|
|
75
|
+
// }
|
|
76
|
+
// });
|
|
77
77
|
// **********************************************
|
|
78
78
|
|
|
79
79
|
const db = new DataSet([], { autoIndex: false });
|
package/src/types.ts
CHANGED
|
@@ -29,7 +29,7 @@ interface Params {
|
|
|
29
29
|
export type EVENT = AWSLambda.APIGatewayEvent & { params: Params };
|
|
30
30
|
export interface Action {
|
|
31
31
|
name: string;
|
|
32
|
-
action: ActionType;
|
|
32
|
+
action: ActionType | string;
|
|
33
33
|
description: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -61,7 +61,7 @@ export type CommandType =
|
|
|
61
61
|
| "adjust_inventory";
|
|
62
62
|
|
|
63
63
|
export interface Command {
|
|
64
|
-
command: CommandType;
|
|
64
|
+
command: CommandType | string;
|
|
65
65
|
description: string;
|
|
66
66
|
name: string;
|
|
67
67
|
}
|
|
@@ -78,7 +78,7 @@ export interface AvailableApp {
|
|
|
78
78
|
|
|
79
79
|
export interface CommandEvent {
|
|
80
80
|
app: Service.App.Schema_with_populated_AvailableApp;
|
|
81
|
-
command: CommandType;
|
|
81
|
+
command: CommandType | string;
|
|
82
82
|
nameSpace: NameSpaces;
|
|
83
83
|
meta?: any;
|
|
84
84
|
sync_id?: string;
|