gm-mcp 2.0.9 → 2.0.11
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.
|
@@ -25,6 +25,6 @@ export declare function findCustomerEWAById(id: number): Promise<Gimo.CustomerEW
|
|
|
25
25
|
export declare function getCustomerStatusChange(ewaCustomerId: number, options?: {
|
|
26
26
|
accessToken?: string;
|
|
27
27
|
}): Promise<CustomerEwaStatusChangeLogs[]>;
|
|
28
|
-
export declare function getCurrentPayperiodInfo(
|
|
28
|
+
export declare function getCurrentPayperiodInfo(employeeId: number, options?: {
|
|
29
29
|
accessToken?: string;
|
|
30
30
|
}): Promise<PayperiodInfo>;
|
|
@@ -163,14 +163,14 @@ function getCustomerStatusChange(ewaCustomerId, options) {
|
|
|
163
163
|
return res;
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
function getCurrentPayperiodInfo(
|
|
166
|
+
function getCurrentPayperiodInfo(employeeId, options) {
|
|
167
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
168
|
const { accessToken } = options || {};
|
|
169
169
|
let access_token = accessToken;
|
|
170
170
|
if (!access_token) {
|
|
171
171
|
access_token = yield getAccessToken();
|
|
172
172
|
}
|
|
173
|
-
const url = `${(0, env_1.getEnv)().DASH_URL}/api/v1/admin/employees/${
|
|
173
|
+
const url = `${(0, env_1.getEnv)().DASH_URL}/api/v1/admin/employees/${employeeId}/current-pay-period-info`;
|
|
174
174
|
const res = yield axios_1.default
|
|
175
175
|
.get(url, {
|
|
176
176
|
headers: {
|
|
@@ -70,12 +70,12 @@ exports.EMPLOYEE_STATUS_MAPS = {
|
|
|
70
70
|
SUSPEND__DEFAULT: "Tạm nghỉ",
|
|
71
71
|
INACTIVE: "Nghỉ việc",
|
|
72
72
|
};
|
|
73
|
-
const
|
|
73
|
+
const CUSTOMER_EWA_STATUS_MAPS = {
|
|
74
74
|
ACTIVE: "Hoạt động",
|
|
75
75
|
DEACTIVATE: "Tạm ngưng",
|
|
76
76
|
};
|
|
77
77
|
const BASE_REQUIRED_CRITERIA = {
|
|
78
|
-
ewa_status:
|
|
78
|
+
ewa_status: CUSTOMER_EWA_STATUS_MAPS.ACTIVE,
|
|
79
79
|
seniority: ">= 0.3 year",
|
|
80
80
|
working_status: exports.EMPLOYEE_STATUS_MAPS.ACTIVE,
|
|
81
81
|
longest_overdue_bill: "<=10 days",
|
|
@@ -93,7 +93,7 @@ const formatter = (record) => {
|
|
|
93
93
|
};
|
|
94
94
|
function elgibilityTool(phoneNumber) {
|
|
95
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
var _a, _b;
|
|
96
|
+
var _a, _b, _c, _d;
|
|
97
97
|
try {
|
|
98
98
|
const accessToken = yield (0, gimo_service_1.getAccessToken)();
|
|
99
99
|
const customer = yield (0, gimo_service_1.findCustomerEWAByPhonenumber)(phoneNumber, { accessToken });
|
|
@@ -110,7 +110,7 @@ function elgibilityTool(phoneNumber) {
|
|
|
110
110
|
if (payPeriods === null || payPeriods === void 0 ? void 0 : payPeriods.length) {
|
|
111
111
|
periods = payPeriods;
|
|
112
112
|
timeSheets = yield (0, gimo_service_1.getTimeSheets)({ payPeriodId: payPeriods[0].id, employeeId: employee.id }, { accessToken });
|
|
113
|
-
currentPayperiodInfo = yield (0, gimo_service_1.getCurrentPayperiodInfo)(
|
|
113
|
+
currentPayperiodInfo = yield (0, gimo_service_1.getCurrentPayperiodInfo)(employee.id, { accessToken });
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
if (customer.ewa_status === "DEACTIVATE") {
|
|
@@ -123,7 +123,7 @@ function elgibilityTool(phoneNumber) {
|
|
|
123
123
|
partner_onboard_method: onboard_method || "",
|
|
124
124
|
});
|
|
125
125
|
const currentInformation = {
|
|
126
|
-
ewa_status: customer === null || customer === void 0 ? void 0 : customer.ewa_status,
|
|
126
|
+
ewa_status: (_d = CUSTOMER_EWA_STATUS_MAPS[(_c = customer === null || customer === void 0 ? void 0 : customer.ewa_status) !== null && _c !== void 0 ? _c : ""]) !== null && _d !== void 0 ? _d : "",
|
|
127
127
|
dda: customer === null || customer === void 0 ? void 0 : customer.dda_status,
|
|
128
128
|
seniority: employee === null || employee === void 0 ? void 0 : employee.seniority,
|
|
129
129
|
working_status: exports.EMPLOYEE_STATUS_MAPS[(employee === null || employee === void 0 ? void 0 : employee.status) || "ACTIVE"],
|
|
@@ -146,7 +146,10 @@ function elgibilityTool(phoneNumber) {
|
|
|
146
146
|
return BASE_REQUIRED_CRITERIA;
|
|
147
147
|
};
|
|
148
148
|
const requiredCriteria = getRequriedCriteria(productType);
|
|
149
|
-
const reasons = [
|
|
149
|
+
const reasons = [];
|
|
150
|
+
if (ewaDeactiveReason) {
|
|
151
|
+
reasons.push(`Reason for ewa status: ${ewaDeactiveReason}`);
|
|
152
|
+
}
|
|
150
153
|
const result = `
|
|
151
154
|
Customer ${customer.customer_full_name}, partner name ${customer.partner_name} has these information: ${formatter(currentInformation)}
|
|
152
155
|
Eligibility Criteria for Salary Advance: ${formatter(requiredCriteria)}
|
package/package.json
CHANGED
|
@@ -143,13 +143,13 @@ export async function getCustomerStatusChange(ewaCustomerId: number, options?: {
|
|
|
143
143
|
return res;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
export async function getCurrentPayperiodInfo(
|
|
146
|
+
export async function getCurrentPayperiodInfo(employeeId: number, options?: { accessToken?: string }) {
|
|
147
147
|
const { accessToken } = options || {};
|
|
148
148
|
let access_token = accessToken;
|
|
149
149
|
if (!access_token) {
|
|
150
150
|
access_token = await getAccessToken();
|
|
151
151
|
}
|
|
152
|
-
const url = `${getEnv().DASH_URL}/api/v1/admin/employees/${
|
|
152
|
+
const url = `${getEnv().DASH_URL}/api/v1/admin/employees/${employeeId}/current-pay-period-info`;
|
|
153
153
|
const res = await axios
|
|
154
154
|
.get<PayperiodInfo>(url, {
|
|
155
155
|
headers: {
|
|
@@ -75,13 +75,13 @@ export const EMPLOYEE_STATUS_MAPS: Record<string, any> = {
|
|
|
75
75
|
INACTIVE: "Nghỉ việc",
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const
|
|
78
|
+
const CUSTOMER_EWA_STATUS_MAPS: Record<string, any> = {
|
|
79
79
|
ACTIVE: "Hoạt động",
|
|
80
80
|
DEACTIVATE: "Tạm ngưng",
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
const BASE_REQUIRED_CRITERIA = {
|
|
84
|
-
ewa_status:
|
|
84
|
+
ewa_status: CUSTOMER_EWA_STATUS_MAPS.ACTIVE,
|
|
85
85
|
seniority: ">= 0.3 year",
|
|
86
86
|
working_status: EMPLOYEE_STATUS_MAPS.ACTIVE,
|
|
87
87
|
longest_overdue_bill: "<=10 days",
|
|
@@ -127,7 +127,7 @@ export async function elgibilityTool(phoneNumber: string): Promise<CallToolResul
|
|
|
127
127
|
if (payPeriods?.length) {
|
|
128
128
|
periods = payPeriods;
|
|
129
129
|
timeSheets = await getTimeSheets({ payPeriodId: payPeriods[0].id, employeeId: employee.id }, { accessToken });
|
|
130
|
-
currentPayperiodInfo = await getCurrentPayperiodInfo(
|
|
130
|
+
currentPayperiodInfo = await getCurrentPayperiodInfo(employee.id, { accessToken });
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
if (customer.ewa_status === "DEACTIVATE") {
|
|
@@ -142,7 +142,7 @@ export async function elgibilityTool(phoneNumber: string): Promise<CallToolResul
|
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
const currentInformation = {
|
|
145
|
-
ewa_status: customer?.ewa_status,
|
|
145
|
+
ewa_status: CUSTOMER_EWA_STATUS_MAPS[customer?.ewa_status ?? ""] ?? "",
|
|
146
146
|
dda: customer?.dda_status,
|
|
147
147
|
seniority: employee?.seniority,
|
|
148
148
|
working_status: EMPLOYEE_STATUS_MAPS[employee?.status || "ACTIVE"],
|
|
@@ -168,7 +168,10 @@ export async function elgibilityTool(phoneNumber: string): Promise<CallToolResul
|
|
|
168
168
|
|
|
169
169
|
const requiredCriteria: Record<string, any> = getRequriedCriteria(productType);
|
|
170
170
|
|
|
171
|
-
const reasons = [
|
|
171
|
+
const reasons: string[] = [];
|
|
172
|
+
if (ewaDeactiveReason) {
|
|
173
|
+
reasons.push(`Reason for ewa status: ${ewaDeactiveReason}`);
|
|
174
|
+
}
|
|
172
175
|
|
|
173
176
|
const result = `
|
|
174
177
|
Customer ${customer.customer_full_name}, partner name ${customer.partner_name} has these information: ${formatter(currentInformation)}
|