From 42aa5cbc1b2ad75a5808f36116e304adb8f35f3f Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 26 Jan 2025 11:36:54 +0300 Subject: [PATCH] Api 2.0 changes --- lib/api/dashboard_api_client.dart | 4 ++-- lib/api/login_api_client.dart | 22 +++++++++++----------- lib/classes/consts.dart | 25 +++++++++++++++++++------ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index bc0fece..f4d60e3 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -107,7 +107,7 @@ class DashboardApiClient { //Mark Attendance Future markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = "", String payrollCode = ""}) async { - String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC"; + String url = "${ApiConsts.erpRest}AuthenticateAndSwipeUserSupportNFC"; var uuid = Uuid(); // Generate a v4 (random) id @@ -132,7 +132,7 @@ class DashboardApiClient { //Mark Fake Location Future markFakeLocation({String lat = "0", String? long = "0", required String sourceName}) async { - String url = "${ApiConsts.swpRest}CreateIssueInfo"; + String url = "${ApiConsts.erpRest}CreateIssueInfo"; var uuid = Uuid(); // Generate a v4 (random) id diff --git a/lib/api/login_api_client.dart b/lib/api/login_api_client.dart index 1b6b19e..6412abe 100644 --- a/lib/api/login_api_client.dart +++ b/lib/api/login_api_client.dart @@ -17,7 +17,7 @@ class LoginApiClient { factory LoginApiClient() => _instance; Future getMobileLoginInfoNEW(String deviceToken, String deviceType) async { - String url = "${ApiConsts.erpRest}Mohemm_GetMobileLoginInfo_NEW"; + String url = "${ApiConsts.authRest}Mohemm_GetMobileLoginInfo_NEW"; Map postParams = {}; postParams["DeviceToken"] = deviceToken; postParams["DeviceType"] = deviceType; @@ -29,7 +29,7 @@ class LoginApiClient { Future insertMobileLoginInfoNEW( String email, int sessionId, String employeeName, int loginType, String mobileNumber, String userName, String deviceToken, String deviceType) async { - String url = "${ApiConsts.erpRest}Mohemm_InsertMobileLoginInfo"; + String url = "${ApiConsts.authRest}Mohemm_InsertMobileLoginInfo"; Map postParams = { "MobileNumber": mobileNumber, "P_USER_NAME": userName, @@ -52,14 +52,14 @@ class LoginApiClient { } Future checkMobileAppVersion() async { - String url = "${ApiConsts.utilitiesRest}CheckMobileAppVersion"; + String url = "${ApiConsts.utilitiesRest}CheckMobileAppVersion"; // todo @zahoor, not found in swagger Map postParams = {}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) => CheckMobileAppVersionModel.fromJson(json), url, postParams); } Future memberLogin(String username, String password) async { - String url = "${ApiConsts.erpRest}MemberLogin"; + String url = "${ApiConsts.authRest}MemberLogin"; Map postParams = {"P_APP_VERSION": "CS", "P_LANGUAGE": "US", "P_PASSWORD": password, "P_USER_NAME": username}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -70,14 +70,14 @@ class LoginApiClient { } Future mohemmSendActivationCodeByOTPNotificationType(int isMobileFingerPrint, String? mobileNumber, int optSendType, String? pUserName) async { - String url = "${ApiConsts.erpRest}Mohemm_SendActivationCodebyOTPNotificationType"; + String url = "${ApiConsts.authRest}Mohemm_SendActivationCodebyOTPNotificationType"; Map postParams = {"IsMobileFingerPrint": isMobileFingerPrint, "MobileNumber": mobileNumber, "OTP_SendType": optSendType, "P_USER_NAME": pUserName}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) => GenericResponseModel.fromJson(json).basicMemberInformation, url, postParams); } Future checkActivationCode(bool isDeviceNFC, String? mobileNumber, String activationCode, String? pUserName) async { - String url = "${ApiConsts.erpRest}CheckActivationCode"; + String url = "${ApiConsts.authRest}CheckActivationCode"; Map postParams = {"IsDeviceNFC": isDeviceNFC, "MobileNumber": mobileNumber, "activationCode": activationCode, "P_USER_NAME": pUserName}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -97,14 +97,14 @@ class LoginApiClient { } Future getBasicUserInformation(String pAppVersion, String pUsername) async { - String url = "${ApiConsts.erpRest}Get_BasicUserInformation"; + String url = "${ApiConsts.authRest}Get_BasicUserInformation"; Map postParams = {"P_APP_VERSION": pAppVersion, "P_USER_NAME": pUsername}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) => GenericResponseModel.fromJson(json).basicMemberInformation, url, postParams); } Future sendPublicActivationCode(String? mobileNumber, String? pUsername) async { - String url = "${ApiConsts.erpRest}SendPublicActivationCode"; + String url = "${ApiConsts.erpRest}SendPublicActivationCode"; // todo @zahoor, not found in swagger Map postParams = {"MobileNumber": mobileNumber, "P_MOBILE_NUMBER": mobileNumber, "P_USER_NAME": pUsername}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -115,7 +115,7 @@ class LoginApiClient { } Future checkPublicActivationCode(String activationCode, String? pUserName) async { - String url = "${ApiConsts.erpRest}checkPublicActivationCode"; + String url = "${ApiConsts.erpRest}checkPublicActivationCode"; // todo @zahoor, not found in swagger Map postParams = {"activationCode": activationCode, "P_USER_NAME": pUserName}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -126,7 +126,7 @@ class LoginApiClient { } Future changePasswordForget(String forgetPasswordTokenID, String pNewPassword, String pConfirmNewPassword, String? pUserName) async { - String url = "${ApiConsts.erpRest}ChangePassword_Forget"; + String url = "${ApiConsts.erpRest}ChangePassword_Forget"; // todo @zahoor, not found in swagger Map postParams = {"P_USER_NAME": pUserName, "ForgetPasswordTokenID": forgetPasswordTokenID, "P_Confirm_NEW_PASSWORD": pConfirmNewPassword, "P_NEW_PASSWORD": pNewPassword}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -147,7 +147,7 @@ class LoginApiClient { } Future changePasswordFromActiveDirectorySession(String password, String email) async { - String url = "${ApiConsts.authenticationRest}SetPassword"; + String url = "${ApiConsts.authenticationRest}SetPassword"; // todo @zahoor, not found in swagger Map postParams = {"EmailAddress": email, "Password": password, "generalid": "Cs2020@2016\$2958"}; postParams.addAll(AppState().postParamsJson); postParams["LogInTokenID"] = "@acT!V3D!r3Ct0rY"; // hard code token for active directory diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 6442b88..f26f4bb 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -11,21 +11,34 @@ class ApiConsts { // static String baseUrl = "https://mohemm.hmg.com"; // New Live server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver + static String baseUrl = "https://ms.hmg.com"; // Api 2.0 + + + // https://ms.hmg.com/mohem/api/Auth/MemberLogin // static String baseUrl = "http://10.20.200.111:1010/"; // static String baseUrl = "https://webservices.hmg.com"; // PreProd // static String baseUrl = "https://mohemm.hmg.com"; // static String baseUrl = "https://hmgwebservices.com"; // Live server - static String baseUrlServices = baseUrl + "/Services/"; // server + // static String baseUrlServices = baseUrl + "/Services/"; // server + static String baseUrlServices = baseUrl + "/mohem/api/"; // baseUrlServices Api 2.0 // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String authenticationRest = baseUrlServices + "Authentication.svc/REST/"; - static String erpRest = baseUrlServices + "ERP.svc/REST/"; - static String swpRest = baseUrlServices + "SWP.svc/REST/"; - static String user = baseUrlServices + "api/User/"; - static String cocRest = baseUrlServices + "COCWS.svc/REST/"; + // static String erpRest = baseUrlServices + "ERP.svc/REST/"; + + // static String swpRest = baseUrlServices + "SWP.svc/REST/"; + // static String user = baseUrlServices + "api/User/"; + // static String cocRest = baseUrlServices + "COCWS.svc/REST/"; + + // Api 2.0 -------------------------------------------- + static String authRest = baseUrlServices + "Auth/"; + static String cocRest = baseUrlServices + "COCWS/"; + static String erpRest = baseUrlServices + "ERP/"; + static String perfRest = baseUrlServices + "Perf/"; + //Chat static String chatServerBaseUrl = "https://apiderichat.hmg.com/";