Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addresses Issue #1142 #1144

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
20 changes: 4 additions & 16 deletions parsons/ngpvan/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ def apply_response(
result_code_id=None,
omit_contact=False,
phone=None,
campaignId=None,
):
"""
Apply responses such as survey questions, activist codes, and volunteer actions
Expand Down Expand Up @@ -621,6 +622,8 @@ def apply_response(
attempts.
phone: str
`Optional`; Phone number of any type (Work, Cell, Home)
campaignId: int
`Optional`; a valid Campaign ID.
`Returns:`
``True`` if successful

Expand Down Expand Up @@ -648,26 +651,11 @@ def apply_response(
"inputTypeId": input_type_id,
"dateCanvassed": date_canvassed,
"omitActivistCodeContactHistory": omit_contact,
"campaignId": campaignId,
},
"resultCodeId": result_code_id,
}

if (
contact_type_id == 1 # Phone
or contact_type_id == 19 # Auto Dial
or contact_type_id == 37 # SMS Text
or contact_type_id == 67 # Phone Bank
or contact_type_id == 68 # Consumer Phone
or contact_type_id == 72 # Leader Phone
or contact_type_id == 112 # Personal Phone
or contact_type_id == 132 # Relational Text
or contact_type_id == 143 # Distributed Text
or contact_type_id == 147 # Bulk Text
or contact_type_id == 149 # Paid SMS
):
if not phone:
raise Exception("A phone number must be provided if canvassed via phone or SMS")

if phone:
json["canvassContext"]["phone"] = {
"dialingPrefix": "1",
Expand Down