private async Task NotifyOrganisationUsers(OrganisationSearchResult organisationSearchResult, ContactResponse user) { //ON-2020 Changed from reference Id to Id , since org reference Id can have multiple values await _organisationsApiClient.SendEmailsToOrganisationUserManagementUsers(new NotifyUserManagementUsersRequest( user.DisplayName, organisationSearchResult .Id, _config.ServiceLink)); }
public void OrganisationSearchResultOptionalFieldBlank_AddressPropertyPopulatedProperly() { OrganisationSearchResult result = new OrganisationSearchResult() { Address = new AddressData() { Address1 = "Add1", TownOrCity = "Town", CountryName = "England" } }; Assert.Equal("Add1,<br/>Town,<br/>England", result.AddressString); }
private async Task UpdateOrganisationStatusAndInvite(OrganisationSearchResult organisationSearchResult, ContactResponse user) { var registeredOrganisation = await _organisationsApiClient.GetEpaOrganisation(organisationSearchResult.Id); if (registeredOrganisation.Status == OrganisationStatus.Live || registeredOrganisation.Status == OrganisationStatus.New) { await _contactsApiClient.UpdateOrgAndStatus(new UpdateContactWithOrgAndStausRequest( user.Id.ToString(), registeredOrganisation?.Id.ToString(), registeredOrganisation?.OrganisationData?.EndPointAssessmentOrgId, ContactStatus.InvitePending)); await NotifyOrganisationUsers(organisationSearchResult, user); } }
public void OrganisationSearchResultOptionalFieldBlank_NameWithAddressPropertyPopulatedProperly() { OrganisationSearchResult result = new OrganisationSearchResult() { Name = "Test org", Address = new AddressData() { Address1 = "Add1", TownOrCity = "Town", CountryName = "England" } }; Assert.Equal("Test org (Add1, Town, England)", result.NameWithAddress); }
public void OrganisationSearchResult_AddressPropertyPopulatedProperly() { OrganisationSearchResult result = new OrganisationSearchResult() { Address = new AddressData() { Address1 = "Add1", Address2 = "Add2", TownOrCity = "Town", CountyOrRegion = "County", Postcode = "Postcode", CountryName = "England" } }; Assert.Equal("Add1,<br/>Add2,<br/>Town,<br/>County,<br/>Postcode,<br/>England", result.AddressString); }
public void OrganisationSearchResult_NameWithAddressPropertyPopulatedProperly() { OrganisationSearchResult result = new OrganisationSearchResult() { Name = "Test org", Address = new AddressData() { Address1 = "Add1", Address2 = "Add2", TownOrCity = "Town", CountyOrRegion = "County", Postcode = "Postcode", CountryName = "England" } }; Assert.Equal("Test org (Add1, Add2, Town, County, Postcode, England)", result.NameWithAddress); }
private async Task <Provider> GetProviderFromUkprn(int ukprn) { Provider provider; OrganisationSearchResult searchResult = null; try { searchResult = await _roatpApiClient.GetOrganisationByUkprn(ukprn); } catch (Exception ex) { _logger.LogError(ex, $"Unable to get Provider from AssessmentOrgsApi. Ukprn: {ukprn}"); } if (searchResult is null) { // see if we can get it from Organisation Table var org = await _organisationQueryRepository.GetByUkPrn(ukprn); if (org != null) { provider = new Provider { ProviderName = org.EndPointAssessorName, Ukprn = ukprn }; } else { // see whether there are any previous certificates with this ukrpn and a ProviderName.... var previousProviderName = await _certificateRepository.GetPreviousProviderName(ukprn); provider = new Provider { ProviderName = previousProviderName ?? "Unknown", Ukprn = ukprn }; } } else { provider = new Provider { ProviderName = searchResult.ProviderName, Ukprn = ukprn }; } return(provider); }
private ViewResult RequestAccess(OrganisationSearchViewModel viewModel, OrganisationSearchResult organisationSearchResult) { var newViewModel = Mapper.Map <RequestAccessOrgSearchViewModel>(viewModel); var addressArray = new[] { organisationSearchResult.Address?.Address1, organisationSearchResult.Address?.City, organisationSearchResult.Address.Postcode }; newViewModel.Address = string.Join(", ", addressArray.Where(s => !string.IsNullOrEmpty(s))); newViewModel.RoEPAOApproved = organisationSearchResult.RoEPAOApproved; newViewModel.OrganisationIsLive = organisationSearchResult.OrganisationIsLive; if (!string.IsNullOrEmpty(organisationSearchResult.CompanyNumber)) { newViewModel.CompanyOrCharityDisplayText = "Company number"; newViewModel.CompanyNumber = organisationSearchResult.CompanyNumber; } else if (!string.IsNullOrEmpty(organisationSearchResult.CharityNumber)) { newViewModel.CompanyOrCharityDisplayText = "Charity number"; newViewModel.CompanyNumber = organisationSearchResult.CharityNumber; } return(View(nameof(NoAccess), newViewModel)); }
public async Task <Organisation> Create(OrganisationSearchResult organisation, Guid userId) { var orgDetails = new OrganisationDetails { OrganisationReferenceType = organisation.OrganisationReferenceType, OrganisationReferenceId = organisation.OrganisationReferenceId, LegalName = organisation.LegalName, TradingName = organisation.TradingName, ProviderName = organisation.ProviderName, CompanyNumber = organisation.CompanyNumber, CharityNumber = organisation.CharityNumber, Address1 = organisation.Address?.Address1, Address2 = organisation.Address?.Address2, Address3 = organisation.Address?.Address3, City = organisation.Address?.City, Postcode = organisation.Address?.Postcode, FHADetails = new FHADetails() { FinancialDueDate = organisation.FinancialDueDate, FinancialExempt = organisation.FinancialExempt } }; var request = new CreateOrganisationRequest { Name = organisation.Name, OrganisationType = organisation.OrganisationType, OrganisationUkprn = organisation.Ukprn, RoEPAOApproved = organisation.RoEPAOApproved, RoATPApproved = organisation.RoATPApproved, OrganisationDetails = orgDetails, CreatedBy = userId, PrimaryContactEmail = organisation.Email }; return(await Create(request, userId)); }
private async Task <CreateEpaOrganisationRequest> CreateEpaOrganisationRequest(OrganisationSearchResult organisationSearchResult) { // ON-2262 - Get the company & charity details from the relevant APIs var companyDetails = !string.IsNullOrWhiteSpace(organisationSearchResult.CompanyNumber) ? await _organisationsApiClient.GetCompanyDetails(organisationSearchResult.CompanyNumber) : null; var charityDetails = int.TryParse(organisationSearchResult.CharityNumber, out var charityNumber) ? await _organisationsApiClient.GetCharityDetails(charityNumber) : null; return(new CreateEpaOrganisationRequest { Name = organisationSearchResult.Name, OrganisationReferenceType = organisationSearchResult.OrganisationReferenceType, OrganisationReferenceId = organisationSearchResult.OrganisationReferenceId, LegalName = organisationSearchResult.LegalName, TradingName = organisationSearchResult.TradingName, ProviderName = organisationSearchResult.ProviderName, CompanyNumber = organisationSearchResult.CompanyNumber, CompanySummary = Mapper.Map <CompaniesHouseSummary>(companyDetails), CharityNumber = organisationSearchResult.CharityNumber, CharitySummary = Mapper.Map <CharityCommissionSummary>(charityDetails), Address1 = organisationSearchResult.Address?.Address1, Address2 = organisationSearchResult.Address?.Address2, Address3 = organisationSearchResult.Address?.Address3, Address4 = organisationSearchResult.Address?.City, Postcode = organisationSearchResult.Address?.Postcode, RoATPApproved = organisationSearchResult.RoATPApproved, RoEPAOApproved = false, EndPointAssessmentOrgId = null, FHADetails = new Api.Types.Models.AO.FHADetails { FinancialDueDate = organisationSearchResult.FinancialDueDate, FinancialExempt = organisationSearchResult.FinancialExempt } }); }