mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-14 23:07:49 -04:00
New endpoint to return a summary of returned letters for the service.
This commit is contained in:
@@ -59,7 +59,9 @@ from app.models import (
|
||||
TemplateFolder,
|
||||
LetterBranding,
|
||||
Domain,
|
||||
NotificationHistory
|
||||
NotificationHistory,
|
||||
NOTIFICATION_RETURNED_LETTER,
|
||||
ReturnedLetter
|
||||
)
|
||||
|
||||
|
||||
@@ -940,3 +942,19 @@ def set_up_usage_data(start_date):
|
||||
notifications_sent=15, billable_unit=4, rate=.55, postage='second')
|
||||
|
||||
return org, org_3, service, service_3, service_4, service_sms_only
|
||||
|
||||
|
||||
def create_returned_letter(service, reported_at=None):
|
||||
if not service:
|
||||
service = create_service(service_name='a - with sms and letter')
|
||||
template = create_template(service=service, template_type=LETTER_TYPE)
|
||||
notification = create_notification(template=template, status=NOTIFICATION_RETURNED_LETTER)
|
||||
returned_letter = ReturnedLetter(
|
||||
service_id= service.id,
|
||||
reported_at= reported_at or datetime.utcnow(),
|
||||
notification_id= notification.id
|
||||
)
|
||||
|
||||
db.session.add(returned_letter)
|
||||
db.session.commit()
|
||||
return returned_letter
|
||||
Reference in New Issue
Block a user