update headers
This commit is contained in:
parent
cee66f9052
commit
cb06ebcd73
9 changed files with 339 additions and 305 deletions
|
@ -1,25 +1,25 @@
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : FCS.Lib.BrReg
|
// Assembly : FCS.Lib.BrReg
|
||||||
// Author : FH
|
// Author : fhdk
|
||||||
// Created : 04-06-2022
|
// Created : 2022 12 17 13:33
|
||||||
//
|
//
|
||||||
// Last Modified By : FH
|
// Last Modified By: fhdk
|
||||||
// Last Modified On : 04-06-2022
|
// Last Modified On : 2023 03 14 09:16
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="BrAddressModel.cs" company="">
|
// <copyright file="BrAddressModel.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
|
||||||
// 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
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero 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]
|
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary></summary>
|
// <summary></summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
@ -37,26 +37,32 @@ public class BrAddressModel
|
||||||
/// entity country
|
/// entity country
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Land { get; set; } = "";
|
public string Land { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// entity country code
|
/// entity country code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Landkode { get; set; } = "";
|
public string Landkode { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// entity zip code
|
/// entity zip code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Postnummer { get; set; } = "";
|
public string Postnummer { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// entity postal name
|
/// entity postal name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Poststed { get; set; } = "";
|
public string Poststed { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// entity address
|
/// entity address
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> Adresse { get; set; } = new();
|
public List<string> Adresse { get; set; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// entity municipal
|
/// entity municipal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Kommune { get; set; } = "";
|
public string Kommune { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// entity municipal identification
|
/// entity municipal identification
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,72 +1,78 @@
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : FCS.Lib.BrReg
|
// Assembly : FCS.Lib.BrReg
|
||||||
// Author : FH
|
// Author : fhdk
|
||||||
// Created : 04-06-2022
|
// Created : 2022 12 17 13:33
|
||||||
//
|
//
|
||||||
// Last Modified By : FH
|
// Last Modified By: fhdk
|
||||||
// Last Modified On : 04-06-2022
|
// Last Modified On : 2023 03 14 09:16
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="BrCompanyModel.cs" company="">
|
// <copyright file="BrCompanyModel.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
|
||||||
// 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
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero 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]
|
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary></summary>
|
// <summary></summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
namespace FCS.Lib.BrReg
|
namespace FCS.Lib.BrReg;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class BrCompanyModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Entity vat number
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BrCompanyModel
|
public string Organisasjonsnummer { get; set; } = "";
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Entity vat number
|
|
||||||
/// </summary>
|
|
||||||
public string Organisasjonsnummer { get; set; } = "";
|
|
||||||
/// <summary>
|
|
||||||
/// Entity name
|
|
||||||
/// </summary>
|
|
||||||
public string Navn { get; set; } = "";
|
|
||||||
/// <summary>
|
|
||||||
/// Entity deletion date
|
|
||||||
/// </summary>
|
|
||||||
public string Slettedato { get; set; } = "";
|
|
||||||
/// <summary>
|
|
||||||
/// Entity business type
|
|
||||||
/// </summary>
|
|
||||||
public BrCompanyTypeModel Organisasjonsform { get; set; } = new();
|
|
||||||
/// <summary>
|
|
||||||
/// entity postal address
|
|
||||||
/// </summary>
|
|
||||||
public BrAddressModel Postadresse { get; set; } = new();
|
|
||||||
/// <summary>
|
|
||||||
/// entity business address
|
|
||||||
/// </summary>
|
|
||||||
public BrAddressModel Forretningsadresse { get; set; } = new();
|
|
||||||
/// <summary>
|
|
||||||
/// entity out-of-business flag
|
|
||||||
/// </summary>
|
|
||||||
public bool Konkurs { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// entity to be closed flag
|
|
||||||
/// </summary>
|
|
||||||
public bool UnderAvvikling { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// entity to be force closed
|
|
||||||
/// </summary>
|
|
||||||
public bool UnderTvangsavviklingEllerTvangsopplosning { get; set; }
|
|
||||||
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Entity name
|
||||||
|
/// </summary>
|
||||||
|
public string Navn { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Entity deletion date
|
||||||
|
/// </summary>
|
||||||
|
public string Slettedato { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Entity business type
|
||||||
|
/// </summary>
|
||||||
|
public BrCompanyTypeModel Organisasjonsform { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// entity postal address
|
||||||
|
/// </summary>
|
||||||
|
public BrAddressModel Postadresse { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// entity business address
|
||||||
|
/// </summary>
|
||||||
|
public BrAddressModel Forretningsadresse { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// entity out-of-business flag
|
||||||
|
/// </summary>
|
||||||
|
public bool Konkurs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// entity to be closed flag
|
||||||
|
/// </summary>
|
||||||
|
public bool UnderAvvikling { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// entity to be force closed
|
||||||
|
/// </summary>
|
||||||
|
public bool UnderTvangsavviklingEllerTvangsopplosning { get; set; }
|
||||||
}
|
}
|
|
@ -1,28 +1,29 @@
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : FCS.Lib.BrReg
|
// Assembly : FCS.Lib.BrReg
|
||||||
// Author : FH
|
// Author : fhdk
|
||||||
// Created : 04-06-2022
|
// Created : 2022 12 17 13:33
|
||||||
//
|
//
|
||||||
// Last Modified By : FH
|
// Last Modified By: fhdk
|
||||||
// Last Modified On : 04-06-2022
|
// Last Modified On : 2023 03 14 09:16
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="BrCompanyTypeModel.cs" company="">
|
// <copyright file="BrCompanyTypeModel.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
|
||||||
// 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
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero 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]
|
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary></summary>
|
// <summary></summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
namespace FCS.Lib.BrReg;
|
namespace FCS.Lib.BrReg;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -34,10 +35,12 @@ public class BrCompanyTypeModel
|
||||||
/// BrReg business code
|
/// BrReg business code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Kode { get; set; } = "";
|
public string Kode { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// BrReg description
|
/// BrReg description
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Beskrivelse { get; set; } = "";
|
public string Beskrivelse { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// BrReg discontinued
|
/// BrReg discontinued
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : FCS.Lib.Virk
|
// Assembly : FCS.Lib.BrReg
|
||||||
// Author : FH
|
// Author : fhdk
|
||||||
// Created : 02-21-2022
|
// Created : 2022 12 17 13:33
|
||||||
//
|
//
|
||||||
// Last Modified By : FH
|
// Last Modified By: fhdk
|
||||||
// Last Modified On : 04-06-2022
|
// Last Modified On : 2023 03 14 09:16
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="BrHttpRequest.cs" company="FCS">
|
// <copyright file="BrHttpRequest.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
|
||||||
// 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
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero 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]
|
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary></summary>
|
// <summary></summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
@ -27,36 +27,34 @@
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FCS.Lib.BrReg
|
namespace FCS.Lib.BrReg;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class BrHttpRequest
|
||||||
|
/// </summary>
|
||||||
|
public class BrHttpRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class BrHttpRequest
|
/// Async http request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BrHttpRequest
|
/// <param name="endpoint"></param>
|
||||||
|
/// <param name="userAgent"></param>
|
||||||
|
/// <returns><see cref="BrResponseView"/></returns>
|
||||||
|
public async Task<BrResponseView> GetResponseAsync(string endpoint, string userAgent)
|
||||||
{
|
{
|
||||||
/// <summary>
|
using var client = new HttpClient();
|
||||||
/// Async http request
|
using var brRequest = new HttpRequestMessage(HttpMethod.Get, endpoint);
|
||||||
/// </summary>
|
|
||||||
/// <param name="endpoint"></param>
|
brRequest.Headers.Add("User-Agent", userAgent);
|
||||||
/// <param name="userAgent"></param>
|
|
||||||
/// <returns><see cref="BrResponseView"/></returns>
|
var response = await client.SendAsync(brRequest).ConfigureAwait(true);
|
||||||
public async Task<BrResponseView> GetResponseAsync(string endpoint, string userAgent)
|
var jsonResult = await response.Content.ReadAsStringAsync().ConfigureAwait(true);
|
||||||
|
|
||||||
|
return new BrResponseView
|
||||||
{
|
{
|
||||||
using var client = new HttpClient();
|
Code = response.StatusCode,
|
||||||
using var brRequest = new HttpRequestMessage(HttpMethod.Get, endpoint);
|
IsSuccessStatusCode = response.IsSuccessStatusCode,
|
||||||
|
Message = jsonResult
|
||||||
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
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 file="BrRegQuery.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
|
||||||
|
// 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>
|
||||||
|
// <summary></summary>
|
||||||
|
// ***********************************************************************
|
||||||
|
|
||||||
|
namespace FCS.Lib.BrReg;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// BrRegQuery
|
/// BrRegQuery
|
||||||
|
@ -9,5 +35,4 @@ public class BrRegQuery
|
||||||
/// Vat number
|
/// Vat number
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string VatNumber { get; set; }
|
public string VatNumber { get; set; }
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,46 +1,45 @@
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : FCS.Lib.Virk
|
// Assembly : FCS.Lib.BrReg
|
||||||
// Author : FH
|
// Author : fhdk
|
||||||
// Created : 02-21-2022
|
// Created : 2022 12 17 13:33
|
||||||
//
|
//
|
||||||
// Last Modified By : FH
|
// Last Modified By: fhdk
|
||||||
// Last Modified On : 04-06-2022
|
// Last Modified On : 2023 03 14 09:16
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="BrResponseParser.cs" company="FCS">
|
// <copyright file="BrResponseParser.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
|
||||||
// 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
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero 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]
|
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary></summary>
|
// <summary></summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace FCS.Lib.BrReg
|
namespace FCS.Lib.BrReg;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class BrResponseParser
|
||||||
|
/// </summary>
|
||||||
|
public class BrResponseParser
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class BrResponseParser
|
/// Parse response to BrCompanyModel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BrResponseParser
|
/// <param name="responseData"></param>
|
||||||
|
/// <returns><see cref="BrCompanyModel"/></returns>
|
||||||
|
public BrCompanyModel ParseBrResponse(string responseData)
|
||||||
{
|
{
|
||||||
/// <summary>
|
return JsonConvert.DeserializeObject<BrCompanyModel>(responseData);
|
||||||
/// Parse response to BrCompanyModel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="responseData"></param>
|
|
||||||
/// <returns><see cref="BrCompanyModel"/></returns>
|
|
||||||
public BrCompanyModel ParseBrResponse(string responseData)
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject<BrCompanyModel>(responseData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,49 +1,50 @@
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : FCS.Lib.Virk
|
// Assembly : FCS.Lib.BrReg
|
||||||
// Author : FH
|
// Author : fhdk
|
||||||
// Created : 02-21-2022
|
// Created : 2022 12 17 13:33
|
||||||
//
|
//
|
||||||
// Last Modified By : FH
|
// Last Modified By: fhdk
|
||||||
// Last Modified On : 04-06-2022
|
// Last Modified On : 2023 03 14 09:16
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="BrResponseView.cs" company="FCS">
|
// <copyright file="BrResponseView.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
|
||||||
// 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
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero 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]
|
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary></summary>
|
// <summary></summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace FCS.Lib.BrReg
|
namespace FCS.Lib.BrReg;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class BrResponseView
|
||||||
|
/// </summary>
|
||||||
|
public class BrResponseView
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class BrResponseView
|
/// http response status code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BrResponseView
|
public HttpStatusCode Code { get; set; }
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// http response status code
|
/// Flag indicating success
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpStatusCode Code { get; set; }
|
public bool IsSuccessStatusCode { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Flag indicating success
|
/// <summary>
|
||||||
/// </summary>
|
/// Response message
|
||||||
public bool IsSuccessStatusCode { get; set; }
|
/// </summary>
|
||||||
/// <summary>
|
public string Message { get; set; } = "";
|
||||||
/// Response message
|
|
||||||
/// </summary>
|
|
||||||
public string Message { get; set; } = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,25 +1,25 @@
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// Assembly : FCS.Lib.Virk
|
// Assembly : FCS.Lib.BrReg
|
||||||
// Author : FH
|
// Author : fhdk
|
||||||
// Created : 02-21-2022
|
// Created : 2022 12 17 13:33
|
||||||
//
|
//
|
||||||
// Last Modified By : FH
|
// Last Modified By: fhdk
|
||||||
// Last Modified On : 04-06-2022
|
// Last Modified On : 2023 03 14 09:16
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="BrVatInfoMapper.cs" company="FCS">
|
// <copyright file="BrVatInfoMapper.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
|
||||||
// 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
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero 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]
|
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary></summary>
|
// <summary></summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
@ -28,96 +28,92 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FCS.Lib.Common;
|
using FCS.Lib.Common;
|
||||||
|
|
||||||
namespace FCS.Lib.BrReg
|
namespace FCS.Lib.BrReg;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class BrVatInfoMapper
|
||||||
|
/// </summary>
|
||||||
|
public class BrVatInfoMapper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class BrVatInfoMapper
|
/// Map BrCompanyModel to CRM
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BrVatInfoMapper
|
/// <param name="brCompany"></param>
|
||||||
|
/// <returns><see cref="VatInfoDto"/></returns>
|
||||||
|
/// <see cref="BrCompanyModel"/>
|
||||||
|
/// <see cref="VatState"/>
|
||||||
|
/// <see cref="LifeCycle"/>
|
||||||
|
/// <see cref="TimeFrame"/>
|
||||||
|
public VatInfoDto MapBrToCrm(BrCompanyModel brCompany)
|
||||||
{
|
{
|
||||||
|
return new VatInfoDto
|
||||||
/// <summary>
|
|
||||||
/// Map BrCompanyModel to CRM
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="brCompany"></param>
|
|
||||||
/// <returns><see cref="VatInfoDto"/></returns>
|
|
||||||
/// <see cref="BrCompanyModel"/>
|
|
||||||
/// <see cref="VatState"/>
|
|
||||||
/// <see cref="LifeCycle"/>
|
|
||||||
/// <see cref="TimeFrame"/>
|
|
||||||
public VatInfoDto MapBrToCrm(BrCompanyModel brCompany)
|
|
||||||
{
|
{
|
||||||
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<VatState>
|
||||||
{
|
{
|
||||||
Name = brCompany.Navn,
|
new()
|
||||||
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<VatState>
|
|
||||||
{
|
{
|
||||||
new()
|
LastUpdate = "",
|
||||||
|
State = MapBrVatState(brCompany).HasFolded ? "LUKKET" : "NORMAL",
|
||||||
|
TimeFrame = new TimeFrame
|
||||||
{
|
{
|
||||||
LastUpdate = "",
|
StartDate = "",
|
||||||
State = MapBrVatState(brCompany).HasFolded ? "LUKKET" : "NORMAL",
|
EndDate = ""
|
||||||
TimeFrame = new TimeFrame
|
|
||||||
{
|
|
||||||
StartDate = "",
|
|
||||||
EndDate = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
LifeCycles = new List<LifeCycle>
|
|
||||||
{
|
|
||||||
new()
|
|
||||||
{
|
|
||||||
TimeFrame = new TimeFrame
|
|
||||||
{
|
|
||||||
EndDate = "NN",
|
|
||||||
StartDate = "NN"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
}
|
LifeCycles = new List<LifeCycle>
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Map BrCompanyModel to VatStateInfo
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="brCompany"></param>
|
|
||||||
/// <returns><see cref="VatStateInfo"/></returns>
|
|
||||||
public VatStateInfo MapBrVatState(BrCompanyModel brCompany)
|
|
||||||
{
|
|
||||||
if (brCompany == null)
|
|
||||||
{
|
{
|
||||||
return new VatStateInfo
|
new()
|
||||||
{
|
{
|
||||||
RequestDate = DateTime.Now
|
TimeFrame = new TimeFrame
|
||||||
};
|
{
|
||||||
|
EndDate = "NN",
|
||||||
|
StartDate = "NN"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var c = new VatStateInfo
|
/// <summary>
|
||||||
|
/// Map BrCompanyModel to VatStateInfo
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="brCompany"></param>
|
||||||
|
/// <returns><see cref="VatStateInfo"/></returns>
|
||||||
|
public VatStateInfo MapBrVatState(BrCompanyModel brCompany)
|
||||||
|
{
|
||||||
|
if (brCompany == null)
|
||||||
|
return new VatStateInfo
|
||||||
{
|
{
|
||||||
Name = brCompany.Navn,
|
RequestDate = DateTime.Now
|
||||||
VatNumber = brCompany.Organisasjonsnummer,
|
|
||||||
RequestDate = DateTime.Now,
|
|
||||||
VatNumberValid = true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (brCompany.Konkurs || brCompany.UnderAvvikling || brCompany.UnderTvangsavviklingEllerTvangsopplosning)
|
var c = new VatStateInfo
|
||||||
c.HasFolded = true;
|
{
|
||||||
|
Name = brCompany.Navn,
|
||||||
|
VatNumber = brCompany.Organisasjonsnummer,
|
||||||
|
RequestDate = DateTime.Now,
|
||||||
|
VatNumberValid = true
|
||||||
|
};
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(brCompany.Organisasjonsform.Utgaatt))
|
if (brCompany.Konkurs || brCompany.UnderAvvikling || brCompany.UnderTvangsavviklingEllerTvangsopplosning)
|
||||||
c.HasFolded = true;
|
c.HasFolded = true;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(brCompany.Slettedato))
|
if (!string.IsNullOrWhiteSpace(brCompany.Organisasjonsform.Utgaatt))
|
||||||
c.HasFolded = true;
|
c.HasFolded = true;
|
||||||
|
|
||||||
if (c.HasFolded)
|
if (!string.IsNullOrWhiteSpace(brCompany.Slettedato))
|
||||||
c.VatNumberValid = false;
|
c.HasFolded = true;
|
||||||
|
|
||||||
return c;
|
if (c.HasFolded)
|
||||||
}
|
c.VatNumberValid = false;
|
||||||
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,5 +17,5 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
[assembly: Guid("8D850197-78DB-4D16-A91F-E5BB6E8880A7")]
|
[assembly: Guid("8D850197-78DB-4D16-A91F-E5BB6E8880A7")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.23023.0820")]
|
[assembly: AssemblyVersion("1.0.23077.1334")]
|
||||||
[assembly: AssemblyFileVersion("1.0.23023.0820")]
|
[assembly: AssemblyFileVersion("1.0.23077.1334")]
|
Loading…
Reference in a new issue