-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add phone number to GCE and trigger Textit campaign (#2467)
Adds phone number field to existing GCE responses model Adds method to add the user's number to Texit campaign to confirm their number Changes some internal textit (aka rapidpro) methods to allow for missing name, since we aren't collecting for GCE Adds a few simple tests for: the optional name on rapidpro methods the triggering of campaign from GCE model validating phone_number values Currently the textit campaign trigger happens whenever a phone number is sent from the client. Textit will prevent duplicate copies of a contact being added to the group (since there is a single list of all contacts and they can be members of a group), but repeated submissions of a number will trigger repeated confirmation messages. But I didn't think that was a problem. I've set up the campaign to send a single message right after the number is submitted. TBD on exact content for that, but it's all managed in textit.
- Loading branch information
Showing
14 changed files
with
125 additions
and
9 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
gce/migrations/0002_goodcauseevictionscreenerresponse_phone_number.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 3.2.13 on 2025-01-03 21:25 | ||
|
||
from django.db import migrations, models | ||
import project.util.phone_number | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('gce', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='goodcauseevictionscreenerresponse', | ||
name='phone_number', | ||
field=models.CharField(blank=True, help_text='A U.S. phone number without parentheses or hyphens, e.g. "5551234567".', max_length=10, validators=[project.util.phone_number.validate_phone_number]), | ||
), | ||
] |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pytest | ||
from unittest.mock import MagicMock | ||
from gce.models import GoodCauseEvictionScreenerResponse | ||
|
||
|
||
class TestTriggerFollowupCampaign: | ||
@pytest.fixture(autouse=True) | ||
def setup_fixture(self, monkeypatch): | ||
from rapidpro import followup_campaigns | ||
|
||
self.trigger = MagicMock() | ||
monkeypatch.setattr(followup_campaigns, "trigger_followup_campaign_async", self.trigger) | ||
|
||
def test_it_triggers_followup_campaign_if_user_has_phone_number(self, db): | ||
gcer = GoodCauseEvictionScreenerResponse(bbl="1234567890", phone_number="2125551234") | ||
gcer.trigger_followup_campaign_async() | ||
self.trigger.assert_called_once_with(None, "2125551234", "GCE", locale="en") |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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