Feat/update rates table - #398
Merged
Merged
Conversation
…validation checklist
Contributor
There was a problem hiding this comment.
Pull request overview
Adds tooling and source data under scripts/sms_pricing/ to regenerate notifications_utils/international_billing_rates.yml from CSV/YAML inputs, updating tests/docs to match the new rates schema and multiplier behavior.
Changes:
- Introduces
international_billing_rates_updater.pyto buildinternational_billing_rates.ymlfrom an allow-list, AWS pricing export, prefix features CSV, and a DLR snapshot. - Updates the generated
international_billing_rates.ymlformat (keeps onlyattributes.dlr, allowsbillable_units> 3) and adjusts tests accordingly. - Adds supporting source files (
country_list.txt,aws_prices_sms.csv,country_prefixes.csv,dlr_snapshot.yml) plus documentation and unit tests for the updater.
Reviewed changes
Copilot reviewed 9 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_recipient_validation.py | Updates expected billable units to derive from the YAML rates table. |
| tests/test_international_billing_rates_updater.py | Adds unit tests for the updater helpers and shared-prefix strategy behavior. |
| tests/test_international_billing_rates.py | Updates validation expectations for the new YAML schema (unbounded billable units, dlr required). |
| scripts/sms_pricing/international_billing_rates_updater.py | New script implementing normalization, loading, billable unit calc, shared-prefix handling, and YAML writing. |
| scripts/sms_pricing/dlr_snapshot.yml | New snapshot source used to preserve existing dlr values. |
| scripts/sms_pricing/country_prefixes.csv | New prefix/ISO/country source file consumed by the updater. |
| scripts/sms_pricing/country_list.txt | New allow-list of supported destination countries. |
| scripts/sms_pricing/aws_prices_sms.csv | New AWS pricing export used to compute billable units. |
| scripts/sms_pricing/README.md | Documents the intended process/rules for regenerating the rates file. |
| notifications_utils/international_billing_rates.yml | Replaces legacy large table with regenerated subset + reduced schema. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jzbahrai
reviewed
Mar 5, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…and update README
…pdater to be USD since AWS rates are USD
jzbahrai
reviewed
Mar 5, 2026
jzbahrai
approved these changes
Mar 5, 2026
jzbahrai
reviewed
Mar 5, 2026
jzbahrai
left a comment
Collaborator
There was a problem hiding this comment.
Actually you want to tag it! so that you can use this in api/ admin
smcmurtry
approved these changes
Mar 5, 2026
smcmurtry
left a comment
Contributor
There was a problem hiding this comment.
I spot checked a few of the new multipliers and they look good. Nice work!
…for improved structure
…improve billing rate calculations
…nes we cant send to
…billable units using max strategy
…billing rates updater
…national billing rates
… for international billing rates
…ove compatibility
…larify updater instructions
…nternational_rates function
jzbahrai
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary | Résumé
This pull request introduces a new script for updating international SMS billing rates and documents the process and rules in a dedicated README. It centralizes all logic for generating the
international_billing_rates.ymlfile from multiple CSV and YAML sources, adds robust normalization and validation for country and prefix data, and provides clear instructions for running and validating updates. The AWS SMS pricing CSV is also added as a source file.Country list
The list of countries is based on the AWS pricing CSV - all countries in that list will be included, but we will only show those that we can send to on our guidance page.
Allowed countries
In addition to Canada the US (we send to the US via a toll free number we have registered, the list of allowed countries was determined by going through the AWS Supported countries and regions for SMS messaging table and cross-referencing countries that allow sending to with a Sender ID against the list of Sender IDs we have registered.
This produced an allowed list of 86 countries.
Multiplier calculation
The rate multiplier is calculated by taking the cost for sending to a country per AWS, and dividing that by our long code rate, and rounding up to the nearest integer.
Related Issues | Cartes liées
Test instructions | Instructions pour tester la modification
Release Instructions | Instructions pour le déploiement
None.
Reviewer checklist | Liste de vérification du réviseur