diff --git a/BrAddressModel.cs b/BrAddressModel.cs index 4794d15..b311b47 100644 --- a/BrAddressModel.cs +++ b/BrAddressModel.cs @@ -1,25 +1,25 @@ // *********************************************************************** // Assembly : FCS.Lib.BrReg -// Author : FH -// Created : 04-06-2022 -// -// Last Modified By : FH -// Last Modified On : 04-06-2022 +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 // *********************************************************************** -// -// Copyright (C) 2022 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 -// 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 -// GNU Affero General Public License for more details. -// -// 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 (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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] // // // *********************************************************************** @@ -37,26 +37,32 @@ public class BrAddressModel /// entity country /// public string Land { get; set; } = ""; + /// /// entity country code /// public string Landkode { get; set; } = ""; + /// /// entity zip code /// public string Postnummer { get; set; } = ""; + /// /// entity postal name /// public string Poststed { get; set; } = ""; + /// /// entity address /// public List Adresse { get; set; } = new(); + /// /// entity municipal /// public string Kommune { get; set; } = ""; + /// /// entity municipal identification /// diff --git a/BrCompanyModel.cs b/BrCompanyModel.cs index 55a768c..411c90c 100644 --- a/BrCompanyModel.cs +++ b/BrCompanyModel.cs @@ -1,72 +1,78 @@ // *********************************************************************** // Assembly : FCS.Lib.BrReg -// Author : FH -// Created : 04-06-2022 -// -// Last Modified By : FH -// Last Modified On : 04-06-2022 +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 // *********************************************************************** -// -// Copyright (C) 2022 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 -// 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 -// GNU Affero General Public License for more details. -// -// 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 (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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] // // // *********************************************************************** -namespace FCS.Lib.BrReg +namespace FCS.Lib.BrReg; + +/// +/// +/// +public class BrCompanyModel { /// - /// + /// Entity vat number /// - public class BrCompanyModel - { - /// - /// Entity vat number - /// - public string Organisasjonsnummer { get; set; } = ""; - /// - /// Entity name - /// - public string Navn { get; set; } = ""; - /// - /// Entity deletion date - /// - public string Slettedato { get; set; } = ""; - /// - /// Entity business type - /// - public BrCompanyTypeModel Organisasjonsform { get; set; } = new(); - /// - /// entity postal address - /// - public BrAddressModel Postadresse { get; set; } = new(); - /// - /// entity business address - /// - public BrAddressModel Forretningsadresse { get; set; } = new(); - /// - /// entity out-of-business flag - /// - public bool Konkurs { get; set; } - /// - /// entity to be closed flag - /// - public bool UnderAvvikling { get; set; } - /// - /// entity to be force closed - /// - public bool UnderTvangsavviklingEllerTvangsopplosning { get; set; } + public string Organisasjonsnummer { get; set; } = ""; - } -} + /// + /// Entity name + /// + public string Navn { get; set; } = ""; + + /// + /// Entity deletion date + /// + public string Slettedato { get; set; } = ""; + + /// + /// Entity business type + /// + public BrCompanyTypeModel Organisasjonsform { get; set; } = new(); + + /// + /// entity postal address + /// + public BrAddressModel Postadresse { get; set; } = new(); + + /// + /// entity business address + /// + public BrAddressModel Forretningsadresse { get; set; } = new(); + + /// + /// entity out-of-business flag + /// + public bool Konkurs { get; set; } + + /// + /// entity to be closed flag + /// + public bool UnderAvvikling { get; set; } + + /// + /// entity to be force closed + /// + public bool UnderTvangsavviklingEllerTvangsopplosning { get; set; } +} \ No newline at end of file diff --git a/BrCompanyTypeModel.cs b/BrCompanyTypeModel.cs index 7359572..637fe1f 100644 --- a/BrCompanyTypeModel.cs +++ b/BrCompanyTypeModel.cs @@ -1,28 +1,29 @@ // *********************************************************************** // Assembly : FCS.Lib.BrReg -// Author : FH -// Created : 04-06-2022 -// -// Last Modified By : FH -// Last Modified On : 04-06-2022 +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 // *********************************************************************** -// -// Copyright (C) 2022 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 -// 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 -// GNU Affero General Public License for more details. -// -// 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 (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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] // // // *********************************************************************** + namespace FCS.Lib.BrReg; /// @@ -34,10 +35,12 @@ public class BrCompanyTypeModel /// BrReg business code /// public string Kode { get; set; } = ""; + /// /// BrReg description /// public string Beskrivelse { get; set; } = ""; + /// /// BrReg discontinued /// diff --git a/BrHttpRequest.cs b/BrHttpRequest.cs index 64be43b..8354be5 100644 --- a/BrHttpRequest.cs +++ b/BrHttpRequest.cs @@ -1,25 +1,25 @@ // *********************************************************************** -// Assembly : FCS.Lib.Virk -// Author : FH -// Created : 02-21-2022 -// -// Last Modified By : FH -// Last Modified On : 04-06-2022 +// Assembly : FCS.Lib.BrReg +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 // *********************************************************************** // -// Copyright (C) 2022 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 -// 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 -// GNU Affero General Public License for more details. -// -// 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 (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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] // // // *********************************************************************** @@ -27,36 +27,34 @@ using System.Net.Http; using System.Threading.Tasks; -namespace FCS.Lib.BrReg +namespace FCS.Lib.BrReg; + +/// +/// Class BrHttpRequest +/// +public class BrHttpRequest { /// - /// Class BrHttpRequest + /// Async http request /// - public class BrHttpRequest + /// + /// + /// + public async Task GetResponseAsync(string endpoint, string userAgent) { - /// - /// Async http request - /// - /// - /// - /// - public async Task GetResponseAsync(string endpoint, string userAgent) + using var client = new HttpClient(); + using var brRequest = new HttpRequestMessage(HttpMethod.Get, endpoint); + + brRequest.Headers.Add("User-Agent", userAgent); + + var response = await client.SendAsync(brRequest).ConfigureAwait(true); + var jsonResult = await response.Content.ReadAsStringAsync().ConfigureAwait(true); + + return new BrResponseView { - using var client = new HttpClient(); - using var brRequest = new HttpRequestMessage(HttpMethod.Get, endpoint); - - brRequest.Headers.Add("User-Agent", userAgent); - - var response = await client.SendAsync(brRequest).ConfigureAwait(true); - var jsonResult = await response.Content.ReadAsStringAsync().ConfigureAwait(true); - - return new BrResponseView - { - Code = response.StatusCode, - IsSuccessStatusCode = response.IsSuccessStatusCode, - Message = jsonResult - }; - } + Code = response.StatusCode, + IsSuccessStatusCode = response.IsSuccessStatusCode, + Message = jsonResult + }; } -} - +} \ No newline at end of file diff --git a/BrRegQuery.cs b/BrRegQuery.cs index 6caf05b..c198e93 100644 --- a/BrRegQuery.cs +++ b/BrRegQuery.cs @@ -1,4 +1,30 @@ -namespace FCS.Lib.BrReg; +// *********************************************************************** +// Assembly : FCS.Lib.BrReg +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 +// *********************************************************************** +// +// 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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] +// +// +// *********************************************************************** + +namespace FCS.Lib.BrReg; /// /// BrRegQuery @@ -9,5 +35,4 @@ public class BrRegQuery /// Vat number /// public string VatNumber { get; set; } - } \ No newline at end of file diff --git a/BrResponseParser.cs b/BrResponseParser.cs index 2c600e7..6cde1f9 100644 --- a/BrResponseParser.cs +++ b/BrResponseParser.cs @@ -1,46 +1,45 @@ // *********************************************************************** -// Assembly : FCS.Lib.Virk -// Author : FH -// Created : 02-21-2022 -// -// Last Modified By : FH -// Last Modified On : 04-06-2022 +// Assembly : FCS.Lib.BrReg +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 // *********************************************************************** // -// Copyright (C) 2022 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 -// 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 -// GNU Affero General Public License for more details. -// -// 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 (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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] // // // *********************************************************************** using Newtonsoft.Json; -namespace FCS.Lib.BrReg +namespace FCS.Lib.BrReg; + +/// +/// Class BrResponseParser +/// +public class BrResponseParser { /// - /// Class BrResponseParser + /// Parse response to BrCompanyModel /// - public class BrResponseParser + /// + /// + public BrCompanyModel ParseBrResponse(string responseData) { - /// - /// Parse response to BrCompanyModel - /// - /// - /// - public BrCompanyModel ParseBrResponse(string responseData) - { - return JsonConvert.DeserializeObject(responseData); - } + return JsonConvert.DeserializeObject(responseData); } } \ No newline at end of file diff --git a/BrResponseView.cs b/BrResponseView.cs index 91f76a7..ad302a1 100644 --- a/BrResponseView.cs +++ b/BrResponseView.cs @@ -1,49 +1,50 @@ // *********************************************************************** -// Assembly : FCS.Lib.Virk -// Author : FH -// Created : 02-21-2022 -// -// Last Modified By : FH -// Last Modified On : 04-06-2022 +// Assembly : FCS.Lib.BrReg +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 // *********************************************************************** // -// Copyright (C) 2022 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 -// 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 -// GNU Affero General Public License for more details. -// -// 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 (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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] // // // *********************************************************************** using System.Net; -namespace FCS.Lib.BrReg +namespace FCS.Lib.BrReg; + +/// +/// Class BrResponseView +/// +public class BrResponseView { /// - /// Class BrResponseView + /// http response status code /// - public class BrResponseView - { - /// - /// http response status code - /// - public HttpStatusCode Code { get; set; } - /// - /// Flag indicating success - /// - public bool IsSuccessStatusCode { get; set; } - /// - /// Response message - /// - public string Message { get; set; } = ""; - } + public HttpStatusCode Code { get; set; } + + /// + /// Flag indicating success + /// + public bool IsSuccessStatusCode { get; set; } + + /// + /// Response message + /// + public string Message { get; set; } = ""; } \ No newline at end of file diff --git a/BrVatInfoMapper.cs b/BrVatInfoMapper.cs index b34acab..253701e 100644 --- a/BrVatInfoMapper.cs +++ b/BrVatInfoMapper.cs @@ -1,25 +1,25 @@ // *********************************************************************** -// Assembly : FCS.Lib.Virk -// Author : FH -// Created : 02-21-2022 -// -// Last Modified By : FH -// Last Modified On : 04-06-2022 +// Assembly : FCS.Lib.BrReg +// Author : fhdk +// Created : 2022 12 17 13:33 +// +// Last Modified By: fhdk +// Last Modified On : 2023 03 14 09:16 // *********************************************************************** // -// Copyright (C) 2022 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 -// 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 -// GNU Affero General Public License for more details. -// -// 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 (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 +// 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 +// GNU Affero General Public License for more details. +// +// 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] // // // *********************************************************************** @@ -28,96 +28,92 @@ using System; using System.Collections.Generic; using FCS.Lib.Common; -namespace FCS.Lib.BrReg +namespace FCS.Lib.BrReg; + +/// +/// Class BrVatInfoMapper +/// +public class BrVatInfoMapper { /// - /// Class BrVatInfoMapper + /// Map BrCompanyModel to CRM /// - public class BrVatInfoMapper + /// + /// + /// + /// + /// + /// + public VatInfoDto MapBrToCrm(BrCompanyModel brCompany) { - - /// - /// Map BrCompanyModel to CRM - /// - /// - /// - /// - /// - /// - /// - public VatInfoDto MapBrToCrm(BrCompanyModel brCompany) + return new VatInfoDto { - return new VatInfoDto + Name = brCompany.Navn, + Address = string.Join(", ", brCompany.Forretningsadresse.Adresse), + City = brCompany.Forretningsadresse.Poststed, + RequestDate = $"{DateTime.Now:yyyy-MM-dd}", + ZipCode = brCompany.Forretningsadresse.Postnummer, + VatNumber = brCompany.Organisasjonsnummer, + States = new List { - Name = brCompany.Navn, - Address = string.Join(", ", brCompany.Forretningsadresse.Adresse), - City = brCompany.Forretningsadresse.Poststed, - RequestDate = $"{DateTime.Now:yyyy-MM-dd}", - ZipCode = brCompany.Forretningsadresse.Postnummer, - VatNumber = brCompany.Organisasjonsnummer, - States = new List + new() { - new() + LastUpdate = "", + State = MapBrVatState(brCompany).HasFolded ? "LUKKET" : "NORMAL", + TimeFrame = new TimeFrame { - LastUpdate = "", - State = MapBrVatState(brCompany).HasFolded ? "LUKKET" : "NORMAL", - TimeFrame = new TimeFrame - { - StartDate = "", - EndDate = "" - } - } - }, - LifeCycles = new List - { - new() - { - TimeFrame = new TimeFrame - { - EndDate = "NN", - StartDate = "NN" - } + StartDate = "", + EndDate = "" } } - }; - } - - /// - /// Map BrCompanyModel to VatStateInfo - /// - /// - /// - public VatStateInfo MapBrVatState(BrCompanyModel brCompany) - { - if (brCompany == null) + }, + LifeCycles = new List { - return new VatStateInfo + new() { - RequestDate = DateTime.Now - }; + TimeFrame = new TimeFrame + { + EndDate = "NN", + StartDate = "NN" + } + } } + }; + } - var c = new VatStateInfo + /// + /// Map BrCompanyModel to VatStateInfo + /// + /// + /// + public VatStateInfo MapBrVatState(BrCompanyModel brCompany) + { + if (brCompany == null) + return new VatStateInfo { - Name = brCompany.Navn, - VatNumber = brCompany.Organisasjonsnummer, - RequestDate = DateTime.Now, - VatNumberValid = true + RequestDate = DateTime.Now }; - if (brCompany.Konkurs || brCompany.UnderAvvikling || brCompany.UnderTvangsavviklingEllerTvangsopplosning) - c.HasFolded = true; + var c = new VatStateInfo + { + Name = brCompany.Navn, + VatNumber = brCompany.Organisasjonsnummer, + RequestDate = DateTime.Now, + VatNumberValid = true + }; - if(!string.IsNullOrWhiteSpace(brCompany.Organisasjonsform.Utgaatt)) - c.HasFolded = true; + if (brCompany.Konkurs || brCompany.UnderAvvikling || brCompany.UnderTvangsavviklingEllerTvangsopplosning) + c.HasFolded = true; - if (!string.IsNullOrWhiteSpace(brCompany.Slettedato)) - c.HasFolded = true; + if (!string.IsNullOrWhiteSpace(brCompany.Organisasjonsform.Utgaatt)) + c.HasFolded = true; - if (c.HasFolded) - c.VatNumberValid = false; + if (!string.IsNullOrWhiteSpace(brCompany.Slettedato)) + c.HasFolded = true; - return c; - } + if (c.HasFolded) + c.VatNumberValid = false; + + return c; } } \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 93bd46e..8114461 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -17,5 +17,5 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] [assembly: Guid("8D850197-78DB-4D16-A91F-E5BB6E8880A7")] -[assembly: AssemblyVersion("1.0.23023.0820")] -[assembly: AssemblyFileVersion("1.0.23023.0820")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.23077.1334")] +[assembly: AssemblyFileVersion("1.0.23077.1334")] \ No newline at end of file