mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-23 11:51:05 -05: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,
|
||||
user_profile,
|
||||
choose_service,
|
||||
api_integration,
|
||||
api_keys,
|
||||
manage_users,
|
||||
invites,
|
||||
feedback,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 app import formatted_list
|
||||
@@ -45,11 +45,11 @@ class ValidGovEmail:
|
||||
|
||||
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
|
||||
|
||||
def __call__(self, form, field):
|
||||
if ',' in ''.join(Template({'content': field.data}).placeholders):
|
||||
if ',' in ''.join(Field(field.data).placeholders):
|
||||
raise ValidationError(self.message)
|
||||
|
||||
|
||||
|
||||
@@ -161,7 +161,8 @@ def api_callbacks(service_id):
|
||||
|
||||
return render_template(
|
||||
'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
|
||||
)
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
<form method="post">
|
||||
{{ textbox(
|
||||
form.url,
|
||||
width='2-3',
|
||||
hint='Valid https URL'
|
||||
width='1-1',
|
||||
hint='Must start with https://'
|
||||
) }}
|
||||
{{ textbox(
|
||||
form.bearer_token,
|
||||
width='2-3',
|
||||
width='1-1',
|
||||
hint='At least 10 characters',
|
||||
autocomplete='new-password'
|
||||
) }}
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
<form method="post">
|
||||
{{ textbox(
|
||||
form.url,
|
||||
width='2-3',
|
||||
hint='Valid https URL'
|
||||
width='1-1',
|
||||
hint='Must start with https://'
|
||||
) }}
|
||||
{{ textbox(
|
||||
form.bearer_token,
|
||||
width='2-3',
|
||||
width='1-1',
|
||||
hint='At least 10 characters',
|
||||
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>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>
|
||||
<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">
|
||||
@@ -68,4 +43,28 @@
|
||||
{% endcall %}
|
||||
</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 %}
|
||||
|
||||
@@ -149,7 +149,7 @@ def test_for_commas_in_placeholders(
|
||||
):
|
||||
with pytest.raises(ValidationError) as error:
|
||||
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))'))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user