String cleanup complete.

Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2024-02-21 14:50:36 -05:00
parent 7083db9351
commit 06d1e0236f
15 changed files with 67 additions and 54 deletions

View File

@@ -20,7 +20,7 @@ from app.dao.service_callback_api_dao import (
get_service_complaint_callback_api_for_service,
get_service_delivery_status_callback_api_for_service,
)
from app.enums import NotificationStatus
from app.enums import CallbackType, NotificationStatus
from app.models import Complaint
@@ -209,7 +209,7 @@ def handle_complaint(ses_message):
)
return
notification = dao_get_notification_history_by_reference(reference)
ses_complaint = ses_message.get("complaint", None)
ses_complaint = ses_message.get(CallbackType.COMPLAINT, None)
complaint = Complaint(
notification_id=notification.id,
@@ -241,7 +241,7 @@ def remove_emails_from_bounce(bounce_dict):
def remove_emails_from_complaint(complaint_dict):
remove_mail_headers(complaint_dict)
complaint_dict["complaint"].pop("complainedRecipients")
complaint_dict[CallbackType.COMPLAINT].pop("complainedRecipients")
return complaint_dict["mail"].pop("destination")

View File

@@ -3,6 +3,7 @@ from flask import current_app
from app import db
from app.dao.dao_utils import autocommit
from app.dao.date_util import get_current_calendar_year_start_year
from app.enums import OrganizationType
from app.models import AnnualBilling
@@ -65,17 +66,17 @@ def dao_get_all_free_sms_fragment_limit(service_id):
def set_default_free_allowance_for_service(service, year_start=None):
default_free_sms_fragment_limits = {
"federal": {
OrganizationType.FEDERAL: {
2020: 250_000,
2021: 150_000,
2022: 40_000,
},
"state": {
OrganizationType.STATE: {
2020: 250_000,
2021: 150_000,
2022: 40_000,
},
"other": {
OrganizationType.OTHER: {
2020: 250_000,
2021: 150_000,
2022: 40_000,
@@ -97,7 +98,9 @@ def set_default_free_allowance_for_service(service, year_start=None):
f"no organization type for service {service.id}. Using other default of "
f"{default_free_sms_fragment_limits['other'][year_start]}"
)
free_allowance = default_free_sms_fragment_limits["other"][year_start]
free_allowance = default_free_sms_fragment_limits[OrganizationType.OTHER][
year_start
]
return dao_create_or_update_annual_billing_for_year(
service.id, free_allowance, year_start