public void ValidateAddress(NodeCoreAdminClient adminClient) { Console.WriteLine("GetBalance"); Console.WriteLine("NC_CLI command: validateaddress <address>"); String address = "V4m6JbAs8VaEa3wwemJPgsPRY8ETdk"; ValidateAddressRequest request = new ValidateAddressRequest(); request.Address = Utils.ConvertAddressToByteString(address); ValidateAddressReply reply = adminClient.AdminClient.ValidateAddress(request); if (reply.Success) { Console.WriteLine("IsRemote: {0}", reply.IsRemote); Console.WriteLine("PublicKey: {0}", reply.PublicKey.ToHexString()); } else { Console.WriteLine("Could not validate address: '{0}'", address); } Console.WriteLine("--------------------"); Console.WriteLine(); }
public async Task <ValidateAddressResponse> ValidateAddress(ValidateAddressRequest validateAddressRequest) { ValidateModel(validateAddressRequest); var response = await PostAsJsonAsync("/addresses/validate", JsonConvert.SerializeObject(validateAddressRequest)).ConfigureAwait(false); return(JsonConvert.DeserializeObject <ValidateAddressResponse>( await response.Content.ReadAsStringAsync().ConfigureAwait(false))); }
public async Task <bool> ValidateAddress(string address, ulong amount, bool tracked) { var req = new ValidateAddressRequest(); req.Address = address; req.Amount = amount; req.Tracked = tracked; var res = await client.ValidateAddressAsync(req); return(res.Value); }
public void Init() { instance = new ValidateAddressRequest(); }
public override bool ValidateAddress(ShippingAddress_V02 shippingAddress, out String errorCode, out ServiceProvider.AddressValidationSvc.Address avsAddress) { errorCode = string.Empty; var request = new ValidateAddressRequest(); var address = new ServiceProvider.AddressValidationSvc.Address(); address.City = shippingAddress.Address.City; address.CountryCode = shippingAddress.Address.Country; address.Line1 = shippingAddress.Address.Line1; address.PostalCode = shippingAddress.Address.PostalCode; address.StateProvinceTerritory = shippingAddress.Address.StateProvinceTerritory; request.Address = address; // Avoid validation where ValidatePostalCode is disabled if (!HLConfigManager.Configurations.AddressingConfiguration.ValidatePostalCode) { avsAddress = request.Address; return(true); } var proxy = ServiceClientProvider.GetAddressValidationServiceProxy(); try { var response = proxy.ValidateAddress(new ValidateAddressRequest1(request)).ValidateAddressResponse; if (response != null) { if (response.ValidationResult.Value.ToUpper() == "FOUND" || response.ValidationResult.ErrorCode.ToUpper() == "E421" || response.ValidationResult.ErrorCode.ToUpper() == "E422" || response.ValidationResult.ErrorCode.ToUpper() == "E427" || response.ValidationResult.ErrorCode.ToUpper() == "E412" || response.ValidationResult.ErrorCode.ToUpper() == "E413" || response.ValidationResult.ErrorCode.ToUpper() == "E423" || response.ValidationResult.ErrorCode.ToUpper() == "E425" || response.ValidationResult.ErrorCode.ToUpper() == "E420" || response.ValidationResult.ErrorCode.ToUpper() == "E430" || response.ValidationResult.ErrorCode.ToUpper() == "E600") { // address is valid errorCode = response.ValidationResult.ErrorCode; avsAddress = response.Address; return(true); } } // address is invalid errorCode = response.ValidationResult.ErrorCode; avsAddress = response.Address; return(false); } catch (Exception ex) { LoggerHelper.Error(string.Format("AVS Address Validation Failed:{0}", ex.Message)); errorCode = ex.Message; avsAddress = null; return(false); } }