Skip to content

Commit fd161b0

Browse files
authored
Merge pull request #892 from bcgov/feature/registration-validation
Logging
2 parents 3845cc7 + 4415b0a commit fd161b0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

server/StrDss.Service/PermitValidationService.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public PermitValidationService(IRegistrationApiClient regApiClient, IGeocoderApi
5353

5454
try
5555
{
56-
Response resp = await _regApiClient.ValidatePermitAsync(body, _apiAccount);
56+
_logger.LogInformation("Calling validate permit.");
57+
Response resp = await _regApiClient.ValidatePermitAsync(body, _apiAccount);
5758

5859
// If we didn't get a Status field back, then there was an error
5960
if (string.IsNullOrEmpty(resp.Status))
@@ -65,28 +66,32 @@ public PermitValidationService(IRegistrationApiClient regApiClient, IGeocoderApi
6566
}
6667
else
6768
{
68-
Dictionary<string, List<string>> errorDetails = resp.Errors
69+
_logger.LogInformation("Validate permit returned an error.");
70+
Dictionary<string, List<string>> errorDetails = resp.Errors
6971
.GroupBy(e => e.Code)
7072
.ToDictionary(g => g.Key, g => g.Select(e => e.Message).ToList());
7173
registrationText = errorDetails.ParseError();
7274
}
7375
}
7476
else if (!string.Equals(resp.Status, "ACTIVE", StringComparison.OrdinalIgnoreCase))
7577
{
78+
_logger.LogInformation("Permit status is not ACTIVE.");
7679
isValid = false;
7780
registrationText = resp.Status;
7881

7982
}
8083
}
8184
catch (ApiException ex)
8285
{
86+
_logger.LogInformation("Validate permit call threw an Api exception: " + ex.Message);
8387
isValid = false;
8488
registrationText = ex.StatusCode == 404 ? RegistrationValidationText.ValidationException404 :
8589
ex.StatusCode == 401 ? RegistrationValidationText.ValidationException401 :
8690
RegistrationValidationText.ValidationException;
8791
}
8892
catch (Exception ex)
8993
{
94+
_logger.LogInformation("Validate permit call threw an exception: " + ex.Message);
9095
isValid = false;
9196
registrationText = RegistrationValidationText.ValidationException;
9297
}

server/StrDss.Service/RegistrationService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,10 @@ private async Task<bool> ProcessLine(DssUploadDelivery upload, DssUploadLine upl
162162
string registrationTxt = "";
163163
if (!string.IsNullOrEmpty(row.RegNo))
164164
{
165+
_logger.LogInformation($"Processing: {row.RegNo} - {row.RentalUnit} - {row.RentalStreet} - {row.RentalPostal}");
165166
// There is a reg no present, so we need to validate it
166167
(isValid, registrationTxt) = await _permitValidation.ValidateRegistrationPermitAsync(row.RegNo, row.RentalUnit, row.RentalStreet, row.RentalPostal);
168+
_logger.LogInformation("Validate permit response: " + registrationTxt);
167169
if (isValid)
168170
{
169171
if (!string.IsNullOrEmpty(row.ListingId))

0 commit comments

Comments
 (0)