mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Update app to utilize updated phone validation methods
This commit is contained in:
@@ -12,9 +12,9 @@ from app.celery.process_ses_receipts_tasks import process_ses_results
|
||||
from app.config import QueueNames
|
||||
from app.models import SMS_TYPE
|
||||
|
||||
temp_fail = "5558675303"
|
||||
perm_fail = "5558675302"
|
||||
delivered = "5558675309"
|
||||
temp_fail = "2028675303"
|
||||
perm_fail = "2028675302"
|
||||
delivered = "2028675309"
|
||||
|
||||
delivered_email = "delivered@simulator.notify"
|
||||
perm_fail_email = "perm-fail@simulator.notify"
|
||||
|
||||
@@ -316,7 +316,7 @@ class Config(object):
|
||||
'simulate-delivered-2@notifications.service.gov.uk',
|
||||
'simulate-delivered-3@notifications.service.gov.uk',
|
||||
)
|
||||
SIMULATED_SMS_NUMBERS = ('+447700900000', '+447700900111', '+447700900222')
|
||||
SIMULATED_SMS_NUMBERS = ('+12028675000', '+12028675111', '+12028675222')
|
||||
|
||||
FREE_SMS_TIER_FRAGMENT_COUNT = 250000
|
||||
|
||||
|
||||
@@ -151,10 +151,7 @@ def check_if_service_can_send_to_number(service, number):
|
||||
else:
|
||||
permissions = service.permissions
|
||||
|
||||
if (
|
||||
# if number is international and not a crown dependency
|
||||
international_phone_info.international and not international_phone_info.crown_dependency
|
||||
) and INTERNATIONAL_SMS_TYPE not in permissions:
|
||||
if international_phone_info.international and INTERNATIONAL_SMS_TYPE not in permissions:
|
||||
raise BadRequestError(message="Cannot send to international mobile numbers")
|
||||
else:
|
||||
return international_phone_info
|
||||
|
||||
@@ -5,7 +5,7 @@ from urllib.parse import urlencode
|
||||
|
||||
from flask import Blueprint, abort, current_app, jsonify, request
|
||||
from notifications_utils.recipients import (
|
||||
is_uk_phone_number,
|
||||
is_us_phone_number,
|
||||
use_numeric_sender,
|
||||
)
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
@@ -140,7 +140,7 @@ def update_user_attribute(user_id):
|
||||
|
||||
|
||||
def get_sms_reply_to_for_notify_service(recipient, template):
|
||||
if not is_uk_phone_number(recipient) and use_numeric_sender(recipient):
|
||||
if not is_us_phone_number(recipient) and use_numeric_sender(recipient):
|
||||
reply_to = current_app.config['NOTIFY_INTERNATIONAL_SMS_SENDER']
|
||||
else:
|
||||
reply_to = template.service.get_default_sms_sender()
|
||||
|
||||
Reference in New Issue
Block a user