示例#1
0
        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
                }
            });
        }