Skip to content

Commit

Permalink
#1925- Remove feature flag VA_PROFILE_V3_USE_PROFILE_API_V3 and code …
Browse files Browse the repository at this point in the history
…cleanup (#1923)
  • Loading branch information
AdamKing0126 authored Aug 12, 2024
1 parent 12a44d7 commit ecbbe09
Show file tree
Hide file tree
Showing 16 changed files with 364 additions and 1,174 deletions.
71 changes: 37 additions & 34 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
fileignoreconfig:
- filename: README.md
checksum: 94578d44dbb4e2a27def1bfd91aec3945bbda30eadb5a9414b84a96aea49b4a7
- filename: app/celery/process_ga4_measurement_tasks.py
checksum: 772d9605c861b6382c0bd488e1f5f52d8a5d8874ace5b80378407a905a514a29
- filename: app/config.py
checksum: 6c8c5f65a1f7a4fbe3cfdfe45de676ee16e0f537cb3aa8b9888e9622bcd4b1e1
- filename: app/googleanalytics/ga4.py
checksum: 287c63712d7ec37b359fde05c9506703c6b8fe8adf370db64aae1a65cacb31e6
- filename: app/integrations/comp_and_pen/scheduled_message_helpers.py
checksum: e9c9cd3d123445ab0797fd1387f5d48c775b71ea382fd58c44636f15886c5eff
- filename: app/internal/rest.py
checksum: 67ce309ecf54ed5e54ab71b9b456f6804dd8bc17c9f6633e59fd61a916c5d4ea
- filename: app/notifications/send_notifications.py
checksum: ecd7a6380dde50f907568540a6c45454adc1d2adbd19853f45e0f85a1e27c50c
- filename: app/va/va_profile/va_profile_client.py
checksum: ea798734b880362ea68f2380b9351f28949506400746811116976be81bd13499
- filename: certs/DigiCert-Global-G2-TLS-RSA-SHA256-2020-CA1.cer
checksum: e06cc6abd755fa5cb5c2b1deceb1a40f87bf9f2b8be73102623cbfe0f28a20cd
- filename: ci/.local.env
checksum: a2dca7e8e15af2a98112a405725e0b6f07c6adcb61507d8d32715ee17c383b6b
- filename: poetry.lock
checksum: 68bd8e4a0a9e42a7988297524939e29c1a8bcd685d59fe26f49d109d09cc6ed5
- filename: tests/app/celery/test_scheduled_tasks.py
checksum: cb2b003fb3ee404c293632e4bad6754ec6a35c895f392933d9203b5d93edb095
- filename: tests/app/conftest.py
checksum: 823e29c34011d04c007800df4c131fdf043c6b05409d5c9915c4e8e9f1f00d80
- filename: tests/app/integrations/comp_and_pen/dynamo_fixtures.py
checksum: 170ea486a042bc783f0aeaa0c683936744df192b65d1bc6b58194a00adc46208
- filename: tests/app/internal/test_rest.py
checksum: 21d6c62402baa8ec3451c2d00cf5ffdff96398344d78603f93e3479e711305fb
- filename: tests/app/notifications/test_send_notifications.py
checksum: 12f223d78afccf1d48b586c53ca061121ad0666aae4c0e464b47e88531bd630e
- filename: tests/app/va/va_profile/test_va_profile_v3.py
checksum: 25da52eaa59e0cf2d6302d557a63810593b99ee1fd75c0245e9208d06ee656b8
- filename: README.md
checksum: 94578d44dbb4e2a27def1bfd91aec3945bbda30eadb5a9414b84a96aea49b4a7
- filename: app/celery/process_ga4_measurement_tasks.py
checksum: 772d9605c861b6382c0bd488e1f5f52d8a5d8874ace5b80378407a905a514a29
- filename: app/config.py
checksum: 6c8c5f65a1f7a4fbe3cfdfe45de676ee16e0f537cb3aa8b9888e9622bcd4b1e1
- filename: app/googleanalytics/ga4.py
checksum: 287c63712d7ec37b359fde05c9506703c6b8fe8adf370db64aae1a65cacb31e6
- filename: app/integrations/comp_and_pen/scheduled_message_helpers.py
checksum: e9c9cd3d123445ab0797fd1387f5d48c775b71ea382fd58c44636f15886c5eff
- filename: app/internal/rest.py
checksum: 67ce309ecf54ed5e54ab71b9b456f6804dd8bc17c9f6633e59fd61a916c5d4ea
- filename: app/notifications/send_notifications.py
checksum: ecd7a6380dde50f907568540a6c45454adc1d2adbd19853f45e0f85a1e27c50c
- filename: app/va/va_profile/va_profile_client.py
checksum: ca361cb13db23cef6851c3a59c98dc22502cf3b2ff685ccce588dbbe05072c37
- filename: certs/DigiCert-Global-G2-TLS-RSA-SHA256-2020-CA1.cer
checksum: e06cc6abd755fa5cb5c2b1deceb1a40f87bf9f2b8be73102623cbfe0f28a20cd
- filename: ci/.local.env
checksum: a2dca7e8e15af2a98112a405725e0b6f07c6adcb61507d8d32715ee17c383b6b
- filename: poetry.lock
checksum: 68bd8e4a0a9e42a7988297524939e29c1a8bcd685d59fe26f49d109d09cc6ed5
- filename: tests/app/celery/test_scheduled_tasks.py
checksum: cb2b003fb3ee404c293632e4bad6754ec6a35c895f392933d9203b5d93edb095
- filename: tests/app/conftest.py
checksum: 823e29c34011d04c007800df4c131fdf043c6b05409d5c9915c4e8e9f1f00d80
- filename: tests/app/integrations/comp_and_pen/dynamo_fixtures.py
checksum: 170ea486a042bc783f0aeaa0c683936744df192b65d1bc6b58194a00adc46208
- filename: tests/app/internal/test_rest.py
checksum: 21d6c62402baa8ec3451c2d00cf5ffdff96398344d78603f93e3479e711305fb
- filename: tests/app/notifications/test_send_notifications.py
checksum: 12f223d78afccf1d48b586c53ca061121ad0666aae4c0e464b47e88531bd630e
- filename: tests/app/va/va_profile/test_va_profile_client.py
checksum: ca361cb13db23cef6851c3a59c98dc22502cf3b2ff685ccce588dbbe05072c37
- filename: app/attachments/store.py
checksum: dbdde0a3cb15b8be2966299dee19ef64431b6c018529e262da0cf4d5fcdac6b2

version: "1.0"
11 changes: 2 additions & 9 deletions app/celery/contact_information_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from app import notify_celery, va_profile_client
from app.celery.common import can_retry, handle_max_retries_exceeded
from app.celery.exceptions import AutoRetryException
from app.feature_flags import FeatureFlag, is_feature_enabled
from app.va.identifier import IdentifierType
from app.va.va_profile import VAProfileRetryableException, VAProfileNonRetryableException, NoContactInfoException
from app.dao.notifications_dao import get_notification_by_id, dao_update_notification, update_notification_status_by_id
Expand Down Expand Up @@ -34,15 +33,9 @@ def lookup_contact_info(

try:
if EMAIL_TYPE == notification.notification_type:
if is_feature_enabled(FeatureFlag.VA_PROFILE_V3_USE_PROFILE_API_V3):
recipient = va_profile_client.get_email_from_profile_v3(va_profile_id)
else:
recipient = va_profile_client.get_email(va_profile_id.id_value)
recipient = va_profile_client.get_email(va_profile_id)
elif SMS_TYPE == notification.notification_type:
if is_feature_enabled(FeatureFlag.VA_PROFILE_V3_USE_PROFILE_API_V3):
recipient = va_profile_client.get_telephone_from_profile_v3(va_profile_id)
else:
recipient = va_profile_client.get_telephone(va_profile_id.id_value)
recipient = va_profile_client.get_telephone(va_profile_id)
else:
raise NotImplementedError(
f'The task lookup_contact_info failed for notification {notification_id}. '
Expand Down
14 changes: 4 additions & 10 deletions app/celery/lookup_recipient_communication_permissions_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
from app.dao.communication_item_dao import get_communication_item
from app.dao.notifications_dao import get_notification_by_id, update_notification_status_by_id
from app.exceptions import NotificationTechnicalFailureException
from app.feature_flags import FeatureFlag, is_feature_enabled
from app.models import RecipientIdentifier, NOTIFICATION_PREFERENCES_DECLINED
from app.va.va_profile import VAProfileRetryableException
from app.va.va_profile.va_profile_client import CommunicationItemNotFoundException
from app.va.va_profile.exceptions import CommunicationItemNotFoundException
from app.va.identifier import IdentifierType


Expand Down Expand Up @@ -87,14 +86,9 @@ def recipient_has_given_permission(
default_send_flag = communication_item.default_send_indicator

try:
if is_feature_enabled(FeatureFlag.VA_PROFILE_V3_USE_PROFILE_API_V3):
is_allowed = va_profile_client.get_is_communication_allowed_v3(
identifier, communication_item.va_profile_item_id, notification_id, notification_type
)
else:
is_allowed = va_profile_client.get_is_communication_allowed(
identifier, communication_item.va_profile_item_id, notification_id, notification_type
)
is_allowed = va_profile_client.get_is_communication_allowed(
identifier, communication_item.va_profile_item_id, notification_id, notification_type
)
except VAProfileRetryableException as e:
if can_retry(task.request.retries, task.max_retries, notification_id):
current_app.logger.warning(
Expand Down
1 change: 0 additions & 1 deletion app/feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class FeatureFlag(Enum):
V3_ENABLED = 'V3_ENABLED'
COMP_AND_PEN_MESSAGES_ENABLED = 'COMP_AND_PEN_MESSAGES_ENABLED'
VA_PROFILE_EMAIL_STATUS_ENABLED = 'VA_PROFILE_EMAIL_STATUS_ENABLED'
VA_PROFILE_V3_USE_PROFILE_API_V3 = 'VA_PROFILE_V3_USE_PROFILE_API_V3'
VA_PROFILE_V3_COMBINE_CONTACT_INFO_AND_PERMISSIONS_LOOKUP = (
'VA_PROFILE_V3_COMBINE_CONTACT_INFO_AND_PERMISSIONS_LOOKUP'
)
Expand Down
5 changes: 0 additions & 5 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
PUSH_TYPE = 'push'
SMS_TYPE = 'sms'

VA_NOTIFY_TO_VA_PROFILE_NOTIFICATION_TYPES = {
EMAIL_TYPE: 'Email',
SMS_TYPE: 'Text',
}

TEMPLATE_TYPES = [SMS_TYPE, EMAIL_TYPE, LETTER_TYPE]

template_types = db.Enum(*TEMPLATE_TYPES, name='template_type')
Expand Down
4 changes: 4 additions & 0 deletions app/va/va_profile/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ class VAProfileIDNotFoundException(VAProfileNonRetryableException):

class ContactPreferencesException(VAProfileNonRetryableException):
failure_reason = 'VA Profile contact preferences not allowing contact'


class CommunicationItemNotFoundException(Exception):
failure_reason = 'No communication bio found from VA Profile'
Loading

0 comments on commit ecbbe09

Please sign in to comment.