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 // Assembly : FCS.Lib.Vies
// Author : FH // Author : fhdk
// Created : 04-01-2022 // Created : 2023 01 19 10:41
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 04-01-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="ViesEntityModel.cs" company=""> // <copyright file="ViesEntityModel.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 // 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 /// Business entity's country code of origin
/// </summary> /// </summary>
public string CountryCode { get; set; } = ""; public string CountryCode { get; set; } = "";
/// <summary> /// <summary>
/// Business entity vat number /// Business entity vat number
/// </summary> /// </summary>
public string VatNumber { get; set; } = ""; public string VatNumber { get; set; } = "";
/// <summary> /// <summary>
/// Request date /// Request date
/// </summary> /// </summary>
public DateTime RequestDate { get; set; } public DateTime RequestDate { get; set; }
/// <summary> /// <summary>
/// Valid flag /// Valid flag
/// </summary> /// </summary>
public bool Valid { get; set; } public bool Valid { get; set; }
/// <summary> /// <summary>
/// Business entity name /// Business entity name
/// </summary> /// </summary>
public string Name { get; set; } = ""; public string Name { get; set; } = "";
/// <summary> /// <summary>
/// Business entity address /// Business entity address
/// </summary> /// </summary>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,42 +1,40 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Virk // Assembly : FCS.Lib.Vies
// Author : FH // Author : fhdk
// Created : 02-21-2022 // Created : 2023 02 02 11:05
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="VrCvrMapper.cs" company="FCS"> // <copyright file="ViesVatInfoMapper.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // 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 // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 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 // 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/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq.Expressions;
using FCS.Lib.Common; using FCS.Lib.Common;
namespace FCS.Lib.Vies namespace FCS.Lib.Vies;
/// <summary>
/// Vies vat info mapper
/// </summary>
public class ViesVatInfoMapper
{ {
/// <summary>
/// Vies vat info mapper
/// </summary>
public class ViesVatInfoMapper
{
/// <summary> /// <summary>
/// map vies response to Crm /// map vies response to Crm
/// </summary> /// </summary>
@ -135,5 +133,4 @@ namespace FCS.Lib.Vies
}); });
return c; return c;
} }
}
} }