@@ -53,7 +53,8 @@ public PermitValidationService(IRegistrationApiClient regApiClient, IGeocoderApi
53
53
54
54
try
55
55
{
56
- Response resp = await _regApiClient . ValidatePermitAsync ( body , _apiAccount ) ;
56
+ _logger . LogInformation ( "Calling validate permit." ) ;
57
+ Response resp = await _regApiClient . ValidatePermitAsync ( body , _apiAccount ) ;
57
58
58
59
// If we didn't get a Status field back, then there was an error
59
60
if ( string . IsNullOrEmpty ( resp . Status ) )
@@ -65,28 +66,32 @@ public PermitValidationService(IRegistrationApiClient regApiClient, IGeocoderApi
65
66
}
66
67
else
67
68
{
68
- Dictionary < string , List < string > > errorDetails = resp . Errors
69
+ _logger . LogInformation ( "Validate permit returned an error." ) ;
70
+ Dictionary < string , List < string > > errorDetails = resp . Errors
69
71
. GroupBy ( e => e . Code )
70
72
. ToDictionary ( g => g . Key , g => g . Select ( e => e . Message ) . ToList ( ) ) ;
71
73
registrationText = errorDetails . ParseError ( ) ;
72
74
}
73
75
}
74
76
else if ( ! string . Equals ( resp . Status , "ACTIVE" , StringComparison . OrdinalIgnoreCase ) )
75
77
{
78
+ _logger . LogInformation ( "Permit status is not ACTIVE." ) ;
76
79
isValid = false ;
77
80
registrationText = resp . Status ;
78
81
79
82
}
80
83
}
81
84
catch ( ApiException ex )
82
85
{
86
+ _logger . LogInformation ( "Validate permit call threw an Api exception: " + ex . Message ) ;
83
87
isValid = false ;
84
88
registrationText = ex . StatusCode == 404 ? RegistrationValidationText . ValidationException404 :
85
89
ex . StatusCode == 401 ? RegistrationValidationText . ValidationException401 :
86
90
RegistrationValidationText . ValidationException ;
87
91
}
88
92
catch ( Exception ex )
89
93
{
94
+ _logger . LogInformation ( "Validate permit call threw an exception: " + ex . Message ) ;
90
95
isValid = false ;
91
96
registrationText = RegistrationValidationText . ValidationException ;
92
97
}
0 commit comments