Skip to content

Commit 31a3c39

Browse files
committed
Disabling the CHR service call and returning empty object until CHR is fixed.
1 parent 593f780 commit 31a3c39

File tree

1 file changed

+34
-16
lines changed
  • eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Helpers

1 file changed

+34
-16
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Helpers/ChrHelper.cs

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,42 @@ public class ChrHelper
1010
{
1111
public async Task<ChrResult> GetCompanyInfo(int number)
1212
{
13-
var client = new HttpClient();
14-
client.DefaultRequestHeaders.Add("User-agent", "Microting eForm - CVR opslag");
15-
var url = $"https://chrregister.microting.com/Chr?chrNumber={number}";
16-
Console.WriteLine($"calling url is: {url}");
17-
var response = await client.GetAsync(url).ConfigureAwait(false);
18-
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
19-
Console.WriteLine($"result is: {result}");
20-
JsonSerializerOptions options = new JsonSerializerOptions
13+
// var client = new HttpClient();
14+
// client.DefaultRequestHeaders.Add("User-agent", "Microting eForm - CVR opslag");
15+
// var url = $"https://chrregister.microting.com/Chr?chrNumber={number}";
16+
// Console.WriteLine($"calling url is: {url}");
17+
// var response = await client.GetAsync(url).ConfigureAwait(false);
18+
// var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
19+
// Console.WriteLine($"result is: {result}");
20+
// JsonSerializerOptions options = new JsonSerializerOptions
21+
// {
22+
// PropertyNameCaseInsensitive = true,
23+
// DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault,
24+
// NumberHandling = JsonNumberHandling.AllowReadingFromString
25+
// };
26+
// options.Converters.Add(new StringConverter());
27+
//
28+
// var res = JsonSerializer.Deserialize<ChrResult>(result, options);
29+
//
30+
// return res;
31+
32+
// Temporary return for testing without calling the real service
33+
// TODO - remove when real service is working
34+
return new ChrResult
2135
{
22-
PropertyNameCaseInsensitive = true,
23-
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault,
24-
NumberHandling = JsonNumberHandling.AllowReadingFromString
36+
ChrNummer = number.ToString(),
37+
Ejendom = new Ejendom
38+
{
39+
adresse = "",
40+
byNavn = "",
41+
postNummer = "",
42+
postDistrikt = "",
43+
kommuneNummer = "",
44+
kommuneNavn = "",
45+
datoOpret = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd"),
46+
datoOpdatering = DateTime.Now.ToString("yyyy-MM-dd")
47+
}
2548
};
26-
options.Converters.Add(new StringConverter());
27-
28-
var res = JsonSerializer.Deserialize<ChrResult>(result, options);
29-
30-
return res;
3149
}
3250
}
3351

0 commit comments

Comments
 (0)