pvWay.ViesApi.Core 1.0.1

dotnet add package pvWay.ViesApi.Core --version 1.0.1
NuGet\Install-Package pvWay.ViesApi.Core -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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
#r "nuget: pvWay.ViesApi.Core, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. 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

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

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 1,768 9/19/2020
1.0.0 507 6/20/2020

remove dependency with MethodResult