private void CreateContact1Change() { string accountno = string.Empty; string randomReference = string.Empty; do { randomReference = CreateRandomReference(); } while (ReferenceNumberExists(randomReference) && !AccountnoExists(randomReference)); List <CONTACT1ChangeTracking_Result> results = new List <CONTACT1ChangeTracking_Result>(); CONTACT1ChangeTracking_Result result = new CONTACT1ChangeTracking_Result() { contactChanged = 1, ACCOUNTNO = GetAccountnoFromKey5(randomReference) }; results.Add(result); List <ResultsObject> ros = _resultsProcessor.ProcessAPICalls(results, new List <CONTACT2ChangeTracking_Result>(), new List <CONTSUPPChangeTracking_Result>()); Assert.IsTrue(ros[0].Responses.Count == 5); Assert.IsTrue(ros[0].Responses[0].URL.Contains("/people/")); Assert.IsTrue(ros[0].Responses[4].URL.Contains("/person/phone_numbers")); Assert.IsTrue(ros[0].Responses[2].URL.Contains("/person/email_addresses")); Assert.IsTrue(ros[0].Responses[0].SendResponse == Core.Enums.Enums.SendResponse.OK); Assert.IsTrue(ros[0].Responses[4].SendResponse == Core.Enums.Enums.SendResponse.OK); Assert.IsTrue(ros[0].Responses[2].SendResponse == Core.Enums.Enums.SendResponse.OK); }
public static bool CheckForFullAddressUpdate(CONTACT1ChangeTracking_Result ctResult) { bool fullUpdate = false; if (ctResult.address1Changed_bool || ctResult.address2Changed_bool) { fullUpdate = true; } return(fullUpdate); }
public ResultsObject DoAddressUpdate(Address address, ResultsObject ro, CONTACT1ChangeTracking_Result ctResult) { string dataapi_addressId = _apiClient.GetExistingAddress(address.first_line, address.postcode); if (!string.IsNullOrEmpty(dataapi_addressId)) { bool fullAddressUpdate = AddressHelper.CheckForFullAddressUpdate(ctResult); if (!fullAddressUpdate) { bool othersLinkedToThisAddress = _apiClient.CheckForOthersLinkedToThisAddress(dataapi_addressId); if (othersLinkedToThisAddress) { string personId = _apiClient.GetPersonId(ro.ReferenceNumber); bool imLinkedToAddress = _apiClient.CheckIfImLinkedToAddress(dataapi_addressId, personId); if (!imLinkedToAddress) { CreateAddress(address, ro); } } else { _apiClient.AmendCurrentAddress(address, ro, dataapi_addressId); } } else { string personId = _apiClient.GetPersonId(ro.ReferenceNumber); bool imLinkedToAddress = _apiClient.CheckIfImLinkedToAddress(dataapi_addressId, personId); if (!imLinkedToAddress) { CreateAddress(address, ro); } } } else { CreateAddress(address, ro); } FINISH: return(ro); }
public ResultsObject ProcessContact1Requests(CONTACT1ChangeTracking_Result ctResult) { ResultsObject ro = new ResultsObject(); ro.Responses = new List <ResponseDetails>(); ro = _gm_repo.GetReferenceNumberFromAccountno(ctResult.ACCOUNTNO, ro); ro.Accountno = ctResult.ACCOUNTNO; if (ctResult.key5Changed_bool) { string changedValue = _gm_repo.GetKey5(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdatePersonRequest(Enums.SendRequest.KEY5, ro, changedValue); } if (ctResult.contactChanged_bool) { string changedValue = _gm_repo.GetContact(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdatePersonRequest(Enums.SendRequest.CONTACT, ro, changedValue); } if (ctResult.secrChanged_bool) { string changedValue = _gm_repo.GetSecr(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdatePersonRequest(Enums.SendRequest.SECR, ro, changedValue); } if (ctResult.LastnameChanged_bool) { string changedValue = _gm_repo.GetLastname(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdatePersonRequest(Enums.SendRequest.LASTNAME, ro, changedValue); } if (ctResult.phone1Changed_bool) { string changedValue = _gm_repo.GetPhone1(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdatePhoneNumberRequest(Enums.SendRequest.PHONE1, ro, changedValue); } if (ctResult.phone2Changed_bool) { string changedValue = _gm_repo.GetPhone2(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdatePhoneNumberRequest(Enums.SendRequest.PHONE2, ro, changedValue); } if (ctResult.phone3Changed_bool) { string changedValue = _gm_repo.GetPhone3(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdatePhoneNumberRequest(Enums.SendRequest.PHONE3, ro, changedValue); } if (ctResult.key3Changed_bool) { //NINO string changedValue = _gm_repo.GetKey3(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdateNINORequest(ro, changedValue); } if (ctResult.key4Changed_bool) { //UTR string changedValue = _gm_repo.GetKey4(ctResult.ACCOUNTNO); ro = _apiClient.SendUpdateUTRRequest(ro, changedValue); } if (ctResult.address1Changed_bool || ctResult.address2Changed_bool || ctResult.cityChanged_bool || ctResult.countryChanged_bool || ctResult.stateChanged_bool || ctResult.zipChanged_bool) { Address address = _gm_repo.GetAddress(ctResult.ACCOUNTNO); DoAddressUpdate(address, ro, ctResult); } _applicationLogging.Log(ro); return(ro); }