Accept and validate personalisation

This commit allows the send notification endpoint to accept an extra parameter,
`personalisation`, the contents of which will be used (later) to replace the
placeholders in the template.

It does validation in the following places:
- at the schema level, to validate the type and (optional) presence of
  personalisation
- at the endpoint, to check whether the personalisation provided matches exactly
  the placeholders in the template

It does not do validation when processing CSV files, as these are assumed to
already have been validated by the admin app.

It explicitly does not persist either the names of the placeholders (these
should always be derived from the template contents unless it really becomes a
performance concern) or the values of the placeholders (because they might be
personal data).
This commit is contained in:
Chris Hill-Scott
2016-02-29 11:23:34 +00:00
parent 68f31c6f84
commit 68eaacaafb
4 changed files with 128 additions and 3 deletions

View File

@@ -118,6 +118,7 @@ class RequestVerifyCodeSchema(ma.Schema):
class NotificationSchema(ma.Schema):
personalisation = fields.Dict(required=False)
pass