mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 05:28:49 -04:00
New endpoint to return data for complaints.
This commit is contained in:
@@ -34,7 +34,8 @@ from app.models import (
|
||||
AnnualBilling,
|
||||
LetterRate,
|
||||
InvitedOrganisationUser,
|
||||
FactBilling
|
||||
FactBilling,
|
||||
Complaint
|
||||
)
|
||||
from app.dao.users_dao import save_model_user
|
||||
from app.dao.notifications_dao import (
|
||||
@@ -564,6 +565,27 @@ def create_ft_billing(bst_date,
|
||||
return data
|
||||
|
||||
|
||||
def create_complaint(service=None,
|
||||
notification=None):
|
||||
|
||||
if not service:
|
||||
service=create_service()
|
||||
if not notification:
|
||||
template = create_template(service=service, template_type='email')
|
||||
notification = create_notification(template=template)
|
||||
|
||||
|
||||
complaint = Complaint(notification_id=notification.id,
|
||||
service_id=service.id,
|
||||
ses_feedback_id=str(uuid.uuid4()),
|
||||
complaint_type='abuse',
|
||||
complaint_date=datetime.utcnow()
|
||||
)
|
||||
db.session.add(complaint)
|
||||
db.session.commit()
|
||||
return complaint
|
||||
|
||||
|
||||
def ses_complaint_callback_malformed_message_id():
|
||||
return '{\n "Type" : "Notification",\n "msgId" : "ref1",' \
|
||||
'\n "TopicArn" : "arn:aws:sns:eu-west-1:123456789012:testing",' \
|
||||
|
||||
Reference in New Issue
Block a user