mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
Merge branch 'master' of https://github.com/alphagov/notifications-admin into vb-callback-admin
Some content change Refractor api_integration to api_keys to reduce git difference.
This commit is contained in:
@@ -21,7 +21,7 @@ from app.main.views import ( # noqa
|
|||||||
styleguide,
|
styleguide,
|
||||||
user_profile,
|
user_profile,
|
||||||
choose_service,
|
choose_service,
|
||||||
api_integration,
|
api_keys,
|
||||||
manage_users,
|
manage_users,
|
||||||
invites,
|
invites,
|
||||||
feedback,
|
feedback,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from wtforms import ValidationError
|
from wtforms import ValidationError
|
||||||
from notifications_utils.template import Template
|
from notifications_utils.field import Field
|
||||||
from notifications_utils.gsm import get_non_gsm_compatible_characters
|
from notifications_utils.gsm import get_non_gsm_compatible_characters
|
||||||
|
|
||||||
from app import formatted_list
|
from app import formatted_list
|
||||||
@@ -45,11 +45,11 @@ class ValidGovEmail:
|
|||||||
|
|
||||||
class NoCommasInPlaceHolders:
|
class NoCommasInPlaceHolders:
|
||||||
|
|
||||||
def __init__(self, message='You can’t have commas in your fields'):
|
def __init__(self, message='You can’t put commas between double brackets'):
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
def __call__(self, form, field):
|
def __call__(self, form, field):
|
||||||
if ',' in ''.join(Template({'content': field.data}).placeholders):
|
if ',' in ''.join(Field(field.data).placeholders):
|
||||||
raise ValidationError(self.message)
|
raise ValidationError(self.message)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ def api_callbacks(service_id):
|
|||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/api/callbacks.html',
|
'views/api/callbacks.html',
|
||||||
received_text_messages_callback=received_text_messages_callback['url'] if received_text_messages_callback else None,
|
received_text_messages_callback=received_text_messages_callback['url']
|
||||||
|
if received_text_messages_callback else None,
|
||||||
delivery_status_callback=delivery_status_callback['url'] if delivery_status_callback else None
|
delivery_status_callback=delivery_status_callback['url'] if delivery_status_callback else None
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,12 +18,12 @@
|
|||||||
<form method="post">
|
<form method="post">
|
||||||
{{ textbox(
|
{{ textbox(
|
||||||
form.url,
|
form.url,
|
||||||
width='2-3',
|
width='1-1',
|
||||||
hint='Valid https URL'
|
hint='Must start with https://'
|
||||||
) }}
|
) }}
|
||||||
{{ textbox(
|
{{ textbox(
|
||||||
form.bearer_token,
|
form.bearer_token,
|
||||||
width='2-3',
|
width='1-1',
|
||||||
hint='At least 10 characters',
|
hint='At least 10 characters',
|
||||||
autocomplete='new-password'
|
autocomplete='new-password'
|
||||||
) }}
|
) }}
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
<form method="post">
|
<form method="post">
|
||||||
{{ textbox(
|
{{ textbox(
|
||||||
form.url,
|
form.url,
|
||||||
width='2-3',
|
width='1-1',
|
||||||
hint='Valid https URL'
|
hint='Must start with https://'
|
||||||
) }}
|
) }}
|
||||||
{{ textbox(
|
{{ textbox(
|
||||||
form.bearer_token,
|
form.bearer_token,
|
||||||
width='2-3',
|
width='1-1',
|
||||||
hint='At least 10 characters',
|
hint='At least 10 characters',
|
||||||
autocomplete='new-password'
|
autocomplete='new-password'
|
||||||
) }}
|
) }}
|
||||||
|
|||||||
@@ -15,31 +15,6 @@
|
|||||||
<p>You’ll need to provide a bearer token, for security. We’ll add this to the authorisation header of the callback request.</p>
|
<p>You’ll need to provide a bearer token, for security. We’ll add this to the authorisation header of the callback request.</p>
|
||||||
<p>The callback message is in JSON.</p>
|
<p>The callback message is in JSON.</p>
|
||||||
|
|
||||||
<h2 class="heading-medium">Text messages you receive</h2>
|
|
||||||
<p>If your service receives text messages in Notify, we can forward them to your callback URL as soon as they arrive.</p>
|
|
||||||
<div class="bottom-gutter-3-2">
|
|
||||||
{% call mapping_table(
|
|
||||||
caption='Callback message format',
|
|
||||||
field_headings=['Key', 'Description', 'Format'],
|
|
||||||
field_headings_visible=True,
|
|
||||||
caption_visible=False
|
|
||||||
) %}
|
|
||||||
{% for key, description, format in [
|
|
||||||
('id', 'Notify’s id for the received message', 'UUID'),
|
|
||||||
('source_number', 'The phone number the message was sent from', '447700912345'),
|
|
||||||
('destination_number', 'The number the message was sent to (your number)', '07700987654'),
|
|
||||||
('message', 'The received message', 'Hello Notify!'),
|
|
||||||
('date_received', 'The UTC datetime that the message was received by Notify', '2017-05-14T12:15:30.000000Z')
|
|
||||||
] %}
|
|
||||||
{% call row() %}
|
|
||||||
{% call row_heading() %} {{ key }} {% endcall %}
|
|
||||||
{{ text_field(description) }}
|
|
||||||
{{ text_field(format) }}
|
|
||||||
{% endcall %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endcall %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2 class="heading-medium">Email and text message delivery receipts</h2>
|
<h2 class="heading-medium">Email and text message delivery receipts</h2>
|
||||||
<p>When you send an email or text message through Notify, we can send a receipt to your callback URL to tell you if we were able to deliver it or not.</p>
|
<p>When you send an email or text message through Notify, we can send a receipt to your callback URL to tell you if we were able to deliver it or not.</p>
|
||||||
<div class="bottom-gutter-3-2">
|
<div class="bottom-gutter-3-2">
|
||||||
@@ -68,4 +43,28 @@
|
|||||||
{% endcall %}
|
{% endcall %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h2 class="heading-medium">Text messages you receive</h2>
|
||||||
|
<p>If your service receives text messages in Notify, we can forward them to your callback URL as soon as they arrive.</p>
|
||||||
|
<div class="bottom-gutter-3-2">
|
||||||
|
{% call mapping_table(
|
||||||
|
caption='Callback message format',
|
||||||
|
field_headings=['Key', 'Description', 'Format'],
|
||||||
|
field_headings_visible=True,
|
||||||
|
caption_visible=False
|
||||||
|
) %}
|
||||||
|
{% for key, description, format in [
|
||||||
|
('id', 'Notify’s id for the received message', 'UUID'),
|
||||||
|
('source_number', 'The phone number the message was sent from', '447700912345'),
|
||||||
|
('destination_number', 'The number the message was sent to (your number)', '07700987654'),
|
||||||
|
('message', 'The received message', 'Hello Notify!'),
|
||||||
|
('date_received', 'The UTC datetime that the message was received by Notify', '2017-05-14T12:15:30.000000Z')
|
||||||
|
] %}
|
||||||
|
{% call row() %}
|
||||||
|
{% call row_heading() %} {{ key }} {% endcall %}
|
||||||
|
{{ text_field(description) }}
|
||||||
|
{{ text_field(format) }}
|
||||||
|
{% endcall %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endcall %}
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ def test_for_commas_in_placeholders(
|
|||||||
):
|
):
|
||||||
with pytest.raises(ValidationError) as error:
|
with pytest.raises(ValidationError) as error:
|
||||||
NoCommasInPlaceHolders()(None, _gen_mock_field('Hello ((name,date))'))
|
NoCommasInPlaceHolders()(None, _gen_mock_field('Hello ((name,date))'))
|
||||||
assert str(error.value) == 'You can’t have commas in your fields'
|
assert str(error.value) == 'You can’t put commas between double brackets'
|
||||||
NoCommasInPlaceHolders()(None, _gen_mock_field('Hello ((name))'))
|
NoCommasInPlaceHolders()(None, _gen_mock_field('Hello ((name))'))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user