Skip to content

Commit

Permalink
licence holder name (#885)
Browse files Browse the repository at this point in the history
# Description

This PR includes the following proposed change(s):

- {List all the changes, if possible add the jira ticket #}
  • Loading branch information
peggy-quartech authored Mar 21, 2024
1 parent 38d31a2 commit 5cf0736
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Spd.Manager.Licence/LicenceContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public record LicenceResponse
public DateOnly ExpiryDate { get; set; }
public WorkerLicenceTypeCode? WorkerLicenceTypeCode { get; set; }
public LicenceTermCode? LicenceTermCode { get; set; }
public string? LicenceHolderFirstName { get; set; }
public string? LicenceHolderLastName { get; set; }
public string? LicenceHolderName { get; set; }
public string? NameOnCard { get; set; }
};

Expand Down
10 changes: 9 additions & 1 deletion src/Spd.Manager.Licence/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public Mappings()
.ForMember(d => d.ResidentialAddress, opt => opt.MapFrom(s => s.ResidentialAddressData))
.ForMember(d => d.MailingAddress, opt => opt.MapFrom(s => s.MailingAddressData));

CreateMap<LicenceResp, LicenceResponse>();
CreateMap<LicenceResp, LicenceResponse>()
.ForMember(d => d.LicenceHolderName, opt => opt.MapFrom(s => GetHolderName(s.LicenceHolderFirstName, s.LicenceHolderMiddleName1, s.LicenceHolderLastName)));

CreateMap<LicenceFeeResp, LicenceFeeResponse>();

Expand Down Expand Up @@ -434,6 +435,13 @@ public static List<ArmouredVehiclePermitReasonCode> GetArmouredVehiclePermitReas
{LicenceDocumentTypeCode.BodyArmourRationale, DocumentTypeEnum.BodyArmourRationale},
}.ToImmutableDictionary();

private string GetHolderName(string firstName, string middleName, string lastName)
{
string fn = firstName == null ? string.Empty : firstName.Trim();
string mn = middleName == null ? string.Empty : middleName.Trim();
string ln = lastName == null ? string.Empty : lastName.Trim();
return ($"{fn} {mn}".Trim() + " " + ln).Trim();
}
}

internal class BcscAddress
Expand Down
1 change: 1 addition & 0 deletions src/Spd.Resource.Repository/Licence/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public record LicenceResp()
public Guid? LicenceHolderId { get; set; }
public string? LicenceHolderFirstName { get; set; }
public string? LicenceHolderLastName { get; set; }
public string? LicenceHolderMiddleName1 { get; set; }
public LicenceStatusEnum LicenceStatusCode { get; set; }
public string? NameOnCard { get; set; }
}
Expand Down
1 change: 1 addition & 0 deletions src/Spd.Resource.Repository/Licence/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public Mappings()
.ForMember(d => d.LicenceHolderFirstName, opt => opt.MapFrom(s => s.spd_LicenceHolder_contact.firstname))
.ForMember(d => d.LicenceStatusCode, opt => opt.MapFrom(s => GetLicenceStatusEnum(s.statuscode)))
.ForMember(d => d.LicenceHolderLastName, opt => opt.MapFrom(s => s.spd_LicenceHolder_contact.lastname))
.ForMember(d => d.LicenceHolderMiddleName1, opt => opt.MapFrom(s => s.spd_LicenceHolder_contact.spd_middlename1))
.ForMember(d => d.NameOnCard, opt => opt.MapFrom(s => s.spd_nameonlicence));
}

Expand Down

0 comments on commit 5cf0736

Please sign in to comment.