Update header

This commit is contained in:
Frede Hundewadt 2023-03-21 07:19:07 +01:00
parent 243989f3b4
commit a64271559d
7 changed files with 281 additions and 274 deletions

View file

@ -1,13 +1,13 @@
// ***********************************************************************
// Assembly : FCS.Lib.Vies
// Author : FH
// Created : 04-01-2022
// Author : fhdk
// Created : 2023 01 19 10:41
//
// Last Modified By : FH
// Last Modified On : 04-01-2022
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="ViesEntityModel.cs" company="">
// Copyright (C) 2022 FCS Frede's Computer Services.
// <copyright file="ViesEntityModel.cs" company="FCS">
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -37,22 +37,27 @@ public class ViesEntityModel
/// Business entity's country code of origin
/// </summary>
public string CountryCode { get; set; } = "";
/// <summary>
/// Business entity vat number
/// </summary>
public string VatNumber { get; set; } = "";
/// <summary>
/// Request date
/// </summary>
public DateTime RequestDate { get; set; }
/// <summary>
/// Valid flag
/// </summary>
public bool Valid { get; set; }
/// <summary>
/// Business entity name
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Business entity address
/// </summary>

View file

@ -1,13 +1,13 @@
// ***********************************************************************
// Assembly : FCS.Lib.Vies
// Author : FH
// Created : 04-01-2022
// Author : fhdk
// Created : 2022 12 17 13:33
//
// Last Modified By : FH
// Last Modified On : 04-01-2022
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="ViesHttpRequest.cs" company="">
// Copyright (C) 2022 FCS Frede's Computer Services.
// <copyright file="ViesHttpRequest.cs" company="FCS">
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -23,12 +23,13 @@
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace FCS.Lib.Vies
{
namespace FCS.Lib.Vies;
/// <summary>
/// http request to vies registrar
/// </summary>
@ -44,19 +45,20 @@ namespace FCS.Lib.Vies
/// <returns>Vies Response View model</returns>
/// <see cref="ViesResponseView"/>
/// <remarks>Service http://ec.europa.eu/taxation_customs/vies/services/checkVatService</remarks>
public async Task<ViesResponseView> GetResponseAsync(string endpoint, string countryCode, string vatNumber, string userAgent)
public async Task<ViesResponseView> GetResponseAsync(string endpoint, string countryCode, string vatNumber,
string userAgent)
{
var xml = new StringBuilder();
xml.Append($"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\">");
xml.Append($"<soapenv:Header/>");
xml.Append($"<soapenv:Body>");
xml.Append($"<urn:checkVat>");
xml.Append(
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\">");
xml.Append("<soapenv:Header/>");
xml.Append("<soapenv:Body>");
xml.Append("<urn:checkVat>");
xml.Append($"<urn:countryCode>{countryCode.ToUpperInvariant()}</urn:countryCode>");
xml.Append($"<urn:vatNumber>{vatNumber}</urn:vatNumber>");
xml.Append($"</urn:checkVat>");
xml.Append($"</soapenv:Body>");
xml.Append($"</soapenv:Envelope>");
xml.Append("</urn:checkVat>");
xml.Append("</soapenv:Body>");
xml.Append("</soapenv:Envelope>");
using var content = new StringContent(xml.ToString(), Encoding.UTF8, "text/xml");
@ -76,4 +78,3 @@ namespace FCS.Lib.Vies
};
}
}
}

View file

@ -1,13 +1,13 @@
// ***********************************************************************
// Assembly : FCS.Lib.Vies
// Author : FH
// Created : 04-01-2022
// Author : fhdk
// Created : 2023 01 19 10:41
//
// Last Modified By : FH
// Last Modified On : 04-01-2022
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="ViesQuery.cs" company="">
// Copyright (C) 2022 FCS Frede's Computer Services.
// <copyright file="ViesQuery.cs" company="FCS">
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -23,6 +23,7 @@
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Lib.Vies;
/// <summary>

View file

@ -1,13 +1,13 @@
// ***********************************************************************
// Assembly : FCS.Lib.Vies
// Author : FH
// Created : 04-01-2022
// Author : fhdk
// Created : 2022 12 17 13:33
//
// Last Modified By : FH
// Last Modified On : 04-01-2022
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="ViesQueryValidator.cs" company="">
// Copyright (C) 2022 FCS Frede's Computer Services.
// <copyright file="ViesQueryValidator.cs" company="FCS">
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the

View file

@ -1,13 +1,13 @@
// ***********************************************************************
// Assembly : FCS.Lib.Vies
// Author : FH
// Created : 04-01-2022
// Author : fhdk
// Created : 2023 01 19 10:41
//
// Last Modified By : FH
// Last Modified On : 04-01-2022
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="ViesResultParser.cs" company="">
// Copyright (C) 2022 FCS Frede's Computer Services.
// <copyright file="ViesResponseParser.cs" company="FCS">
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -46,7 +46,7 @@ public class ViesResponseParser
var xml = XDocument.Parse(responseData);
var x = xml.Descendants().Where(c => c.Name.LocalName == "checkVatResponse")
.Select(x => new ViesEntityModel()
.Select(x => new ViesEntityModel
{
CountryCode = (string)x.Element(x.Name.Namespace + "countryCode"),
VatNumber = (string)x.Element(x.Name.Namespace + "vatNumber"),

View file

@ -1,13 +1,13 @@
// ***********************************************************************
// Assembly : FCS.Lib.Vies
// Author : FH
// Created : 04-01-2022
// Author : fhdk
// Created : 2022 12 17 13:33
//
// Last Modified By : FH
// Last Modified On : 04-01-2022
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="ViesResponseView.cs" company="">
// Copyright (C) 2022 FCS Frede's Computer Services.
// <copyright file="ViesResponseView.cs" company="FCS">
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -23,6 +23,7 @@
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Net;
namespace FCS.Lib.Vies;
@ -36,10 +37,12 @@ public class ViesResponseView
/// http request status code
/// </summary>
public HttpStatusCode Code { get; set; }
/// <summary>
/// boolean indicating success
/// </summary>
public bool IsSuccessStatusCode { get; set; }
/// <summary>
/// response message
/// </summary>

View file

@ -1,37 +1,35 @@
// ***********************************************************************
// Assembly : FCS.Lib.Virk
// Author : FH
// Created : 02-21-2022
// Assembly : FCS.Lib.Vies
// Author : fhdk
// Created : 2023 02 02 11:05
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="VrCvrMapper.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services.
// <copyright file="ViesVatInfoMapper.cs" company="FCS">
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq.Expressions;
using FCS.Lib.Common;
namespace FCS.Lib.Vies
{
namespace FCS.Lib.Vies;
/// <summary>
/// Vies vat info mapper
/// </summary>
@ -136,4 +134,3 @@ namespace FCS.Lib.Vies
return c;
}
}
}