gm-mcp 2.0.3 → 2.0.4

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.
@@ -3,4 +3,5 @@ export declare const DEBT_COLLECTION_TYPE: {
3
3
  readonly PARTNER_IN_CHARGE: "PARTNER_IN_CHARGE";
4
4
  readonly DIRECT_FROM_CUSTOMER_ACCOUNT: "DIRECT_FROM_CUSTOMER_ACCOUNT";
5
5
  };
6
+ export declare const EMPLOYEE_STATUS_MAPS: Record<string, any>;
6
7
  export declare function accessibleTool(phoneNumber: string): Promise<CallToolResult>;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DEBT_COLLECTION_TYPE = void 0;
12
+ exports.EMPLOYEE_STATUS_MAPS = exports.DEBT_COLLECTION_TYPE = void 0;
13
13
  exports.accessibleTool = accessibleTool;
14
14
  const gimo_service_1 = require("../services/gimo.service");
15
15
  const PRODUCT_TYPE = {
@@ -48,6 +48,28 @@ function getProductType(options) {
48
48
  }
49
49
  return null;
50
50
  }
51
+ exports.EMPLOYEE_STATUS_MAPS = {
52
+ ACTIVE: "Đang làm việc",
53
+ SUSPEND__WAITING_TO_APPROVE: "Chờ công đoàn phê duyệt",
54
+ SUSPEND__MATERNITY_LEAVE: "Nhân sự nghỉ thai sản",
55
+ SUSPEND__UNPAID_LEAVE: "Nhân sự nghỉ không lương",
56
+ SUSPEND__RE_UPLOAD_ACCOUNT_STATEMENT: "Chờ cập nhật chứng minh thu nhập",
57
+ SUSPEND__WAITING_APPRAISALS_ACCOUNT_STATEMENT: "Chờ phê duyệt chứng minh thu nhập",
58
+ SUSPEND__DEFAULT: "Tạm nghỉ",
59
+ INACTIVE: "Nghỉ việc",
60
+ };
61
+ const BASE_REQUIRED_CRITERIA = {
62
+ ewa_status: "ACTIVE",
63
+ seniority: ">= 0.3 year",
64
+ working_status: exports.EMPLOYEE_STATUS_MAPS.ACTIVE,
65
+ longest_overdue_bill: "<=10 days",
66
+ outstanding_balance: "0",
67
+ parnter_contract_expirity: "Not yet expired",
68
+ time_keepper: "Comming ...",
69
+ geofencing_status: "??",
70
+ };
71
+ const EWA_02_CRITERIA = Object.assign(Object.assign({}, BASE_REQUIRED_CRITERIA), { dda: "REGISTERED" });
72
+ const EWA_03_CRITERIA = Object.assign(Object.assign({}, BASE_REQUIRED_CRITERIA), { dda: "REGISTERED" });
51
73
  function accessibleTool(phoneNumber) {
52
74
  return __awaiter(this, void 0, void 0, function* () {
53
75
  try {
@@ -65,15 +87,22 @@ function accessibleTool(phoneNumber) {
65
87
  ewa_status: customer === null || customer === void 0 ? void 0 : customer.ewa_status,
66
88
  dda: customer === null || customer === void 0 ? void 0 : customer.dda_status,
67
89
  seniority: employee === null || employee === void 0 ? void 0 : employee.seniority,
68
- working_status: employee === null || employee === void 0 ? void 0 : employee.status,
90
+ working_status: exports.EMPLOYEE_STATUS_MAPS[(employee === null || employee === void 0 ? void 0 : employee.status) || "ACTIVE"],
69
91
  product_type: productType,
70
92
  };
71
- const requiredCriteria = {
72
- ewa_status: "ACTIVE",
73
- dda: "REGISTERED",
74
- seniority: ">= 0.3 year",
75
- working_status: "ACTIVE",
93
+ const getRequriedCriteria = (productType) => {
94
+ if (productType === PRODUCT_TYPE.EWA_01) {
95
+ return BASE_REQUIRED_CRITERIA;
96
+ }
97
+ if (productType === PRODUCT_TYPE.EWA_02) {
98
+ return EWA_02_CRITERIA;
99
+ }
100
+ if (productType === PRODUCT_TYPE.EWA_03) {
101
+ return EWA_03_CRITERIA;
102
+ }
103
+ return BASE_REQUIRED_CRITERIA;
76
104
  };
105
+ const requiredCriteria = getRequriedCriteria(productType);
77
106
  const returnData = {
78
107
  current_information: currentInformation,
79
108
  valid_information: requiredCriteria,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-mcp",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Mcp server for Gm",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -41,6 +41,38 @@ function getProductType(options: { partner_onboard_method: string; debt_collecti
41
41
  return null;
42
42
  }
43
43
 
44
+ export const EMPLOYEE_STATUS_MAPS: Record<string, any> = {
45
+ ACTIVE: "Đang làm việc",
46
+ SUSPEND__WAITING_TO_APPROVE: "Chờ công đoàn phê duyệt",
47
+ SUSPEND__MATERNITY_LEAVE: "Nhân sự nghỉ thai sản",
48
+ SUSPEND__UNPAID_LEAVE: "Nhân sự nghỉ không lương",
49
+ SUSPEND__RE_UPLOAD_ACCOUNT_STATEMENT: "Chờ cập nhật chứng minh thu nhập",
50
+ SUSPEND__WAITING_APPRAISALS_ACCOUNT_STATEMENT: "Chờ phê duyệt chứng minh thu nhập",
51
+ SUSPEND__DEFAULT: "Tạm nghỉ",
52
+ INACTIVE: "Nghỉ việc",
53
+ };
54
+
55
+ const BASE_REQUIRED_CRITERIA = {
56
+ ewa_status: "ACTIVE",
57
+ seniority: ">= 0.3 year",
58
+ working_status: EMPLOYEE_STATUS_MAPS.ACTIVE,
59
+ longest_overdue_bill: "<=10 days",
60
+ outstanding_balance: "0",
61
+ parnter_contract_expirity: "Not yet expired",
62
+ time_keepper: "Comming ...",
63
+ geofencing_status: "??",
64
+ };
65
+
66
+ const EWA_02_CRITERIA = {
67
+ ...BASE_REQUIRED_CRITERIA,
68
+ dda: "REGISTERED",
69
+ };
70
+
71
+ const EWA_03_CRITERIA = {
72
+ ...BASE_REQUIRED_CRITERIA,
73
+ dda: "REGISTERED",
74
+ };
75
+
44
76
  export async function accessibleTool(phoneNumber: string): Promise<CallToolResult> {
45
77
  try {
46
78
  const customer = await findCustomerEWAByPhonenumber(phoneNumber);
@@ -59,17 +91,25 @@ export async function accessibleTool(phoneNumber: string): Promise<CallToolResul
59
91
  ewa_status: customer?.ewa_status,
60
92
  dda: customer?.dda_status,
61
93
  seniority: employee?.seniority,
62
- working_status: employee?.status,
94
+ working_status: EMPLOYEE_STATUS_MAPS[employee?.status || "ACTIVE"],
63
95
  product_type: productType,
64
96
  };
65
97
 
66
- const requiredCriteria: Record<string, any> = {
67
- ewa_status: "ACTIVE",
68
- dda: "REGISTERED",
69
- seniority: ">= 0.3 year",
70
- working_status: "ACTIVE",
98
+ const getRequriedCriteria = (productType: keyof typeof PRODUCT_TYPE | null) => {
99
+ if (productType === PRODUCT_TYPE.EWA_01) {
100
+ return BASE_REQUIRED_CRITERIA;
101
+ }
102
+ if (productType === PRODUCT_TYPE.EWA_02) {
103
+ return EWA_02_CRITERIA;
104
+ }
105
+ if (productType === PRODUCT_TYPE.EWA_03) {
106
+ return EWA_03_CRITERIA;
107
+ }
108
+ return BASE_REQUIRED_CRITERIA;
71
109
  };
72
110
 
111
+ const requiredCriteria: Record<string, any> = getRequriedCriteria(productType);
112
+
73
113
  const returnData = {
74
114
  current_information: currentInformation,
75
115
  valid_information: requiredCriteria,