Describe the bug
While using the SMS reminder task for budget, we noticed a few bug / inconsistencies with the way the SMS are sent for one shot (verification code) SMS and bulk SMS (reminder).
1. Password :
- the SMS API password is stored in URL encode format (eg.
%3A is used for :) because the SMS Gateway service use it directly in a string interpolated URL (view code)
- but the task used for bulk SMS reminder needs a "non URL encoded" password because the URL encoding is done automatically when creating a POST request with parameters (view code)
recommended fix :
the password should not be stored as URL encoded and the encoding should be done in the SMS Gateway when the password is used (CGI::escape("MyPassword2025"))
2. Phone number formatting
The phone country is stored in database with the 2 letter country code (FR, US, DE...) but the bulk SMS task doesn't convert it in number format (FR becomes 33) (view code).
recommended fix :
when formatting the phone number, we should use the same formatting process used by the half sign up module (view code)
PhoneNumberFormatter.new(phone_number: phone_number, iso_country_code: country_code).format