mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-02 17:48:36 -04:00
Merge pull request #242 from alphagov/mmg-client-fix
Update to processing the the response from MMG
This commit is contained in:
@@ -12,6 +12,12 @@ mmg_response_map = {
|
||||
"success": True,
|
||||
"notification_status": 'delivered'
|
||||
},
|
||||
'0': {
|
||||
"message": 'Delivered',
|
||||
"notification_statistics_status": STATISTICS_DELIVERED,
|
||||
"success": True,
|
||||
"notification_status": 'delivered'
|
||||
},
|
||||
'default': {
|
||||
"message": 'Declined',
|
||||
"success": False,
|
||||
|
||||
@@ -12,7 +12,7 @@ sms_response_mapper = {'MMG': get_mmg_responses,
|
||||
def validate_callback_data(data, fields, client_name):
|
||||
errors = []
|
||||
for f in fields:
|
||||
if len(data.get(f, '')) <= 0:
|
||||
if not str(data.get(f, '')):
|
||||
error = "{} callback failed: {} missing".format(client_name, f)
|
||||
errors.append(error)
|
||||
return errors if len(errors) > 0 else None
|
||||
|
||||
@@ -147,7 +147,7 @@ def process_mmg_response():
|
||||
[current_app.logger.info(e) for e in validation_errors]
|
||||
return jsonify(result='error', message=validation_errors), 400
|
||||
|
||||
success, errors = process_sms_client_response(status=data.get('status'),
|
||||
success, errors = process_sms_client_response(status=str(data.get('status')),
|
||||
reference=data.get('CID'),
|
||||
client_name='MMG')
|
||||
if errors:
|
||||
|
||||
Reference in New Issue
Block a user