Skip to content

Commit 73c97c2

Browse files
andrewleithCopilot
andauthored
Feat/update rates table (#398)
* feat: add SMS pricing data files including country rates, prefixes, and DLR snapshots * feat: implement international billing rates updater with supporting tests * feat: add README for SMS pricing updater with usage instructions and validation checklist * task: regenerate billing rates table * feat: update recipient validation tests to utilize international billing rates * fix: update paths in README and test files to reflect new directory structure * chore: fix mypy issues * fix: update paths in README for international billing rates and updater script * Update scripts/sms_pricing/country_list.txt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix readme paths * chore: rename pricing file * feat: add argument parsing for price file in international billing rates updater * feat: add PRICE_FILE requirement for update-rates target in Makefile and update README * fix: update AWS SMS price file reference in README and tests * fix: correct DEFAULT_BASE_RATE value in international billing rates updater to be USD since AWS rates are USD * feat: update billable units for various countries in international billing rates * refactor: remove shared prefix strategy parameter from billing rate functions * feat: add refresh-dlr-snapshot target to Makefile and update README instructions * chore: rename country list file for clarity * chore: fix references to allowed country list * feat: replace allowed_country_list.txt with allowed_country_list.csv for improved structure * chore: add Guadeloupe to country prefixes list * feat: update allowed country list handling to support CSV format and improve billing rate calculations * chore: re-generate full list of countries and multipliers including ones we cant send to * feat: enhance international rates merging logic to handle multiple country prefixes * chore: re-generate rates table * feat: enhance international rates calculation to resolve conflicting billable units using max strategy * feat: update country prefixes handling and refactor related logic in billing rates updater * chore: regen billing rates * feat: update attribute name from 'we_can_send' to 'can_send' in international billing rates * feat: update attribute name from 'we_can_send' to 'can_send' in tests for international billing rates * chore: regen billing rate table * feat: enhance price loading function to return country names and improve compatibility * chore: regen billing rates using AWS country names * docs: update README to correct allowed country list file format and clarify updater instructions * feat: add test to verify allowed countries are reflected in YAML output * fix: improve compatibility message for optional parameters in build_international_rates function * chore: update version to 53.2.16 in requirements and pyproject files --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c37ffbe commit 73c97c2

15 files changed

Lines changed: 1991 additions & 1847 deletions

.github/actions/waffles/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ docopt==0.6.2
22
Flask==2.3.3
33
markupsafe==2.1.5
44
setuptools==78.1.1 # required for distutils in Python 3.12
5-
git+https://github.com/cds-snc/notifier-utils.git@53.2.15#egg=notifications-utils
5+
git+https://github.com/cds-snc/notifier-utils.git@53.2.16#egg=notifications-utils

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,13 @@ format:
6868
poetry sort
6969

7070
clean:
71-
rm -rf cache venv
71+
rm -rf cache venv
72+
73+
.PHONY: update-rates
74+
update-rates: ## Regenerate `notifications_utils/international_billing_rates.yml`. `PRICE_FILE` must be provided.
75+
@/bin/bash -c 'if [ -z """$(PRICE_FILE)""" ]; then echo "ERROR: PRICE_FILE is required. Example: make update-rates PRICE_FILE=scripts/sms_pricing/aws_prices_sms_mar_2026.csv"; exit 1; fi'
76+
python3 scripts/sms_pricing/international_billing_rates_updater.py --price-file $(PRICE_FILE)
77+
78+
.PHONY: refresh-dlr-snapshot
79+
refresh-dlr-snapshot: ## Rebuild `scripts/sms_pricing/dlr_snapshot.yml` from current output YAML
80+
python3 -c 'from scripts.sms_pricing.international_billing_rates_updater import DEFAULT_DLR_SNAPSHOT_PATH, DEFAULT_OUTPUT_PATH, build_dlr_snapshot, write_yaml_file; write_yaml_file(build_dlr_snapshot(DEFAULT_OUTPUT_PATH), DEFAULT_DLR_SNAPSHOT_PATH)'

0 commit comments

Comments
 (0)