Skip to content

Commit

Permalink
fix category changes (#747)
Browse files Browse the repository at this point in the history
# Description

This PR includes the following proposed change(s):

- fix category change, document changes and update contact
  • Loading branch information
peggy-quartech authored Feb 7, 2024
1 parent ecdb938 commit f996dfe
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/Spd.Manager.Licence/SecurityWorkerAppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,18 @@ public async Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceApp
else
await _licenceAppRepository.CommitLicenceApplicationAsync(createLicResponse.LicenceAppId, ApplicationStatusEnum.PaymentPending, ct);

return new WorkerLicenceCommandResponse()
{
LicenceAppId = createLicResponse.LicenceAppId,
Cost = price.LicenceFees.FirstOrDefault()?.Amount
return new WorkerLicenceCommandResponse()
{
LicenceAppId = createLicResponse.LicenceAppId,
Cost = price.LicenceFees.FirstOrDefault()?.Amount
};
}
else
{
//update contact directly
await _contactRepository.ManageAsync(_mapper.Map<UpdateContactCmd>(request), ct);
UpdateContactCmd updateCmd = _mapper.Map<UpdateContactCmd>(request);
updateCmd.Id = originalApp.ContactId ?? Guid.Empty;
await _contactRepository.ManageAsync(updateCmd, ct);
return new WorkerLicenceCommandResponse() { LicenceAppId = createLicResponse?.LicenceAppId, Cost = 0 };
}
}
Expand Down Expand Up @@ -456,9 +458,17 @@ private async Task<ChangeSpec> MakeChanges(LicenceApplicationResp originalApp, W
newList.Sort();
List<WorkerCategoryTypeCode> originalList = originalApp.CategoryCodes.Select(c => Enum.Parse<WorkerCategoryTypeCode>(c.ToString())).ToList();
originalList.Sort();
if (newList.SequenceEqual(originalList)) changes.CategoriesChanged = true;
if (!newList.SequenceEqual(originalList)) changes.CategoriesChanged = true;
}

IEnumerable<LicAppFileInfo> items = await GetAllNewDocsInfo(newApp.DocumentKeyCodes, ct);
//if any new doc contains category document, we think categorieschanged.
if (!changes.CategoriesChanged)
{
changes.CategoriesChanged = items.Any(i => i.LicenceDocumentTypeCode.ToString().StartsWith("Category"));
}


//DogRestraintsChanged
if (newApp.UseDogs != originalApp.UseDogs ||
newApp.CarryAndUseRestraints != originalApp.CarryAndUseRestraints ||
Expand All @@ -469,8 +479,6 @@ private async Task<ChangeSpec> MakeChanges(LicenceApplicationResp originalApp, W
changes.DogRestraintsChanged = true;
}

IEnumerable<LicAppFileInfo> items = await GetAllNewDocsInfo(newApp.DocumentKeyCodes, ct);

//PeaceOfficerStatusChanged: check if Hold a Position with Peace Officer Status changed, create task with high priority, assign to Licensing CS team
PoliceOfficerRoleCode? originalRoleCode = originalApp.PoliceOfficerRoleCode == null ? null
: Enum.Parse<PoliceOfficerRoleCode>(originalApp.PoliceOfficerRoleCode.ToString());
Expand Down

0 comments on commit f996dfe

Please sign in to comment.