public Functions( StorageOptions storageOptions, IEventLogger customLogger, [KeyFilter(Filenames.BadSicLog)] IAuditLogger badSicLog, [KeyFilter(Filenames.ManualChangeLog)] IAuditLogger manualChangeLog, IMessenger messenger, ISharedBusinessLogic sharedBusinessLogic, ISearchRepository <EmployerSearchModel> employerSearchRepository, ISearchRepository <SicCodeSearchModel> sicCodeSearchRepository, ISubmissionBusinessLogic submissionBusinessLogic, IOrganisationBusinessLogic organisationBusinessLogic, ISearchBusinessLogic searchBusinessLogic, IGovNotifyAPI govNotifyApi, UpdateFromCompaniesHouseService updateFromCompaniesHouseService, IAuthorisationBusinessLogic authorisationBusinessLogic) { _StorageOptions = storageOptions; _CustomLogger = customLogger; _BadSicLog = badSicLog; _ManualChangeLog = manualChangeLog; _Messenger = messenger; _SharedBusinessLogic = sharedBusinessLogic; _EmployerSearchRepository = employerSearchRepository; _SicCodeSearchRepository = sicCodeSearchRepository; _SubmissionBusinessLogic = submissionBusinessLogic; _OrganisationBusinessLogic = organisationBusinessLogic; SearchBusinessLogic = searchBusinessLogic; _updateFromCompaniesHouseService = updateFromCompaniesHouseService; _authorisationBusinessLogic = authorisationBusinessLogic; this.govNotifyApi = govNotifyApi; }
public FetchCompaniesHouseDataJob( IDataRepository dataRepository, UpdateFromCompaniesHouseService updateFromCompaniesHouseService) { this.dataRepository = dataRepository; this.updateFromCompaniesHouseService = updateFromCompaniesHouseService; }
public IActionResult ChangeAddressGet(long id) { Organisation organisation = dataRepository.Get <Organisation>(id); if (!string.IsNullOrWhiteSpace(organisation.CompanyNumber)) { try { CompaniesHouseCompany organisationFromCompaniesHouse = companiesHouseApi.GetCompany(organisation.CompanyNumber); OrganisationAddress addressFromCompaniesHouse = UpdateFromCompaniesHouseService.CreateOrganisationAddressFromCompaniesHouseAddress( organisationFromCompaniesHouse.RegisteredOfficeAddress); if (!organisation.GetLatestAddress().AddressMatches(addressFromCompaniesHouse)) { return(OfferNewCompaniesHouseAddress(organisation, addressFromCompaniesHouse)); } } catch (Exception ex) { // Use Manual Change page instead CustomLogger.Warning("Error from Companies House API", ex); } } // In all other cases... // * Organisation doesn't have a Companies House number // * CoHo API returns an error // * CoHo address matches Organisation address // ... send to the Manual Change page return(SendToManualChangePage(organisation)); }
public AdminOrganisationCompaniesHouseOptInOutController(IDataRepository dataRepository, AuditLogger auditLogger, ICompaniesHouseAPI companiesHouseApi, UpdateFromCompaniesHouseService updateFromCompaniesHouseService) { this.dataRepository = dataRepository; this.auditLogger = auditLogger; this.companiesHouseApi = companiesHouseApi; this.updateFromCompaniesHouseService = updateFromCompaniesHouseService; }
public AdminOrganisationCompaniesHouseOptInOutController( IAdminService adminService, AuditLogger auditLogger, ICompaniesHouseAPI companiesHouseApi, UpdateFromCompaniesHouseService updateFromCompaniesHouseService) { _adminService = adminService; this.auditLogger = auditLogger; this.companiesHouseApi = companiesHouseApi; this.updateFromCompaniesHouseService = updateFromCompaniesHouseService; }
private void AddOrganisationAddress(Organisation organisation, CompaniesHouseAddress companiesHouseAddress) { OrganisationAddress organisationAddress = UpdateFromCompaniesHouseService.CreateOrganisationAddressFromCompaniesHouseAddress(companiesHouseAddress); organisationAddress.StatusDetails = "Initial import from CoHo"; organisationAddress.Organisation = organisation; organisation.OrganisationAddresses.Add(organisationAddress); dataRepository.Insert(organisationAddress); }
private void PopulateViewModelBasedOnCompanyNumber(AddOrganisationFoundViewModel viewModel) { CompaniesHouseCompany organisationFromCompaniesHouse = companiesHouseApi.GetCompany(viewModel.CompanyNumber); // Name viewModel.Name = organisationFromCompaniesHouse.CompanyName; // Address CompaniesHouseAddress coHoAddress = organisationFromCompaniesHouse.RegisteredOfficeAddress; OrganisationAddress organisationAddress = UpdateFromCompaniesHouseService.CreateOrganisationAddressFromCompaniesHouseAddress(coHoAddress); string addressString = organisationAddress?.GetAddressString() ?? ""; viewModel.AddressLines = addressString.Split(",").ToList(); // IsUkAddress string postCode = organisationFromCompaniesHouse.RegisteredOfficeAddress.PostalCode; viewModel.IsUkAddress = PostcodesIoApi.IsValidPostcode(postCode) ? AddOrganisationIsUkAddress.Yes : (AddOrganisationIsUkAddress?)null; }