add flag to return pdf content via api

this is only applicable when getting a single notification by id. it's
also ignored if the notification isn't a letter.

Otherwise, it overwrites the 'body' field in the response.

If the notification's pdf is available, it returns that, base64
encoded. If the pdf is not available, it returns an empty string.

The pdf won't be available if the notification's status is:
* pending-virus-scan
* virus-scan-failed
* validation-failed
* technical-failure

The pdf will be retrieved from the correct s3 bucket based on its type
This commit is contained in:
Leo Hemsted
2019-09-03 16:49:03 +01:00
parent 5cdce44e42
commit 22aff482a8
4 changed files with 62 additions and 2 deletions

View File

@@ -1547,7 +1547,7 @@ class Notification(db.Model):
elif self.status in [NOTIFICATION_DELIVERED, NOTIFICATION_RETURNED_LETTER]:
return NOTIFICATION_STATUS_LETTER_RECEIVED
else:
# Currently can only be technical-failure
# Currently can only be technical-failure OR pending-virus-check OR validation-failed
return self.status
def get_created_by_name(self):