Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APR-2689 : Charities Commission API v2 #869

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ private static void CreateCharityTrusteeData(ApplicationDetails applicationDetai
{
var dataRow = new TabularDataRow
{
Id = trustee.Id,
Id = Guid.NewGuid().ToString(),
Columns = new List<string> { trustee.Name }
};
table.DataRows.Add(dataRow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class CharityCommissionSummary

public class Trustee
{
public string Id { get; set; }
public string Name { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class Charity

public Address RegisteredOfficeAddress { get; set; }

public string TelephoneNumber { get; set; }
public string EmailAddress { get; set; }
public string Website { get; set; }

public IEnumerable<string> NatureOfBusiness { get; set; }

public DateTime? IncorporatedOn { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
public class Trustee
{
public int Id { get; set; }
public string Name { get; set; }
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace SFA.DAS.ApplyService.InternalApi.UnitTests
public class GatewayApiChecksServiceTests
{
private Mock<CompaniesHouseApiClient> _companiesHouseApiClient;
private Mock<CharityCommissionApiClient> _charityCommissionApiClient;
private Mock<ICharityCommissionApiClient> _charityCommissionApiClient;
private Mock<IRoatpApiClient> _roatpApiClient;
private Mock<IInternalQnaApiClient> _qnaApiClient;
private Mock<ILogger<GatewayApiChecksService>> _logger;
Expand Down Expand Up @@ -50,7 +50,7 @@ public void Before_each_test()
_ukprn = "10001234";
_applicationId = Guid.NewGuid();
_companiesHouseApiClient = new Mock<CompaniesHouseApiClient>();
_charityCommissionApiClient = new Mock<CharityCommissionApiClient>();
_charityCommissionApiClient = new Mock<ICharityCommissionApiClient>();
_roatpApiClient = new Mock<IRoatpApiClient>();
_qnaApiClient = new Mock<IInternalQnaApiClient>();
_logger = new Mock<ILogger<GatewayApiChecksService>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class CharityCommissionProfile : Profile
{
public CharityCommissionProfile()
{
CreateMap<CharityCommissionService.Charity, Types.CharityCommission.Charity>()
CreateMap<Infrastructure.CharityCommission.Entities.Charity, Types.CharityCommission.Charity>()
.ForMember(dest => dest.CharityNumber, opt => opt.MapFrom(source => source.RegisteredCharityNumber))
.ForMember(dest => dest.CompanyNumber, opt => opt.MapFrom(source => source.RegisteredCompanyNumber))
.ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.CharityName.Trim()))
Expand All @@ -15,9 +15,13 @@ public CharityCommissionProfile()
.ForMember(dest => dest.NatureOfBusiness, opt => opt.MapFrom(source => source.NatureOfBusiness))
.ForMember(dest => dest.IncorporatedOn, opt => opt.MapFrom(source => source.RegistrationDate))
.ForMember(dest => dest.DissolvedOn, opt => opt.MapFrom(source => source.RegistrationRemovalDate))
.ForMember(dest => dest.RegisteredOfficeAddress, opt => opt.MapFrom(source => Mapper.Map<CharityCommissionService.Address, Types.CharityCommission.Address>(source.Address)))
.ForMember(dest => dest.Accounts, opt => opt.MapFrom(source => Mapper.Map<CharityCommissionService.LatestFiling, Types.CharityCommission.Accounts>(source.LatestFiling)))
.ForMember(dest => dest.Trustees, opt => opt.MapFrom(source => Mapper.Map<CharityCommissionService.Trustee[], Types.CharityCommission.Trustee[]>(source.Trustees)))
.ForMember(dest => dest.TelephoneNumber, opt => opt.MapFrom(source => source.TelephoneNumber))
.ForMember(dest => dest.EmailAddress, opt => opt.MapFrom(source => source.EmailAddress))
.ForMember(dest => dest.Website, opt => opt.MapFrom(source => source.WebsiteAddress))
.ForMember(dest => dest.RegisteredOfficeAddress, opt => opt.MapFrom(source => Mapper.Map<Infrastructure.CharityCommission.Entities.Charity, Types.CharityCommission.Address>(source)))
.ForMember(dest => dest.Accounts, opt => opt.MapFrom(source => Mapper.Map<Infrastructure.CharityCommission.Entities.Charity, Types.CharityCommission.Accounts>(source)))
.ForMember(dest => dest.Trustees, opt => opt.MapFrom(source => Mapper.Map<Infrastructure.CharityCommission.Entities.Trustee[], Types.CharityCommission.Trustee[]>(source.Trustees)))
.ForMember(dest => dest.TrusteeManualEntryRequired, opt => opt.MapFrom(source => source.Trustees == null || source.Trustees.Length == 0))
.ForAllOtherMembers(dest => dest.Ignore());
}
}
Expand All @@ -26,13 +30,13 @@ public class CharityCommissionAddressProfile : Profile
{
public CharityCommissionAddressProfile()
{
CreateMap<CharityCommissionService.Address, Types.CharityCommission.Address>()
CreateMap<Infrastructure.CharityCommission.Entities.Charity, Types.CharityCommission.Address>()
.BeforeMap((source, dest) => dest.Country = "United Kingdom")
.ForMember(dest => dest.AddressLine1, opt => opt.MapFrom(source => source.Line1))
.ForMember(dest => dest.AddressLine2, opt => opt.MapFrom(source => string.IsNullOrEmpty(source.Line3) ? null : source.Line2)) // sometimes city is on line 2
.ForMember(dest => dest.City, opt => opt.MapFrom(source => source.Line3 ?? source.Line2)) // cope for when it is on line 2, instead of line 3
.ForMember(dest => dest.County, opt => opt.MapFrom(source => source.Line4)) // not sure what line 4 is
.ForMember(dest => dest.PostalCode, opt => opt.MapFrom(source => source.Postcode))
.ForMember(dest => dest.AddressLine1, opt => opt.MapFrom(source => source.AddressLine1))
.ForMember(dest => dest.AddressLine2, opt => opt.MapFrom(source => string.IsNullOrEmpty(source.AddressLine3) ? null : source.AddressLine2)) // sometimes city is on line 2
.ForMember(dest => dest.City, opt => opt.MapFrom(source => source.AddressLine3 ?? source.AddressLine2)) // cope for when it is on line 2, instead of line 3
.ForMember(dest => dest.County, opt => opt.MapFrom(source => source.AddressLine5 ?? source.AddressLine4))
.ForMember(dest => dest.PostalCode, opt => opt.MapFrom(source => source.AddressPostcode))
.ForAllOtherMembers(dest => dest.Ignore());
}
}
Expand All @@ -41,8 +45,8 @@ public class CharityCommissionAccountsProfile : Profile
{
public CharityCommissionAccountsProfile()
{
CreateMap<CharityCommissionService.LatestFiling, Types.CharityCommission.Accounts>()
.ForMember(dest => dest.LastAccountsDate, opt => opt.ResolveUsing(source => source.AccountsPeriodDateTime > source.AnnualReturnPeriodDateTime ? source.AccountsPeriodDateTime : source.AnnualReturnPeriodDateTime))
CreateMap<Infrastructure.CharityCommission.Entities.Charity, Types.CharityCommission.Accounts>()
.ForMember(dest => dest.LastAccountsDate, opt => opt.MapFrom(source => source.LatestAccountsEndDate))
.ForAllOtherMembers(dest => dest.Ignore());
}
}
Expand All @@ -51,9 +55,8 @@ public class CharityCommissionTrusteeProfile : Profile
{
public CharityCommissionTrusteeProfile()
{
CreateMap<CharityCommissionService.Trustee, Types.CharityCommission.Trustee>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(source => source.TrusteeNumber))
.ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.TrusteeName))
CreateMap<Infrastructure.CharityCommission.Entities.Trustee, Types.CharityCommission.Trustee>()
.ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Name))
.ForAllOtherMembers(dest => dest.Ignore());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using AutoMapper;
using CharityCommissionService;
using SFA.DAS.ApplyService.Domain.CharityCommission;
using SFA.DAS.ApplyService.Domain.CompaniesHouse;
using System.Linq;

namespace SFA.DAS.ApplyService.InternalApi.AutoMapper
{
public class UkrlpCharityCommissionProfile : Profile
Expand All @@ -26,8 +24,7 @@ public class CharityTrusteeProfile : Profile
{
public CharityTrusteeProfile()
{
CreateMap<InternalApi.Types.CharityCommission.Trustee, Domain.CharityCommission.Trustee>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(source => source.Id))
CreateMap<InternalApi.Types.CharityCommission.Trustee, Trustee>()
.ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Name))
.ForAllOtherMembers(opt => opt.Ignore());
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading