Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstrayer committed Aug 17, 2020
2 parents 8f5cf9e + ebfa35f commit 644c5ca
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ coverage==5.2 \
distlib==0.3.1 \
--hash=sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb \
--hash=sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1
django==3.0.8 \
--hash=sha256:5457fc953ec560c5521b41fad9e6734a4668b7ba205832191bbdff40ec61073c \
--hash=sha256:31a5fbbea5fc71c99e288ec0b2f00302a0a92c44b13ede80b73a6a4d6d205582
django==3.1 \
--hash=sha256:1a63f5bb6ff4d7c42f62a519edc2adbb37f9b78068a5a862beff858b68e3dc8b \
--hash=sha256:2d390268a13c655c97e0e2ede9d117007996db692c1bb93eabebd4fb7ea7012b
django-localflavor==3.0.1 \
--hash=sha256:24e9a03bc11ced92365821d3cfdd96eb4e2f3e44a6f40e86c645d3e0ec65ec53 \
--hash=sha256:3c3034dc64a1f7e5efd9eb53d653af905c20482d438c0e8b825d02e3121b86fa
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ chardet==3.0.4 \
--hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae
contextvars==2.4; python_version < "3.7" \
--hash=sha256:f38c908aaa59c14335eeea12abea5f443646216c4e29380d7bf34d2018e2c39e
django==3.0.8 \
--hash=sha256:5457fc953ec560c5521b41fad9e6734a4668b7ba205832191bbdff40ec61073c \
--hash=sha256:31a5fbbea5fc71c99e288ec0b2f00302a0a92c44b13ede80b73a6a4d6d205582
django==3.1 \
--hash=sha256:1a63f5bb6ff4d7c42f62a519edc2adbb37f9b78068a5a862beff858b68e3dc8b \
--hash=sha256:2d390268a13c655c97e0e2ede9d117007996db692c1bb93eabebd4fb7ea7012b
django-localflavor==3.0.1 \
--hash=sha256:24e9a03bc11ced92365821d3cfdd96eb4e2f3e44a6f40e86c645d3e0ec65ec53 \
--hash=sha256:3c3034dc64a1f7e5efd9eb53d653af905c20482d438c0e8b825d02e3121b86fa
Expand Down
26 changes: 14 additions & 12 deletions taxtea/checks.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import List

from django.apps.config import AppConfig
from django.core import checks
from django.core.checks import CheckMessage, Critical, Tags, register


@checks.register("TaxTea")
def check_USPS_api_auth(app_configs: AppConfig = None) -> List[checks.CheckMessage]:
@register(Tags.compatibility)
def check_USPS_api_auth(app_configs: AppConfig = None, **kwargs) -> List[CheckMessage]:
"""
check_USPS_api_auth:
Checks if the user has supplied a USPS username/password.
Expand All @@ -23,13 +23,15 @@ def check_USPS_api_auth(app_configs: AppConfig = None) -> List[checks.CheckMessa
if not tax_settings.USPS_USER:
msg = "Could not find a USPS User."
hint = "Add TAXTEA_USPS_USER to your settings."
messages.append(checks.Critical(msg, hint=hint, id="tax.C001"))
messages.append(Critical(msg, hint=hint, id="tax.C001"))

return messages


@checks.register("TaxTea")
def check_Avalara_api_auth(app_configs: AppConfig = None) -> List[checks.CheckMessage]:
@register(Tags.compatibility)
def check_Avalara_api_auth(
app_configs: AppConfig = None, **kwargs
) -> List[CheckMessage]:
"""
check_Avalara_api_auth:
Checks if the user has supplied a Avalara username/password.
Expand All @@ -47,17 +49,17 @@ def check_Avalara_api_auth(app_configs: AppConfig = None) -> List[checks.CheckMe
if not tax_settings.AVALARA_USER:
msg = "Could not find a Avalara User."
hint = "Add TAXTEA_AVALARA_USER to your settings."
messages.append(checks.Critical(msg, hint=hint, id="tax.C002"))
messages.append(Critical(msg, hint=hint, id="tax.C002"))
if not tax_settings.AVALARA_PASSWORD:
msg = "Could not find a Avalara Password."
hint = "Add TAXTEA_AVALARA_PASSWORD to your settings."
messages.append(checks.Critical(msg, hint=hint, id="tax.C003"))
messages.append(Critical(msg, hint=hint, id="tax.C003"))

return messages


@checks.register("TaxTea")
def check_origin_zips(app_configs: AppConfig = None) -> List[checks.CheckMessage]:
@register(Tags.compatibility)
def check_origin_zips(app_configs: AppConfig = None, **kwargs) -> List[CheckMessage]:
"""
check_origin_zips:
Checks if the user has supplied at least one origin zip.
Expand All @@ -75,14 +77,14 @@ def check_origin_zips(app_configs: AppConfig = None) -> List[checks.CheckMessage
if not tax_settings.NEXUSES:
msg = "Could not find a Nexus."
hint = "Add at least one TAXTEA_NEXUSES to your settings."
messages.append(checks.Critical(msg, hint=hint, id="tax.C004"))
messages.append(Critical(msg, hint=hint, id="tax.C004"))
# If there is no TAX_NEXUS, then the next check will throw an IndexError
return messages

state, zip_code = tax_settings.NEXUSES[0]
if not state and not zip_code:
msg = "Could not find a valid Nexus tuple."
hint = "Add at least one Nexus tuple ('STATE', 'ZIPCODE') to your settings."
messages.append(checks.Critical(msg, hint=hint, id="tax.C005"))
messages.append(Critical(msg, hint=hint, id="tax.C005"))

return messages

0 comments on commit 644c5ca

Please sign in to comment.