Merge pull request #852 from alphagov/receive-sms-messages

Initial creation of the endpoint to receive sms messages
This commit is contained in:
Rebecca Law
2017-03-08 15:10:51 +00:00
committed by GitHub
3 changed files with 28 additions and 0 deletions

View File

@@ -123,6 +123,7 @@ def init_app(app):
url_for('notifications.process_ses_response'),
url_for('notifications.process_firetext_response'),
url_for('notifications.process_mmg_response'),
url_for('notifications.receive_mmg_sms'),
url_for('status.show_delivery_status'),
url_for('spec.get_spec')
]

View File

@@ -49,6 +49,15 @@ from app.errors import (
register_errors(notifications)
@notifications.route('/notifications/sms/receive/mmg', methods=['POST'])
def receive_mmg_sms():
post_data = request.get_json()
post_data.pop('MSISDN', None)
current_app.logger.info("Recieve notification form data: {}".format(post_data))
return "RECEIVED"
@notifications.route('/notifications/email/ses', methods=['POST'])
def process_ses_response():
client_name = 'SES'

View File

@@ -0,0 +1,18 @@
from flask import json
def test_receive_notification_returns_received_to_mmg(client):
data = {"ID": "1234",
"MSISDN": "447700900855",
"Message": "Some message to notify",
"Trigger": "Trigger?",
"Number": "40604",
"Channel": "SMS",
"DateReceived": "2012-06-27-12:33:00"
}
response = client.post(path='/notifications/sms/receive/mmg',
data=json.dumps(data),
headers=[('Content-Type', 'application/json')])
assert response.status_code == 200
assert response.get_data(as_text=True) == 'RECEIVED'