private async Task <bool> UploadInsuranceClaims() { if (_foundPerson.InsuranceClaims == null) { return(true); } try { _logger.LogDebug($"Attempting to create insurance claims records for SearchRequest[{_searchRequest.SearchRequestId}]"); foreach (InsuranceClaim claim in _foundPerson.InsuranceClaims) { ICBCClaimEntity icbcClaim = _mapper.Map <ICBCClaimEntity>(claim); icbcClaim.SearchRequest = _searchRequest; icbcClaim.InformationSource = _providerDynamicsID; icbcClaim.Person = _returnedPerson; SSG_Asset_ICBCClaim ssg_claim = await _searchRequestService.CreateInsuranceClaim(icbcClaim, _cancellationToken); await CreateResultTransaction(ssg_claim); if (claim.ClaimCentre != null && claim.ClaimCentre.ContactNumber != null) { foreach (Phone phone in claim.ClaimCentre.ContactNumber) { SimplePhoneNumberEntity phoneForAsset = _mapper.Map <SimplePhoneNumberEntity>(phone); phoneForAsset.SSG_Asset_ICBCClaim = ssg_claim; await _searchRequestService.CreateSimplePhoneNumber(phoneForAsset, _cancellationToken); } } if (claim.InsuredParties != null) { foreach (InvolvedParty party in claim.InsuredParties) { InvolvedPartyEntity involvedParty = _mapper.Map <InvolvedPartyEntity>(party); involvedParty.SSG_Asset_ICBCClaim = ssg_claim; await _searchRequestService.CreateInvolvedParty(involvedParty, _cancellationToken); } } } return(true); } catch (Exception ex) { LogException(ex); return(false); } }
public void SSG_ICBCClaim_should_map_to_InsuranceClaim_correctly() { SSG_Asset_ICBCClaim icbcClaim = new SSG_Asset_ICBCClaim { ClaimNumber = "claimNumber", ClaimType = "ClaimType", ClaimAmount = "ClaimAmount", ClaimCenterLocationCode = "claimCentre", AdjusterFirstName = "adjustfirstName", AdjusterLastName = "adjustlastName", AdjusterPhoneNumber = "phonenumber", SupplierCountrySubdivisionCode = "BC" }; InsuranceClaim claim = _mapper.Map <InsuranceClaim>(icbcClaim); Assert.AreEqual("adjustfirstName", claim.Adjustor.FirstName); Assert.AreEqual("ClaimAmount", claim.ClaimAmount); Assert.AreEqual("claimCentre", claim.ClaimCentre.Location); Assert.AreEqual("phonenumber", claim.AdjustorPhone.PhoneNumber); }
public async Task insurance_does_not_contain_same_involvedParty_Exists_should_return_empty_guid() { DuplicateDetectionService._configs = null; Guid existedInvolvedPartyID = Guid.NewGuid(); SSG_Asset_ICBCClaim insurance = new SSG_Asset_ICBCClaim() { SSG_InvolvedParties = new List <SSG_InvolvedParty>() { new SSG_InvolvedParty() { FirstName = "firstname", LastName = "lastname", InvolvedPartyId = existedInvolvedPartyID } }.ToArray() }; InvolvedPartyEntity entity = new InvolvedPartyEntity() { FirstName = "testfirstname", LastName = "lastname" }; Guid guid = await _sut.Exists(insurance, entity); Assert.AreEqual(Guid.Empty, guid); }
public async Task insurance_does_not_contain_same_simplePhone_Exists_should_return_empty_guid() { DuplicateDetectionService._configs = null; Guid existedSimplePhoneID = Guid.NewGuid(); SSG_Asset_ICBCClaim insurance = new SSG_Asset_ICBCClaim() { SSG_SimplePhoneNumbers = new List <SSG_SimplePhoneNumber>() { new SSG_SimplePhoneNumber() { PhoneNumber = "11111", Extension = "444", SimplePhoneNumberId = existedSimplePhoneID } }.ToArray() }; SimplePhoneNumberEntity entity = new SimplePhoneNumberEntity() { PhoneNumber = "11111", Extension = "333" }; Guid guid = await _sut.Exists(insurance, entity); Assert.AreEqual(Guid.Empty, guid); }
public async Task <SSG_SearchRequestResponse> GetSearchResponse(Guid responseId, CancellationToken cancellationToken) { try { SSG_SearchRequestResponse ssgSearchResponse = await _oDataClient .For <SSG_SearchRequestResponse>() .Key(responseId) .Expand(x => x.SSG_BankInfos) .Expand(x => x.SSG_Asset_Others) .Expand(x => x.SSG_Addresses) .Expand(x => x.SSG_Aliases) .Expand(x => x.SSG_Asset_ICBCClaims) .Expand(x => x.SSG_Asset_Vehicles) .Expand(x => x.SSG_Asset_WorkSafeBcClaims) .Expand(x => x.SSG_Employments) .Expand(x => x.SSG_Identifiers) .Expand(x => x.SSG_Identities) .Expand(x => x.SSG_Noteses) .Expand(x => x.SSG_Persons) .Expand(x => x.SSG_PhoneNumbers) .Expand(x => x.SSG_SearchRequests) .Expand(x => x.SSG_Asset_Investments) .Expand(x => x.SSG_SafetyConcernDetails) .Expand(x => x.SSG_Asset_PensionDisablilitys) .Expand(x => x.SSG_Asset_RealEstatePropertys) .Expand(x => x.SSG_Emails) .Expand(x => x.SSG_Electronicas) .FindEntryAsync(cancellationToken); if (ssgSearchResponse.SSG_SearchRequests != null) { Guid id = ssgSearchResponse.SSG_SearchRequests[0].SearchRequestId; ssgSearchResponse.SSG_SearchRequests[0] = await _oDataClient.For <SSG_SearchRequest>() .Key(id) .Expand(x => x.SearchReason) .FindEntryAsync(cancellationToken); } if (ssgSearchResponse.SSG_Asset_WorkSafeBcClaims != null) { foreach (SSG_Asset_WorkSafeBcClaim claim in ssgSearchResponse.SSG_Asset_WorkSafeBcClaims) { SSG_Asset_WorkSafeBcClaim c = await _oDataClient.For <SSG_Asset_WorkSafeBcClaim>() .Key(claim.CompensationClaimId) .Expand(x => x.BankingInformation) .Expand(x => x.Employment) .FindEntryAsync(cancellationToken); claim.BankingInformation = c.BankingInformation; claim.Employment = c.Employment; } } if (ssgSearchResponse.SSG_Addresses != null) { foreach (SSG_Address address in ssgSearchResponse.SSG_Addresses) { SSG_Address addr = await _oDataClient.For <SSG_Address>() .Key(address.AddressId) .Expand(x => x.CountrySubdivision) .FindEntryAsync(cancellationToken); if (addr.CountrySubdivision != null) { address.CountrySubdivisionText = addr.CountrySubdivision.ProvinceCode; } } } if (ssgSearchResponse.SSG_Asset_ICBCClaims != null) { foreach (SSG_Asset_ICBCClaim claim in ssgSearchResponse.SSG_Asset_ICBCClaims) { if (claim.CountrySubdivision != null) { SSG_Asset_ICBCClaim expandedClaim = await _oDataClient.For <SSG_Asset_ICBCClaim>() .Key(claim.ICBCClaimId) .Expand(x => x.CountrySubdivision) .FindEntryAsync(cancellationToken); if (expandedClaim.CountrySubdivision != null) { claim.SupplierCountrySubdivisionCode = expandedClaim.CountrySubdivision.ProvinceCode; } } } } if (ssgSearchResponse.SSG_Employments != null) { foreach (SSG_Employment e in ssgSearchResponse.SSG_Employments) { SSG_Employment expandedEmployment = await _oDataClient.For <SSG_Employment>() .Key(e.EmploymentId) .Expand(x => x.CountrySubdivision) .FindEntryAsync(cancellationToken); if (expandedEmployment.CountrySubdivision != null) { e.CountrySubdivisionText = expandedEmployment.CountrySubdivision.ProvinceCode; } SSG_Employment temp = await _oDataClient.For <SSG_Employment>() .Key(e.EmploymentId) .Expand(x => x.SSG_EmploymentContacts) .FindEntryAsync(cancellationToken); if (temp.SSG_EmploymentContacts != null) { e.SSG_EmploymentContacts = temp.SSG_EmploymentContacts; } } } return(ssgSearchResponse); } catch (Exception ex) { throw ex; } }