public List <AddressData_V02> GetAddressData(string searchTerm) { var addressesFound = new List <AddressData_V02>(); try { var proxy = ServiceClientProvider.GetShippingServiceProxy(); var request = new SearchAddressDataRequest_V01 { SearchText = searchTerm }; var response = proxy.GetAddressData(new GetAddressDataRequest(request)); if (response != null) { var result = response.GetAddressDataResult as SearchAddressDataResponse_V01; if (result.Status == ServiceResponseStatusType.Success) { if (result.AddressData != null && result.AddressData.Count > 0) { addressesFound.AddRange(result.AddressData); } } return(addressesFound); } } catch (Exception ex) { LoggerHelper.Error(string.Format("AddressSearch error: Country {0}, error: {1}", "BR", ex)); } return(addressesFound); }
public override List <Address_V01> AddressSearch(string SearchTerm) { var addrFound = new List <Address_V01>(); try { var proxy = ServiceClientProvider.GetShippingServiceProxy(); var request = new SearchAddressDataRequest_V01 { SearchText = SearchTerm }; var response = proxy.GetAddressData(new GetAddressDataRequest(request)).GetAddressDataResult as SearchAddressDataResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { if (response.AddressData != null && response.AddressData.Count > 0) { AddressData_V02 addressData = response.AddressData.First(); addrFound.Add(new Address_V01 { Country = "BR", StateProvinceTerritory = addressData.State, City = addressData.City, Line1 = addressData.Street, Line2 = addressData.Neighbourhood, PostalCode = addressData.PostCode } ); } return(addrFound); } } catch (Exception ex) { LoggerHelper.Error(string.Format("AddressSearch error: Country {0}, error: {1}", "BR", ex)); } return(addrFound); }