Skip to content

Commit

Permalink
remove consent service
Browse files Browse the repository at this point in the history
  • Loading branch information
chopkinsmade committed Dec 13, 2024
1 parent d254365 commit 171c71e
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 670 deletions.
4 changes: 0 additions & 4 deletions config/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,6 @@ def _add_hawk_credentials(id_env_name, key_env_name, scopes):
DNB_AUTOMATIC_UPDATE_LIMIT = env.int('DNB_AUTOMATIC_UPDATE_LIMIT', default=None)
DNB_MAX_COMPANIES_IN_TREE_COUNT = env.int('DNB_MAX_COMPANIES_IN_TREE_COUNT', default=1000)

# Legal Basis / Consent Service
CONSENT_SERVICE_BASE_URL = env('CONSENT_SERVICE_BASE_URL', default=None)
CONSENT_SERVICE_HAWK_ID = env('CONSENT_SERVICE_HAWK_ID', default=None)
CONSENT_SERVICE_HAWK_KEY = env('CONSENT_SERVICE_HAWK_KEY', default=None)

DATAHUB_SUPPORT_EMAIL_ADDRESS = env('DATAHUB_SUPPORT_EMAIL_ADDRESS', default=None)

Expand Down
11 changes: 2 additions & 9 deletions config/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@
'django.contrib.auth.hashers.MD5PasswordHasher',
]

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
}
}
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}

# Stop WhiteNoise emitting warnings when running tests without running collectstatic first
WHITENOISE_AUTOREFRESH = True
Expand Down Expand Up @@ -124,7 +120,7 @@
'aws_access_key_id': 'bar',
'aws_secret_access_key': 'baz',
'aws_region': 'eu-west-2',
}
},
}

DIT_EMAIL_INGEST_BLOCKLIST = [
Expand Down Expand Up @@ -161,9 +157,6 @@
ADMIN_OAUTH2_CLIENT_SECRET = 'client-secret'
ADMIN_OAUTH2_LOGOUT_PATH = 'http://sso-server/o/logout'

CONSENT_SERVICE_BASE_URL = 'http://consent.service/'
CONSENT_SERVICE_HAWK_ID = 'some-id'
CONSENT_SERVICE_HAWK_KEY = 'some-secret'

COMPANY_MATCHING_SERVICE_BASE_URL = 'http://content.matching/'
COMPANY_MATCHING_HAWK_ID = 'some-id'
Expand Down
198 changes: 0 additions & 198 deletions datahub/company/consent.py

This file was deleted.

23 changes: 0 additions & 23 deletions datahub/company/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from django.utils.translation import gettext_lazy
from rest_framework import serializers

from datahub.company import consent
from datahub.company.constants import (
BusinessTypeConstant,
OneListTierID,
Expand Down Expand Up @@ -276,28 +275,6 @@ class Meta(ContactSerializer.Meta):
]


class ConsentMarketingField(serializers.BooleanField):
"""
ConsentMarketingField will lookup consent data.
The model that this fields is used must have an email field
BooleanField is subclassed here for validation.
"""

def to_internal_value(self, data):
"""Validate boolean on incoming data."""
return {
'accepts_dit_email_marketing': super().to_internal_value(data),
}

def to_representation(self, value):
"""Lookup from consent service api/"""
try:
representation = consent.get_one(value.email)
except consent.ConsentAPIError:
representation = False
return representation


class CompanyExportCountrySerializer(serializers.ModelSerializer):
"""
Export country serializer holding `Country` and its status.
Expand Down
Loading

0 comments on commit 171c71e

Please sign in to comment.