Commit Graph

366 Commits

Author SHA1 Message Date
kentsanggds
d39bf96324 Merge pull request #1333 from alphagov/ken-handle-dvla-response-file
Handle DVLA response file
2017-10-26 11:09:09 +01:00
Ken Tsang
b40cab0c5d Refactored models to make const consistent 2017-10-25 15:38:58 +01:00
Ken Tsang
a2b42194cd Add letter status received to data model
- in order to reduce the number of statuses in the database the letter status `received` will be mapped to `delivered` internally
2017-10-25 10:48:35 +01:00
Rebecca Law
8d6c38e1fe Now that we allow multiple SMS senders for a service, update the sender for SMS to be the default SMS sender, regardless if it is inbound number or not 2017-10-24 13:37:17 +01:00
Rebecca Law
954a80649e Merge branch 'master' into add-update-multiple-sms-sender 2017-10-19 14:34:58 +01:00
venusbb
b0872d9466 add unique service_id&year constraint 2017-10-19 14:21:10 +01:00
venusbb
7e78e19500 Unique constrain and db.relationship 2017-10-19 12:00:01 +01:00
Rebecca Law
709e24e267 Added endpoints to get sms senders for a service 2017-10-19 10:43:49 +01:00
Rebecca Law
6dc41c3b47 New endpoints to add and update multiple SMS sender for a service. 2017-10-19 09:58:23 +01:00
venusbb
b2fa7cdd83 create new table annual_billing 2017-10-18 15:35:51 +01:00
Rebecca Law
1a463cba1f Merge branch 'master' into add-update-multiple-sms-sender 2017-10-18 11:18:44 +01:00
Chris Hill-Scott
2a5e6c2d0c Store organisation type against each service
> So that we can default services to their appropriate text allowance,
> we need to find out what sector they're in. So let's start collecting
> that from teams as they create new services.

In order to work out what a team’s allowance should be, we need to know
what part of government they’re from. We’re going to do this logic in
the admin app and then `POST` the allowance to the API.

So all we need to do with the information that the users give us is
store it against the service, so we have a record. Doesn’t need any
logic doing as a result of it, doesn’t need foreign keying to the
organisations table, etc.
2017-10-18 10:49:31 +01:00
Rebecca Law
809c5fc055 Remove unique constraint for ServiceSmsSenders.
This will allow a service to have multiple sms senders.
2017-10-17 16:49:50 +01:00
Venus Bailey
9b60d69931 Revert "Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table"" 2017-10-16 16:24:34 +01:00
Venus Bailey
616a6f8ef8 Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table" 2017-10-16 12:43:05 +01:00
venusbb
f95282a84d Add column, free_sms_fragment_limit, to services & services_history
- Created new column in both tables
- Modified model and Service schema
- Modifed existing test
2017-10-12 12:16:13 +01:00
Rebecca Law
9d507466ef Remove exception thrown when getting default sender.
Having more than one default is checked on insert and update.
2017-10-04 14:51:02 +01:00
Rebecca Law
78a9d74c49 Merge branch 'master' into return-service_sms_sender_value 2017-10-04 13:29:05 +01:00
Katie Smith
0903a28ba8 Merge pull request #1281 from alphagov/imdad-katie-return-letter-contact-from-new-table
[4/4] Use letter contact from the new table
2017-10-03 16:42:40 +01:00
Katie Smith
dede336b3b Update tests to not use letter contact block from services table
A few test updates were needed after rebasing onto master.
2017-10-03 13:35:09 +01:00
Richard Chapman
e4b95ab20a Merge pull request #1282 from alphagov/rc_notifications_email_sender
[1/10] Allow API calls to specify the reply address option
2017-10-03 11:56:26 +01:00
Richard Chapman
d8e1a34610 Added a unique constraint to the notification_id column of the notification_to_email_reply_to table so that each notification can only have one mapping to service_email_reply_to and hence one email address. 2017-10-03 11:03:31 +01:00
Imdad Ahad
4eebd9a83c Remove the letter_contact_block from the Service model 2017-10-03 10:31:21 +01:00
Rebecca Law
d5c9174641 Merge branch 'master' of github.com:alphagov/notifications-api into return-service_sms_sender_value 2017-10-02 12:36:46 +01:00
Chris Hill-Scott
2614d719d1 Merge pull request #1264 from alphagov/template-returns-placeholders
Return placeholders when getting a template
2017-10-02 11:21:46 +01:00
Rebecca Law
ba7cd79581 Created a get_default_sms_sender method, which returns the default sms_sender from the service_sms_sender table rather than service.sms_sender.
One step closer to removing services.sms_sender.

fix the unit tests
2017-10-02 10:29:00 +01:00
Richard Chapman
fdc4d4c24f Reanmed the link table to be a bteer description of what the table is for as it was previously confusing. Updated the migration script to reflect those changes 2017-09-28 11:11:41 +01:00
Richard Chapman
6356a5320a Updated model with a new table notification_to_email_sender and created db migration script 2017-09-27 10:36:25 +01:00
Rebecca Law
64db8cb18d Merge branch 'master' into select-inbound-number-to-assign 2017-09-25 11:13:12 +01:00
Chris Hill-Scott
55d185f50d Return metadata about placeholders
In the future, we may want to return additional information about
placeholders.

We came up with three possible formats:
1. list of `dict`s, eg `[{'name': 'first name', 'required': True}]`
2. `dict` of `list`s, eg `{'required': ['first name']}`
3. `dict` of `dict`s, eg `{'name': {'required': True}}`

