From 7c74864dfe64c9e2266241ff7e8704ca0b768483 Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 12:45:45 +0100 Subject: [PATCH 01/12] Added request to go live form elements --- app/main/forms.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index c85d58b6e..5c3d07e58 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -346,10 +346,11 @@ class Feedback(Form): class RequestToGoLiveForm(Form): - usage = TextAreaField( - '', - validators=[DataRequired(message="Can’t be empty")] - ) + channel = Stringfield('Are you sending emails or text messages or both?') + start_date = Stringfield('When will you be ready to start sending messages?') + start_volume = Stringfield('How many messages do you expect to send per month to start with? Give an estimate in numbers.') + peak_volume = Stringfield('Will the number of messages a month increase and when will that start? Give an estimate.') + upload_or_api = Stringfield('Are you uploading a list of contacts that you’re sending your message to, or are you integrating your system with ours?') class ProviderForm(Form): From 3ff5be00a8bd5e4137df9b1afbf9c0d1ea89b098 Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 12:52:51 +0100 Subject: [PATCH 02/12] Added new form elements to request to go live page --- .../views/service-settings/request-to-go-live.html | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index ae5124491..8838cfb72 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -24,14 +24,11 @@
- - {{ textbox( - form.usage, - label='Estimate how many emails and text messages you’ll send each month', - hint='If your estimate is likely to change, tell us how ', - width='1-1', - rows=5 - ) }} + {{ textbox(form.channel, width='1-1') }} + {{ textbox(form.start_date, width='1-1') }} + {{ textbox(form.start_volume, width='1-1') }} + {{ textbox(form.peak_volume, width='1-1') }} + {{ textbox(form.upload_or_api, width='1-1') }}

