pvWay.ViesApi.Core
1.0.1
Very simple service that checks a VAT number returning whether or not the number is valid, the official company name and address when available using the EU web service
Install-Package pvWay.ViesApi.Core -Version 1.0.1
dotnet add package pvWay.ViesApi.Core --version 1.0.1
<PackageReference Include="pvWay.ViesApi.Core" Version="1.0.1" />
paket add pvWay.ViesApi.Core --version 1.0.1
#r "nuget: pvWay.ViesApi.Core, 1.0.1"
// Install pvWay.ViesApi.Core as a Cake Addin
#addin nuget:?package=pvWay.ViesApi.Core&version=1.0.1
// Install pvWay.ViesApi.Core as a Cake Tool
#tool nuget:?package=pvWay.ViesApi.Core&version=1.0.1
Vies API for dotNet Core by pvWay
Tiny async service that checks a VAT number against the European Vat Number database and returns whether or not the number is valid and - when available - the name and the address of the registered company
Interfaces
IViesResult
public interface IViesResult
{
bool Success { get; }
bool Failure { get; }
/// <summary>
/// Exception is only set on Failure
/// </summary>
Exception Exception { get; }
/// <summary>
/// Data is only set on Success
/// </summary>
IViesData Data { get; }
}
IViesData
public interface IViesData
{
bool Valid { get; }
string CountryCode { get; }
string VatNumber { get; }
string Name { get; }
string Address { get; }
}
IViesService
public interface IViesService
{
Task<IViesResult> CheckVatAsync(
string countryCode, string vatNumber);
}
Usage
using System;
using pvWay.MethodResultWrapper.Core;
using pvWay.ViesApi.Core;
namespace ViesApiConsumer.Core
{
internal static class Program
{
private static void Main(/*string[] args*/)
{
var viesService = new ViesService();
var checkVat = viesService.CheckVatAsync("BE", "0459415853").Result;
if (checkVat.Failure)
{
Console.WriteLine(checkVat.Exception);
}
else
{
var viesRes = checkVat.Data;
Console.WriteLine(viesRes.Valid);
Console.WriteLine(viesRes.CountryCode);
Console.WriteLine(viesRes.VatNumber);
Console.WriteLine(viesRes.Name);
Console.WriteLine(viesRes.Address);
}
}
}
}
Happi Coding
Vies API for dotNet Core by pvWay
Tiny async service that checks a VAT number against the European Vat Number database and returns whether or not the number is valid and - when available - the name and the address of the registered company
Interfaces
IViesResult
public interface IViesResult
{
bool Success { get; }
bool Failure { get; }
/// <summary>
/// Exception is only set on Failure
/// </summary>
Exception Exception { get; }
/// <summary>
/// Data is only set on Success
/// </summary>
IViesData Data { get; }
}
IViesData
public interface IViesData
{
bool Valid { get; }
string CountryCode { get; }
string VatNumber { get; }
string Name { get; }
string Address { get; }
}
IViesService
public interface IViesService
{
Task<IViesResult> CheckVatAsync(
string countryCode, string vatNumber);
}
Usage
using System;
using pvWay.MethodResultWrapper.Core;
using pvWay.ViesApi.Core;
namespace ViesApiConsumer.Core
{
internal static class Program
{
private static void Main(/*string[] args*/)
{
var viesService = new ViesService();
var checkVat = viesService.CheckVatAsync("BE", "0459415853").Result;
if (checkVat.Failure)
{
Console.WriteLine(checkVat.Exception);
}
else
{
var viesRes = checkVat.Data;
Console.WriteLine(viesRes.Valid);
Console.WriteLine(viesRes.CountryCode);
Console.WriteLine(viesRes.VatNumber);
Console.WriteLine(viesRes.Name);
Console.WriteLine(viesRes.Address);
}
}
}
}
Happi Coding
Release Notes
remove dependency with MethodResult
Dependencies
-
.NETCoreApp 3.1
- System.ServiceModel.Duplex (>= 4.4.4)
- System.ServiceModel.Http (>= 4.4.4)
- System.ServiceModel.NetTcp (>= 4.4.4)
- System.ServiceModel.Security (>= 4.4.4)
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.