public ApiResponse <Device, ApiData> GetDevice() { var respVm = AuthIntegration.GetDevice(); var partnerHierarchyResponse = _partnerHierarchyIntegration.GetPartnerHierarchyAgent(new PartnerHierarchyAgentRequest { LocationId = AuthIntegration.GetDeviceAgentLocation(), MainofficeId = AuthIntegration.GetMainOfficeId() }); var agentDetails = partnerHierarchyResponse.GetAgent(); if (agentDetails != null) { respVm.AgentStatus = agentDetails.Status; respVm.OracleAccountNumber = agentDetails.OracleAccountNumber; respVm.IsRetailCredit = agentDetails.IsRetailCredit == "Y"; } var apiResp = new ApiResponse <Device, ApiData> { BusinessMetadata = MapperHelper.SetResponseProperties(null, DataSource.Operator), ResponseData = respVm }; return(apiResp); }
public DwRegisterDeviceRespVm DwRegisterDevice(DwRegisterDeviceReqVm registerDeviceReqVm) { var dwInitialreq = new DwInitialSetupRequest { DeviceID = registerDeviceReqVm.DeviceId, Password = registerDeviceReqVm.SetupPin, ClientSoftwareVersion = registerDeviceReqVm.ClientSoftwareVersion, PoeType = registerDeviceReqVm.PoeType, ChannelType = registerDeviceReqVm.ChannelType, TargetAudience = registerDeviceReqVm.TargetAudience }; var dwSetup = DwInitialSetup(dwInitialreq); var xDoc = XDocument.Parse(dwSetup.ResponseData.Payload.Profile); registerDeviceReqVm.MgiDeviceSession = registerDeviceReqVm.MgiDeviceSession; registerDeviceReqVm.PosUnitProfileId = int.Parse(GetValue(xDoc, "PROFILE_ID").FirstOrDefault().Value); var dwregisterDeviceReqVm = registerDeviceReqVm.ToModel(); var resp = openIdmIntegration.RegisterDevice(dwregisterDeviceReqVm); return(new DwRegisterDeviceRespVm { AgentLocationId = AuthIntegration.GetAgent().AgentId, MainOfficeId = AuthIntegration.GetMainOfficeId(), AgentName = resp == true?GetValue(xDoc, "AGENT_NAME").FirstOrDefault().Value : string.Empty, AgentAddress1 = resp == true?GetValue(xDoc, "AGENT_ADDRESS_1").FirstOrDefault().Value : string.Empty, AgentAddress2 = resp == true?GetValue(xDoc, "AGENT_ADDRESS_2").FirstOrDefault().Value : string.Empty, AgentAddress3 = resp == true?GetValue(xDoc, "AGENT_ADDRESS_3").FirstOrDefault().Value : string.Empty, AgentCity = resp == true?GetValue(xDoc, "AGENT_CITY").FirstOrDefault().Value : string.Empty, AgentState = resp == true?GetValue(xDoc, "AGENT_STATE").FirstOrDefault().Value : string.Empty, AgentZip = resp == true?GetValue(xDoc, "AGENT_ZIP").FirstOrDefault().Value : string.Empty, AgentPhoneNumber = resp == true?GetValue(xDoc, "AGENT_PHONE").FirstOrDefault().Value : string.Empty, AgentCountry = resp == true?GetValue(xDoc, "AGENT_COUNTRY").FirstOrDefault().Value : string.Empty, AgentTimeZone = resp == true?GetValue(xDoc, "AGENT_TIME_ZONE").FirstOrDefault().Value : string.Empty, Success = resp }); }
public UserIdExistsResponse GetUserIdExists(UserIdExistsRequest userIdExistsRequest) { userIdExistsRequest.MainofficeId = Convert.ToDecimal(AuthIntegration.GetMainOfficeId()); return(_partnerServiceRepository.GetUserIdExists(userIdExistsRequest)); }
public UserReportsInfoResponseList GetUserReportsInfo(UserReportsInfoRequest getUserReportsInfoRequest) { getUserReportsInfoRequest.MainOfficeId = System.Convert.ToDecimal(AuthIntegration.GetMainOfficeId()); return(_partnerServiceRepository.GetUserReportsInfo(getUserReportsInfoRequest)); }
public ApiResponse <LocationResVm, ApiData> GetLocations() { LocationResVm result = new LocationResVm(); List <AgentVm> mainOfficeLocations = new List <AgentVm>(); List <AgentVm> searchedLocationsWithMO = new List <AgentVm>(); List <AgentVm> searchedLocationsExternal = new List <AgentVm>(); AgentVm mainOfficeAgent = GetMainOfficeAgent(); //Get all the lcoations for mainoffice(exluding mainoffice agent) mainOfficeLocations = LocationsForMainOffice(_authUser.MainOfficeAgentId); searchedLocationsWithMO.Add(mainOfficeAgent); searchedLocationsWithMO.AddRange(mainOfficeLocations); if (AuthIntegration.GetMainOfficeId().ToString() != string.Empty && _authUser.Status.Equals(UserStatus.External) && _authUser.UserAgentList != null && _authUser.UserAgentList.Count != 0) { UserAgentActivity userAgent = (_authUser.UserAgentList != null ? _authUser.UserAgentList.FirstOrDefault() : new UserAgentActivity()); // if user has access to all locations if (_authUser.AllLocationsAllowed) { searchedLocationsExternal = LocationsForMainOffice(_authUser.MainOfficeAgentId).ToList(); } //// if user is main office user and has the AgentAssistfunctionality else if (IsUserAgentAssistFuncionality(_authUser) && userAgent.AgentId.Equals(AuthIntegration.GetMainOfficeId())) { searchedLocationsExternal = searchedLocationsWithMO; } else { // if user is either sublevel or location user then foreach (UserAgentActivity u in _authUser.UserAgentList) { var agent = mainOfficeLocations.Find(ag => ag.id.ToString() == u.AgentId); if (agent != null) { if ((HierarchyLevel)agent.hierarchyLevel == HierarchyLevel.SubLevel) { //passing the agentid inplace of the sublevelagentid field var locations = LocationsForMainOffice(_authUser.MainOfficeAgentId, agent.id); searchedLocationsExternal.AddRange(locations); } else { searchedLocationsExternal.Add(agent); } } } } result.Agents = searchedLocationsExternal; } else { result.Agents = searchedLocationsWithMO; } return(new ApiResponse <LocationResVm, ApiData> { ResponseData = result, BusinessMetadata = MapperHelper.SetResponseProperties(null, DataSource.PartnerService) }); }