We will: From f343d239151324bec1fc00a4ba050aea8ca3570e Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 13:01:23 +0100 Subject: [PATCH 03/12] Added new request to go live fields to deskpro tickets --- app/main/views/service_settings.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 3f90d2bdf..c4fdae628 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -110,10 +110,15 @@ def service_request_to_go_live(service_id): 'department_id': current_app.config.get('DESKPRO_DEPT_ID'), 'agent_team_id': current_app.config.get('DESKPRO_ASSIGNED_AGENT_TEAM_ID'), 'subject': 'Request to go live', - 'message': "On behalf of {} ({})\n\nUsage estimate\n---\n\n{}".format( + 'message': "On behalf of {} ({})\n\nExpected usage\n---\n\nChannel: {}\nStart date: {}\nStart volume: {}\nPeak volume: {}\nUpload or API: {}".format( current_service['name'], url_for('main.service_dashboard', service_id=current_service['id'], _external=True), - form.usage.data + form.channel.data, + form.start_date.data, + form.start_volume.data, + form.peak_volume.data, + form.upload_or_api.data + ) } headers = { From 070690941942d8f1a7b8b02a42375bf337691696 Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 13:17:50 +0100 Subject: [PATCH 04/12] Reduced field widths to half on go live page --- .../views/service-settings/request-to-go-live.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index 8838cfb72..cf78dda71 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -24,11 +24,11 @@ - {{ textbox(form.channel, width='1-1') }} - {{ textbox(form.start_date, width='1-1') }} - {{ textbox(form.start_volume, width='1-1') }} - {{ textbox(form.peak_volume, width='1-1') }} - {{ textbox(form.upload_or_api, width='1-1') }} + {{ textbox(form.channel, width='1-2') }} + {{ textbox(form.start_date, width='1-2') }} + {{ textbox(form.start_volume, width='1-2') }} + {{ textbox(form.peak_volume, width='1-2') }} + {{ textbox(form.upload_or_api, width='1-2') }}

We will: From 0bde2d238f429f2f6f14012ddd60cad34f83f8fc Mon Sep 17 00:00:00 2001 From: Imdad Ahad Date: Mon, 24 Oct 2016 13:38:55 +0100 Subject: [PATCH 05/12] Fix casing and multi-line stuff --- app/main/forms.py | 17 ++++++++++++----- app/main/views/service_settings.py | 8 ++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 5c3d07e58..65a4c4828 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -346,11 +346,18 @@ class Feedback(Form): class RequestToGoLiveForm(Form): - channel = Stringfield('Are you sending emails or text messages or both?') - start_date = Stringfield('When will you be ready to start sending messages?') - start_volume = Stringfield('How many messages do you expect to send per month to start with? Give an estimate in numbers.') - peak_volume = Stringfield('Will the number of messages a month increase and when will that start? Give an estimate.') - upload_or_api = Stringfield('Are you uploading a list of contacts that you’re sending your message to, or are you integrating your system with ours?') + channel = StringField('Are you sending emails or text messages or both?') + start_date = StringField('When will you be ready to start sending messages?') + start_volume = StringField( + 'How many messages do you expect to send per month to start with? Give an estimate in numbers.' + ) + peak_volume = StringField( + 'Will the number of messages a month increase and when will that start? Give an estimate.' + ) + upload_or_api = StringField( + 'Are you uploading a list of contacts that you’re sending your message to, ' + + 'or are you integrating your system with ours?' + ) class ProviderForm(Form): diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index c4fdae628..a085fc556 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -110,7 +110,11 @@ def service_request_to_go_live(service_id): 'department_id': current_app.config.get('DESKPRO_DEPT_ID'), 'agent_team_id': current_app.config.get('DESKPRO_ASSIGNED_AGENT_TEAM_ID'), 'subject': 'Request to go live', - 'message': "On behalf of {} ({})\n\nExpected usage\n---\n\nChannel: {}\nStart date: {}\nStart volume: {}\nPeak volume: {}\nUpload or API: {}".format( + 'message': + ('On behalf of {} ({})\n\nExpected usage\n---' + '\nChannel: {}\nStart date: {}\nStart volume: {}' + '\nPeak volume: {}\nUpload or API: {}') + .format( current_service['name'], url_for('main.service_dashboard', service_id=current_service['id'], _external=True), form.channel.data, @@ -118,7 +122,7 @@ def service_request_to_go_live(service_id): form.start_volume.data, form.peak_volume.data, form.upload_or_api.data - + ) } headers = { From 8cddc327f891ae6b82cf188e2de0a6a88356f7e8 Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 14:36:37 +0100 Subject: [PATCH 06/12] Added MoU banner warning to the request to go live page --- .../service-settings/request-to-go-live.html | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index cf78dda71..c3c02462f 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -10,17 +10,31 @@

Request to go live

+ {% call banner_wrapper(type='warning') %} +

You must accept the GOV.UK Notify data sharing and financial agreement (Memorandum of Understanding) before we can process data for you.

+ +

+ Contact the Notify team to get a copy of the agreement or to find out if your organisation has already accepted it. +

+ {% endcall %} +

- You’ll need to: + Before you request to go live, make you you’ve:

@@ -31,26 +45,12 @@ {{ textbox(form.upload_or_api, width='1-2') }}

- We will: + Once you’ve completed the tasks needed to set up, we’ll make your service live. We’ll do this within one working day.

- - +

+ By requesting to go live you are agreeing to our terms of use. +

+ {{ page_footer('Request to go live') }}
From 3c53a8a269d59963f579b917124dbe42e3a18ecd Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 14:44:38 +0100 Subject: [PATCH 07/12] Added reminder to get MoU in place to top of terms page --- app/templates/views/terms-of-use.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/templates/views/terms-of-use.html b/app/templates/views/terms-of-use.html index f6caffbac..9249261cf 100644 --- a/app/templates/views/terms-of-use.html +++ b/app/templates/views/terms-of-use.html @@ -13,6 +13,15 @@ Terms of use – GOV.UK Notify Terms of use + {% call banner_wrapper(type='warning') %} +

You must accept the GOV.UK Notify data sharing and financial agreement (Memorandum of Understanding) before we can process data for you.

+ +

+ Contact the Notify team to get a copy of the agreement or to find out if your organisation has already accepted it. +

+ + {% endcall %} +

To accept these terms, you must be the service manager for your service. If you’re not the service manager, you’ll need to invite them.

From 0bb7fdb21611157c4239dbad8355f0c09adef142 Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 15:33:13 +0100 Subject: [PATCH 08/12] Added non breaking space to the request to go live page --- app/templates/views/service-settings/request-to-go-live.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index c3c02462f..7c94eaea6 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -11,7 +11,7 @@

Request to go live

{% call banner_wrapper(type='warning') %} -

You must accept the GOV.UK Notify data sharing and financial agreement (Memorandum of Understanding) before we can process data for you.

+

You must accept the GOV.UK Notify data sharing and financial agreement (Memorandum of Understanding) before we can process data for you.

Contact the Notify team to get a copy of the agreement or to find out if your organisation has already accepted it. From 876832801e6652e6c37e736249f9015df334c409 Mon Sep 17 00:00:00 2001 From: Imdad Ahad Date: Mon, 24 Oct 2016 15:35:51 +0100 Subject: [PATCH 09/12] Fix tests and other bits --- app/main/views/service_settings.py | 10 +++++----- .../views/service-settings/request-to-go-live.html | 11 ++++++----- app/templates/views/terms-of-use.html | 11 ++++++----- tests/app/main/views/test_service_settings.py | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index a085fc556..71a038bed 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -110,11 +110,11 @@ def service_request_to_go_live(service_id): 'department_id': current_app.config.get('DESKPRO_DEPT_ID'), 'agent_team_id': current_app.config.get('DESKPRO_ASSIGNED_AGENT_TEAM_ID'), 'subject': 'Request to go live', - 'message': - ('On behalf of {} ({})\n\nExpected usage\n---' - '\nChannel: {}\nStart date: {}\nStart volume: {}' - '\nPeak volume: {}\nUpload or API: {}') - .format( + 'message': ( + 'On behalf of {} ({})\n\nExpected usage\n---' + '\nChannel: {}\nStart date: {}\nStart volume: {}' + '\nPeak volume: {}\nUpload or API: {}' + ).format( current_service['name'], url_for('main.service_dashboard', service_id=current_service['id'], _external=True), form.channel.data, diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index c3c02462f..aaeda6f04 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -1,6 +1,7 @@ {% extends "withnav_template.html" %} {% from "components/textbox.html" import textbox %} {% from "components/page-footer.html" import page_footer %} +{% from "components/banner.html" import banner_wrapper %} {% block page_title %} Request to go live – GOV.UK Notify @@ -17,7 +18,7 @@ Contact the Notify team to get a copy of the agreement or to find out if your organisation has already accepted it.

{% endcall %} - +

Before you request to go live, make you you’ve:

@@ -26,10 +27,10 @@
  • read our terms of use
  • added team members to your account
  • - specified your reply to email address or text message sender in your + specified your reply to email address or text message sender in your settings page
  • - added the templates you want to start with, making sure they follow our + added the templates you want to start with, making sure they follow our design patterns, style guide and @@ -47,10 +48,10 @@

    Once you’ve completed the tasks needed to set up, we’ll make your service live. We’ll do this within one working day.

    -

    +

    By requesting to go live you are agreeing to our terms of use.

    - + {{ page_footer('Request to go live') }} diff --git a/app/templates/views/terms-of-use.html b/app/templates/views/terms-of-use.html index 9249261cf..89f87b69a 100644 --- a/app/templates/views/terms-of-use.html +++ b/app/templates/views/terms-of-use.html @@ -1,4 +1,5 @@ {% extends "withoutnav_template.html" %} +{% from "components/banner.html" import banner_wrapper %} {% block page_title %} Terms of use – GOV.UK Notify @@ -19,9 +20,9 @@ Terms of use – GOV.UK Notify

    Contact the Notify team to get a copy of the agreement or to find out if your organisation has already accepted it.

    - + {% endcall %} - +

    To accept these terms, you must be the service manager for your service. If you’re not the service manager, you’ll need to invite them.

    @@ -161,7 +162,7 @@ Terms of use – GOV.UK Notify

    When you send messages through GOV.UK Notify, we provide feedback on the status of every text message, email and letter.

    You agree to use our delivery data to check (and potentially remove) bounced email addresses, mobile numbers and postal addresses from your database.

    - +

    You agree to ensure your user’s personal data is kept accurate and up to date, in line with Data Protection Act principles.

    If you have consistently high bounce rates, we will investigate and may refuse to accept further messages for delivery. This is to protect delivery rates for other services using GOV.UK Notify.

    @@ -190,7 +191,7 @@ Terms of use – GOV.UK Notify

    You must estimate how many text messages, emails and letters you plan to send each year, including any spikes or seasonal variation.

    We will make sure GOV.UK Notify is easily able to handle your estimated sending volume.

    - +

    We’ll check your templates before you can go live

    @@ -204,7 +205,7 @@ Terms of use – GOV.UK Notify

    You can remove your service from GOV.UK Notify at any time. Contact us and we’ll delete your account.

    - +

    Any data that you have processed through GOV.UK Notify will be deleted as part of the existing data deletion processes.

    diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 0f75d86c6..c5090b79f 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -323,7 +323,7 @@ def test_should_redirect_after_request_to_go_live( 'subject': 'Request to go live', 'department_id': ANY, 'agent_team_id': ANY, - 'message': 'On behalf of Test Service (http://localhost/services/6ce466d0-fd6a-11e5-82f5-e0accb9d11a6/dashboard)\n\nUsage estimate\n---\n\nOne million messages', # noqa + 'message': ANY, # noqa 'person_name': api_user_active.name, 'person_email': api_user_active.email_address }, From 24cad78ecb8db9d9cec82be64b83d257e68f9a93 Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 15:38:00 +0100 Subject: [PATCH 10/12] Reverting width of fields to 100% on request to go live --- .../views/service-settings/request-to-go-live.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index 77650f794..57ac237d9 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -12,7 +12,7 @@

    Request to go live

    {% call banner_wrapper(type='warning') %} -

    You must accept the GOV.UK Notify data sharing and financial agreement (Memorandum of Understanding) before we can process data for you.

    +

    You must accept the GOV.UK Notify data sharing and financial agreement (Memorandum of Understanding) before we can process data for you.

    Contact the Notify team to get a copy of the agreement or to find out if your organisation has already accepted it. @@ -39,11 +39,11 @@

    - {{ textbox(form.channel, width='1-2') }} - {{ textbox(form.start_date, width='1-2') }} - {{ textbox(form.start_volume, width='1-2') }} - {{ textbox(form.peak_volume, width='1-2') }} - {{ textbox(form.upload_or_api, width='1-2') }} + {{ textbox(form.channel, width='1-1') }} + {{ textbox(form.start_date, width='1-1') }} + {{ textbox(form.start_volume, width='1-1') }} + {{ textbox(form.peak_volume, width='1-1') }} + {{ textbox(form.upload_or_api, width='1-1') }}

    Once you’ve completed the tasks needed to set up, we’ll make your service live. We’ll do this within one working day. From ae48bdef980ef161c4e57a7dbc8b703d2d1a2bc6 Mon Sep 17 00:00:00 2001 From: Pete Herlihy Date: Mon, 24 Oct 2016 15:46:22 +0100 Subject: [PATCH 11/12] Made the request to go live fields mandatory --- app/main/forms.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 65a4c4828..32e19212d 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -346,17 +346,26 @@ class Feedback(Form): class RequestToGoLiveForm(Form): - channel = StringField('Are you sending emails or text messages or both?') - start_date = StringField('When will you be ready to start sending messages?') + channel = StringField( + 'Are you sending emails or text messages or both?' + , validators=[DataRequired(message='Can’t be empty')] + ) + start_date = StringField( + 'When will you be ready to start sending messages?' + , validators=[DataRequired(message='Can’t be empty')] + ) start_volume = StringField( 'How many messages do you expect to send per month to start with? Give an estimate in numbers.' + , validators=[DataRequired(message='Can’t be empty')] ) peak_volume = StringField( 'Will the number of messages a month increase and when will that start? Give an estimate.' + , validators=[DataRequired(message='Can’t be empty')] ) upload_or_api = StringField( 'Are you uploading a list of contacts that you’re sending your message to, ' + 'or are you integrating your system with ours?' + , validators=[DataRequired(message='Can’t be empty')] ) From a707bd546c42c2d2615d8eb35850d7b3d4c4988c Mon Sep 17 00:00:00 2001 From: Imdad Ahad Date: Mon, 24 Oct 2016 16:10:41 +0100 Subject: [PATCH 12/12] Updates: * Fix tests * Add tests for new message format --- app/main/forms.py | 20 +++++++-------- tests/app/main/views/test_service_settings.py | 25 ++++++++++++++++--- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index 32e19212d..f4c2f6a39 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -347,25 +347,25 @@ class Feedback(Form): class RequestToGoLiveForm(Form): channel = StringField( - 'Are you sending emails or text messages or both?' - , validators=[DataRequired(message='Can’t be empty')] + 'Are you sending emails or text messages or both?', + validators=[DataRequired(message='Can’t be empty')] ) start_date = StringField( - 'When will you be ready to start sending messages?' - , validators=[DataRequired(message='Can’t be empty')] + 'When will you be ready to start sending messages?', + validators=[DataRequired(message='Can’t be empty')] ) start_volume = StringField( - 'How many messages do you expect to send per month to start with? Give an estimate in numbers.' - , validators=[DataRequired(message='Can’t be empty')] + 'How many messages do you expect to send per month to start with? Give an estimate in numbers.', + validators=[DataRequired(message='Can’t be empty')] ) peak_volume = StringField( - 'Will the number of messages a month increase and when will that start? Give an estimate.' - , validators=[DataRequired(message='Can’t be empty')] + 'Will the number of messages a month increase and when will that start? Give an estimate.', + validators=[DataRequired(message='Can’t be empty')] ) upload_or_api = StringField( 'Are you uploading a list of contacts that you’re sending your message to, ' + - 'or are you integrating your system with ours?' - , validators=[DataRequired(message='Can’t be empty')] + 'or are you integrating your system with ours?', + validators=[DataRequired(message='Can’t be empty')] ) diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index c5090b79f..cb26e0a9b 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -313,7 +313,13 @@ def test_should_redirect_after_request_to_go_live( client.login(api_user_active) response = client.post( url_for('main.service_request_to_go_live', service_id='6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'), - data={'usage': "One million messages"}, + data={ + 'channel': 'Email', + 'start_date': '01/01/2017', + 'start_volume': '100,000', + 'peak_volume': '2,000,000', + 'upload_or_api': 'api' + }, follow_redirects=True ) assert response.status_code == 200 @@ -323,13 +329,20 @@ def test_should_redirect_after_request_to_go_live( 'subject': 'Request to go live', 'department_id': ANY, 'agent_team_id': ANY, - 'message': ANY, # noqa + 'message': ANY, 'person_name': api_user_active.name, 'person_email': api_user_active.email_address }, headers=ANY ) + returned_message = mock_post.call_args[1]['data']['message'] + assert 'Email' in returned_message + assert '01/01/2017' in returned_message + assert '100,000' in returned_message + assert '2,000,000' in returned_message + assert 'api' in returned_message + page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') flash_banner = page.find('div', class_='banner-default').string.strip() h1 = page.find('h1').string.strip() @@ -362,7 +375,13 @@ def test_log_error_on_request_to_go_live( with pytest.raises(InternalServerError): resp = client.post( url_for('main.service_request_to_go_live', service_id='6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'), - data={'usage': 'blah'} + data={ + 'channel': 'channel', + 'start_date': 'start_date', + 'start_volume': 'start_volume', + 'peak_volume': 'peak_volume', + 'upload_or_api': 'upload_or_api' + } ) mock_logger.assert_called_with( "Deskpro create ticket request failed with {} '{}'".format(mock_post().status_code, mock_post().json())