gm-mcp 2.0.10 → 2.0.12
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.
|
@@ -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",
|
|
@@ -83,6 +83,7 @@ const BASE_REQUIRED_CRITERIA = {
|
|
|
83
83
|
parnter_contract_expirity: "Not yet expired",
|
|
84
84
|
time_sheet: "The data exists",
|
|
85
85
|
available_balance: ">0",
|
|
86
|
+
wage: ">0",
|
|
86
87
|
};
|
|
87
88
|
const EWA_02_CRITERIA = Object.assign(Object.assign({}, BASE_REQUIRED_CRITERIA), { dda: "REGISTERED" });
|
|
88
89
|
const EWA_03_CRITERIA = Object.assign(Object.assign({}, BASE_REQUIRED_CRITERIA), { dda: "REGISTERED" });
|
|
@@ -93,7 +94,7 @@ const formatter = (record) => {
|
|
|
93
94
|
};
|
|
94
95
|
function elgibilityTool(phoneNumber) {
|
|
95
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
var _a, _b;
|
|
97
|
+
var _a, _b, _c, _d;
|
|
97
98
|
try {
|
|
98
99
|
const accessToken = yield (0, gimo_service_1.getAccessToken)();
|
|
99
100
|
const customer = yield (0, gimo_service_1.findCustomerEWAByPhonenumber)(phoneNumber, { accessToken });
|
|
@@ -123,7 +124,7 @@ function elgibilityTool(phoneNumber) {
|
|
|
123
124
|
partner_onboard_method: onboard_method || "",
|
|
124
125
|
});
|
|
125
126
|
const currentInformation = {
|
|
126
|
-
ewa_status: customer === null || customer === void 0 ? void 0 : customer.ewa_status,
|
|
127
|
+
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
128
|
dda: customer === null || customer === void 0 ? void 0 : customer.dda_status,
|
|
128
129
|
seniority: employee === null || employee === void 0 ? void 0 : employee.seniority,
|
|
129
130
|
working_status: exports.EMPLOYEE_STATUS_MAPS[(employee === null || employee === void 0 ? void 0 : employee.status) || "ACTIVE"],
|
|
@@ -132,6 +133,7 @@ function elgibilityTool(phoneNumber) {
|
|
|
132
133
|
longest_overdue_bill: customer.ewa_longest_over_due_day,
|
|
133
134
|
opreation_note: employee === null || employee === void 0 ? void 0 : employee.reason,
|
|
134
135
|
available_balance: currentPayperiodInfo === null || currentPayperiodInfo === void 0 ? void 0 : currentPayperiodInfo.accessible_amount,
|
|
136
|
+
wage: (employee === null || employee === void 0 ? void 0 : employee.wage) || 0,
|
|
135
137
|
};
|
|
136
138
|
const getRequriedCriteria = (productType) => {
|
|
137
139
|
if (productType === PRODUCT_TYPE.EWA_01) {
|
|
@@ -146,7 +148,10 @@ function elgibilityTool(phoneNumber) {
|
|
|
146
148
|
return BASE_REQUIRED_CRITERIA;
|
|
147
149
|
};
|
|
148
150
|
const requiredCriteria = getRequriedCriteria(productType);
|
|
149
|
-
const reasons = [
|
|
151
|
+
const reasons = [];
|
|
152
|
+
if (ewaDeactiveReason) {
|
|
153
|
+
reasons.push(`Reason for ewa status: ${ewaDeactiveReason}`);
|
|
154
|
+
}
|
|
150
155
|
const result = `
|
|
151
156
|
Customer ${customer.customer_full_name}, partner name ${customer.partner_name} has these information: ${formatter(currentInformation)}
|
|
152
157
|
Eligibility Criteria for Salary Advance: ${formatter(requiredCriteria)}
|
package/package.json
CHANGED
|
@@ -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",
|
|
@@ -89,6 +89,7 @@ const BASE_REQUIRED_CRITERIA = {
|
|
|
89
89
|
parnter_contract_expirity: "Not yet expired",
|
|
90
90
|
time_sheet: "The data exists",
|
|
91
91
|
available_balance: ">0",
|
|
92
|
+
wage: ">0",
|
|
92
93
|
};
|
|
93
94
|
|
|
94
95
|
const EWA_02_CRITERIA = {
|
|
@@ -142,7 +143,7 @@ export async function elgibilityTool(phoneNumber: string): Promise<CallToolResul
|
|
|
142
143
|
});
|
|
143
144
|
|
|
144
145
|
const currentInformation = {
|
|
145
|
-
ewa_status: customer?.ewa_status,
|
|
146
|
+
ewa_status: CUSTOMER_EWA_STATUS_MAPS[customer?.ewa_status ?? ""] ?? "",
|
|
146
147
|
dda: customer?.dda_status,
|
|
147
148
|
seniority: employee?.seniority,
|
|
148
149
|
working_status: EMPLOYEE_STATUS_MAPS[employee?.status || "ACTIVE"],
|
|
@@ -151,6 +152,7 @@ export async function elgibilityTool(phoneNumber: string): Promise<CallToolResul
|
|
|
151
152
|
longest_overdue_bill: customer.ewa_longest_over_due_day,
|
|
152
153
|
opreation_note: employee?.reason,
|
|
153
154
|
available_balance: currentPayperiodInfo?.accessible_amount,
|
|
155
|
+
wage: employee?.wage || 0,
|
|
154
156
|
};
|
|
155
157
|
|
|
156
158
|
const getRequriedCriteria = (productType: keyof typeof PRODUCT_TYPE | null) => {
|
|
@@ -168,7 +170,10 @@ export async function elgibilityTool(phoneNumber: string): Promise<CallToolResul
|
|
|
168
170
|
|
|
169
171
|
const requiredCriteria: Record<string, any> = getRequriedCriteria(productType);
|
|
170
172
|
|
|
171
|
-
const reasons = [
|
|
173
|
+
const reasons: string[] = [];
|
|
174
|
+
if (ewaDeactiveReason) {
|
|
175
|
+
reasons.push(`Reason for ewa status: ${ewaDeactiveReason}`);
|
|
176
|
+
}
|
|
172
177
|
|
|
173
178
|
const result = `
|
|
174
179
|
Customer ${customer.customer_full_name}, partner name ${customer.partner_name} has these information: ${formatter(currentInformation)}
|