Skip to content

Commit

Permalink
payments: Improve error reporting when VAT validation is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Oct 9, 2023
1 parent afd05a6 commit fed648c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions payments/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def cache_vies_data(value):
data[item] = value.data[item]
cache.set(key, data, 3600)
except Error as error:
sentry_sdk.capture_exception()
data = {
"valid": False,
"fault_code": getattr(error, "code", "other:Error"),
"fault_message": str(error),
}
sentry_sdk.capture_exception()
value.__dict__["vies_data"] = data

return value
Expand All @@ -49,9 +49,9 @@ def validate_vatin(value):

if not value.vies_data["valid"]:
retry_errors = {"MS_UNAVAILABLE", "MS_MAX_CONCURRENT_REQ", "TIMEOUT"}
retry_codes = {"soap:Server", "other:Error"}
retry_codes = {"soap:Server", "other:Error", "env:Server"}
if (
value.vies_data.get("fault_reason") in retry_errors
value.vies_data.get("fault_message") in retry_errors
or value.vies_data.get("fault_code") in retry_codes
):
msg = _(
Expand Down

0 comments on commit fed648c

Please sign in to comment.