mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Validate International phone numbers
- uses new utils methods to validate phone numbers - defaults to International=True on validation. This ensures the validator works on all numbers - Then check if the user can send this message to the number internationally if needed.
This commit is contained in:
@@ -27,6 +27,7 @@ def post_notification(notification_type):
|
||||
form = validate(request.get_json(), post_email_request)
|
||||
else:
|
||||
form = validate(request.get_json(), post_sms_request)
|
||||
|
||||
service = services_dao.dao_fetch_service_by_id(api_user.service_id)
|
||||
check_service_message_limit(api_user.key_type, service)
|
||||
form_send_to = form['phone_number'] if notification_type == SMS_TYPE else form['email_address']
|
||||
@@ -41,7 +42,7 @@ def post_notification(notification_type):
|
||||
simulated = simulated_recipient(send_to, notification_type)
|
||||
notification = persist_notification(template_id=template.id,
|
||||
template_version=template.version,
|
||||
recipient=send_to,
|
||||
recipient=form_send_to,
|
||||
service=service,
|
||||
personalisation=form.get('personalisation', None),
|
||||
notification_type=notification_type,
|
||||
|
||||
Reference in New Issue
Block a user