Exemple #1
0
def register_sms_contact(domain, case_type, case_name, user_id,
        contact_phone_number, contact_phone_number_is_verified="1",
        contact_backend_id=None, language_code=None, time_zone=None,
        owner_id=None, contact_ivr_backend_id=None):
    """
    Creates a messaging case contact by submitting system-generated casexml
    """
    utcnow = str(datetime.datetime.utcnow())
    case_id = str(uuid.uuid3(uuid.NAMESPACE_URL, utcnow))
    if owner_id is None:
        owner_id = user_id
    context = {
        "case_id": case_id,
        "date_modified": json_format_datetime(datetime.datetime.utcnow()),
        "case_type": case_type,
        "case_name": case_name,
        "owner_id": owner_id,
        "user_id": user_id,
        "contact_phone_number": contact_phone_number,
        "contact_phone_number_is_verified": contact_phone_number_is_verified,
        "contact_backend_id": contact_backend_id,
        "language_code": language_code,
        "time_zone": time_zone,
        "contact_ivr_backend_id": contact_ivr_backend_id,
    }
    submit_case_block_from_template(domain, "sms/xml/register_contact.xml", context, user_id=user_id)
    return case_id
Exemple #2
0
def close_task(domain, subcase_guid, submitting_user_id):
    context = {
        "subcase_guid": subcase_guid,
        "user_id": submitting_user_id,
        "date_modified": json_format_datetime(datetime.datetime.utcnow()),
    }
    submit_case_block_from_template(domain, "sms/xml/close_task.xml", context)
Exemple #3
0
def register_sms_contact(domain, case_type, case_name, user_id,
        contact_phone_number, contact_phone_number_is_verified="1",
        contact_backend_id=None, language_code=None, time_zone=None,
        owner_id=None, contact_ivr_backend_id=None):
    """
    Creates a messaging case contact by submitting system-generated casexml
    """
    utcnow = str(datetime.datetime.utcnow())
    case_id = str(uuid.uuid3(uuid.NAMESPACE_URL, utcnow))
    if owner_id is None:
        owner_id = user_id
    context = {
        "case_id": case_id,
        "date_modified": json_format_datetime(datetime.datetime.utcnow()),
        "case_type": case_type,
        "case_name": case_name,
        "owner_id": owner_id,
        "user_id": user_id,
        "contact_phone_number": contact_phone_number,
        "contact_phone_number_is_verified": contact_phone_number_is_verified,
        "contact_backend_id": contact_backend_id,
        "language_code": language_code,
        "time_zone": time_zone,
        "contact_ivr_backend_id": contact_ivr_backend_id,
    }
    submit_case_block_from_template(domain, "sms/xml/register_contact.xml", context, user_id=user_id)
    return case_id
Exemple #4
0
def update_contact(domain, case_id, user_id, contact_phone_number=None, contact_phone_number_is_verified=None, contact_backend_id=None, language_code=None, time_zone=None):
    context = {
        "case_id" : case_id,
        "date_modified" : json_format_datetime(datetime.datetime.utcnow()),
        "user_id" : user_id,
        "contact_phone_number" : contact_phone_number,
        "contact_phone_number_is_verified" : contact_phone_number_is_verified,
        "contact_backend_id" : contact_backend_id,
        "language_code" : language_code,
        "time_zone" : time_zone
    }
    submit_case_block_from_template(domain, "sms/xml/update_contact.xml", context, user_id=user_id)
Exemple #5
0
def update_contact(domain, case_id, user_id, contact_phone_number=None, contact_phone_number_is_verified=None, contact_backend_id=None, language_code=None, time_zone=None):
    context = {
        "case_id" : case_id,
        "date_modified" : json_format_datetime(datetime.datetime.utcnow()),
        "user_id" : user_id,
        "contact_phone_number" : contact_phone_number,
        "contact_phone_number_is_verified" : contact_phone_number_is_verified,
        "contact_backend_id" : contact_backend_id,
        "language_code" : language_code,
        "time_zone" : time_zone
    }
    submit_case_block_from_template(domain, "sms/xml/update_contact.xml", context, user_id=user_id)
Exemple #6
0
def update_task(
    domain,
    subcase_guid,
    submitting_user_id,
    task_owner_id,
    form_unique_id,
    task_activation_datetime,
    task_deactivation_datetime,
    incentive,
):
    context = {
        "subcase_guid": subcase_guid,
        "user_id": submitting_user_id,
        "date_modified": json_format_datetime(datetime.datetime.utcnow()),
        "task_owner_id": task_owner_id,
        "form_unique_id": form_unique_id,
        "task_activation_date": json_format_datetime(task_activation_datetime),
        "task_deactivation_date": json_format_datetime(task_deactivation_datetime),
        "incentive": incentive,
    }
    submit_case_block_from_template(domain, "sms/xml/update_task.xml", context)
Exemple #7
0
def create_task(
    parent_case,
    submitting_user_id,
    task_owner_id,
    form_unique_id,
    task_activation_datetime,
    task_deactivation_datetime,
    incentive,
):
    utcnow = str(datetime.datetime.utcnow())
    subcase_guid = str(uuid.uuid3(uuid.NAMESPACE_URL, utcnow))
    context = {
        "subcase_guid": subcase_guid,
        "user_id": submitting_user_id,
        "date_modified": json_format_datetime(datetime.datetime.utcnow()),
        "task_owner_id": task_owner_id,
        "form_unique_id": form_unique_id,
        "task_activation_date": json_format_datetime(task_activation_datetime),
        "task_deactivation_date": json_format_datetime(task_deactivation_datetime),
        "parent": parent_case,
        "incentive": incentive,
    }
    submit_case_block_from_template(parent_case.domain, "sms/xml/create_task.xml", context)
    return subcase_guid