-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: only accepted applications with instalments * fix: duplicate decision proposal request bug * chore: refactor ahjo exceptions into one place * feat: more readable error messages for handler * feat: log request_type on callback failure * feat: print application numbers after requests * feat: remove decision callback required fields * feat: always return 200 OK after decision callback
- Loading branch information
Showing
14 changed files
with
372 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
105 changes: 105 additions & 0 deletions
105
backend/benefit/applications/services/ahjo/exceptions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
from applications.models import AhjoStatus | ||
|
||
|
||
class DecisionProposalError(Exception): | ||
"""Custom exception for errors in the sending of decision proposals.""" | ||
|
||
pass | ||
|
||
|
||
class DecisionProposalAlreadyAcceptedError(DecisionProposalError): | ||
""" | ||
Raised when a decision proposal already has been accepted in Ahjo, | ||
but for some reason a decision proposal for the application is still being sent. | ||
Attributes: | ||
ahjo_status (AhjosStatus): The decision_proposal_accepted status. | ||
""" | ||
|
||
def __init__(self, message: str, ahjo_status: AhjoStatus) -> None: | ||
self.message = message | ||
self.ahjo_status = ahjo_status | ||
super().__init__(self.message) | ||
|
||
|
||
class AhjoApiClientException(Exception): | ||
""" | ||
Raised when an error occurs in the AhjoApiClient. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class MissingAhjoCaseIdError(AhjoApiClientException): | ||
""" | ||
Raised when a Ahjo request that requires a case id is missing the case id. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class MissingHandlerIdError(AhjoApiClientException): | ||
""" | ||
Raised when a Ahjo request that requires a handler id is missing the handler id. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class MissingOrganizationIdentifier(Exception): | ||
""" | ||
Raised when an organization identifier is missing from AhjoSettings in the database. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class AhjoTokenExpiredException(Exception): | ||
""" | ||
Raised when the Ahjo token has expired. The token should be re-configured manually, see instructions at: | ||
https://helsinkisolutionoffice.atlassian.net/wiki/spaces/KAN/pages/8687517756/Siirto+yll+pitoon#Ahjo-autentikaatio-tokenin-haku-ja-asettaminen-manuaalisesti. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class AhjoTokenRetrievalException(Exception): | ||
""" | ||
Raised when the Ahjo token has expired or it could not be otherwise refreshed automatically. | ||
The token should be re-configured manually, see instructions at: | ||
https://helsinkisolutionoffice.atlassian.net/wiki/spaces/KAN/pages/8687517756/Siirto+yll+pitoon#Ahjo-autentikaatio-tokenin-haku-ja-asettaminen-manuaalisesti. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class InvalidAhjoTokenException(Exception): | ||
""" | ||
Raised when the Ahjo token is missing data or is otherwise invalid. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class AhjoCallbackError(Exception): | ||
""" | ||
Raised when an error occurs in the Ahjo callback. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class AhjoDecisionError(Exception): | ||
""" | ||
Raised when an error occurs in substituting application data into the decision text. | ||
""" | ||
|
||
pass | ||
|
||
|
||
class AhjoDecisionDetailsParsingError(Exception): | ||
""" | ||
Raised when an error occurs in parsing the decision details after a details query to Ahjo. | ||
""" | ||
|
||
pass |
Oops, something went wrong.