I don’t like 1. because it’s harder to traverse if all you want is the
name of the placeholders, and suggests that you could have two
placeholders with the same name (which you can’t). I don’t like 2.
because it only lets the data be sliced by one dimension (unless the
inner lists aren’t exclusive, in which case you’d need to filter
duplicates when just listing placeholders).

I think 3. has the two advantages of:
- represents that personalisation is unique, ie you can’t pass back in
  two different values for the same key
- is forward compatible, ie we can add many more properties of a
  placeholder without breaking anything

So this commit implements 3.
2017-09-22 16:42:16 +01:00
Chris Hill-Scott
fa8e4b29f2 Return placeholders when getting a template
> Currently when retrieving a template via one of the clients, we do
> not return the personalisation fields that are required for that
> template.
>
> This is useful for services who want to perform template validation on
> their own systems. A service user has also requested this.

– https://www.pivotaltracker.com/story/show/150674476

This commit adds an extra attribute to the JSON response containing an
array of the placeholder names. This key is called "personalisation",
to match the argument that developers use to pass in the values of
placeholders.
2017-09-22 10:00:23 +01:00
Ken Tsang
91a618531d Update serialization and service schema
- added id and service_id in serialization
- added 'letter_contacts' to the exluded list for marshmallow service schema
2017-09-21 16:38:24 +01:00
Ken Tsang
366d07dbbe Add ServiceLetterContact data model and script 2017-09-21 16:08:49 +01:00
Rebecca Law
18581c754a Add new endpoint to get available inbound number.
Add new endpoint to allocate a specific number to a given service.

This will allow the platform admin user to choose a number when setting the inbound_sms permission for a service.
2017-09-21 15:18:52 +01:00
Chris Hill-Scott
8360b9a122 Merge pull request #1265 from alphagov/logoless-organsations
Make organisation logo nullable
2017-09-21 13:01:06 +01:00
Rebecca Law
0c9f16a8d1 Add id and service_id to the serialize method on ServiceEmailReplyTo 2017-09-21 10:21:32 +01:00
Rebecca Law
08fdcbfc67 Merge pull request #1266 from alphagov/use-reply-to-from-new-table
Use reply to email address from new table
2017-09-21 09:54:52 +01:00
Leo Hemsted
9afb2c36e7 Merge pull request #1241 from alphagov/letter-received
Letters are accepted, not created or sending
2017-09-20 16:51:31 +01:00
Leo Hemsted
4174c72f21 allow 'accepted' as a proxy for created + sending as well as 'failed' for the three failure types when querying the api 2017-09-20 15:30:14 +01:00
Rebecca Law
06ffac9a0f Merge branch 'master' into use-reply-to-from-new-table 2017-09-20 14:00:04 +01:00
Rebecca Law
3a5706994f Merge pull request #1258 from alphagov/add-multiple-reply-to-email-endpoints
Add multiple reply to email endpoints
2017-09-20 13:26:02 +01:00
Leo Hemsted
cb3379d0b6 rename received_by_notify to accepted
accepted is nice since it both implies that things look good, while
not being commital about next steps.
2017-09-20 11:20:51 +01:00
Leo Hemsted
4936fa384c return fake "received_by_notify" status for letter notifications
created and sending aren't quite as helpful for letters, since their
journey through notify and our providers is so different to emails/sms.
So instead, we should return estimated_dispatch_date (in a future PR)
and the status should just read received_by_notify
2017-09-20 11:20:13 +01:00
Chris Hill-Scott
bde6a9e131 Make organisation logo nullable
Now we have the org banner branding, not all organisations need a logo.
So it shouldn’t be an error to not provide one.
2017-09-20 11:06:16 +01:00
Rebecca Law
a53a0da414 [WIP] need to fix the tests 2017-09-20 10:45:35 +01:00
chrisw
f49eca5324 Add a non-GOV.UK banner option for email branding
Added an extra name, 'org_banner', for branding types into branding_type table
Added org banner into user model in database
Added checks for new branding type to ensure that the correct data is passed into the dict
Tested new checks in html email options
2017-09-19 14:40:22 +01:00
Chris Hill-Scott
29a962060f Return delivery estimate for letter notifications
> For get all or get one letter the response needs to be updated so that
> it looks similar to admin app.
>
> status: created|sending --> received letter
> new column: `estimated delivery date`: derived from created at date.
> (see how the admin app is doing it)
>
> NOTE:
> At the moment we only have 2 statuses for a letter created and
> sending, but we will want to have other internal statuses that make
> sense to the Notify team but not our services. When we know those
> statuses the status map will be updated at that point.

– https://www.pivotaltracker.com/story/show/150512525

This commit implements the date (not status) part of this story.
2017-09-15 14:58:07 +01:00
Rebecca Law
6b2c2962c9 New endpoint to insert new service reply to email address and update existing one. 2017-09-14 17:54:38 +01:00
Katie Smith
72760550bd Add endpoint to get the email reply to addresses for a service
- Changed the dao_get_reply_to_by_service_id method to return a list of
results.
- Added a GET /service/<service_id>/email-reply-to endpoint
2017-09-13 16:58:36 +01:00
Rebecca Law
d356957974 Change the ServiceEmailReplyTo model to uselist for the backref to services (allow 0 to many reply to emails)
Add another assert in the test
2017-09-12 10:14:58 +01:00