public async Task <CarePackageReclaimResponse> GetProvisionalCareCharge(Guid carePackageId) { var carePackage = await _carePackageGateway .GetPackageAsync(carePackageId, PackageFields.Reclaims, true) .EnsureExistsAsync($"Care package with id {carePackageId} not found"); var provisionalCareCharge = carePackage.Reclaims .OrderBy(r => r.DateCreated) .FirstOrDefault( cc => cc.Type == ReclaimType.CareCharge && cc.SubType == ReclaimSubType.CareChargeProvisional && cc.Status != ReclaimStatus.Cancelled); var res = new CarePackageReclaimDomain(); bool hasAssessmentBeenCarried = carePackage.Reclaims.Any(cc => cc.Type == ReclaimType.CareCharge && cc.SubType != ReclaimSubType.CareChargeProvisional); if (hasAssessmentBeenCarried) { //Migrated data may have contribution without provisional. return(res.ToResponse()); } if (provisionalCareCharge == null) { return(null); } res = provisionalCareCharge?.ToDomain(); res.HasAssessmentBeenCarried = hasAssessmentBeenCarried; return(res.ToResponse()); }
public static CarePackageReclaimResponse ToResponse(this CarePackageReclaimDomain input) { return(_mapper.Map <CarePackageReclaimResponse>(input)); }
public static CarePackageReclaim ToEntity(this CarePackageReclaimDomain input) { return(_mapper.Map <CarePackageReclaim>(input)); }