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" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pvWay.ViesApi.Core --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: pvWay.ViesApi.Core, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 380 9/19/2020
1.0.0 234 6/20/2020