When placing notification orders where SMS is involved, mobile numbers that include invalid characters (like letters) now produces response code 400 instead of 500. Additionally, the general response for such invalid numbers is changed:
Before: "Invalid mobile number format".
Now: "Mobile number can contain only '+' and numeric characters, and it must adhere to the E.164 standard."
Affected endpoints:
POST /notifications/api/v1/orders/sms
POST /notifications/api/v1/orders
The MobileNumberHelper class, used by Validators to perform number validation, now has a try/catch for when PhoneNumberUtil throws NumberParseException. These exceptions now result in the method IsValidMobileNumber returning false.
Related Issue(s)
619
Verification
[x] Your code builds clean without any errors or warnings
[x] Manual testing done (required)
[x] Relevant automated test added (if you find this hard, leave it and we'll help out)
[x] All tests run green
Documentation
[ ] User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)
Description
When placing notification orders where SMS is involved, mobile numbers that include invalid characters (like letters) now produces response code 400 instead of 500. Additionally, the general response for such invalid numbers is changed:
Affected endpoints:
The
MobileNumberHelper
class, used by Validators to perform number validation, now has a try/catch for when PhoneNumberUtil throws NumberParseException. These exceptions now result in the methodIsValidMobileNumber
returningfalse
.Related Issue(s)
619
Verification
Documentation