api.v2.utils module

api.v2.utils.add_britedocs_reference(x_report_location_id, britedocs_id)[source]

Associates a Report for a given Location with a deliverable template in BriteDocs

Parameters:
  • x_report_location_id (str) – The UUID of the Report for a given Location (the id of a row in x_report_locations table).
  • britedocs_id (str) – The UUID of the Deliverable template in BriteDocs.
Returns:

  • success (bool) – True if successful, false if not.
  • messages (list) – A list of human-readable error messages.
  • data (dict) – An empty dict emulating a 204 response from the server.

api.v2.utils.generate_receipt(payment_id=None)[source]

Generates a Receipt file related to the given Payment record.

Parameters:payment_id (str) – The database UUID for the specified Payment record
Returns:success – True if the receipt was successfully generated
Return type:bool

API method to retrieve links to display in navigation headers based on contact and chosen role info available in user’s session.

Returns:
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
  • data (dict containing the links) – :: {
    “data”: {
    “briteapps”: str, “contacts”: str, “settings”: str, “lines”: str, “reports”: str, “oops”: str, “quotes”: str, “dashboard”: str, “policies”: str, “claims”: str, “support_tools”: str, “payments”: str

    }, “messages”: [], “success”: bool

    }

api.v2.utils.get_release_info()[source]

API method to retrieve the BriteCore release info based on britecore.cfg

Returns:
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
  • data (dict) – The data response having the form:
    {
        'tag': str,
        'timestamp': str | null
    }
    
api.v2.utils.process_enroll_on_auto_pay_for_invoice_cloud(policy_term, last_term, enable)[source]

Handles enrolling the policy on autopay for invoice cloud and returns the appropriate success or fail response.

api.v2.utils.rebuild_search_index(only_build=None, chunk_size=None)[source]

Rebuilds Elastic Search indexes for select or all index maps :param only_build: Which of the index maps to rebuild, options are [‘contacts’, ‘policies’, ‘properties’, ‘claims’, ‘protection_classes’] :type only_build: list of str :param chunk_size: How many records should be queried at a time? Default is 2500, use 0 for no chunking (memory hungry, but faster) :type chunk_size: int

Returns:
  • success (bool) – True if successful, false if not
  • messages (list of str) – List of human-readable error messages
api.v2.utils.refund(policy_number=None, refund_amount=None, refund_reason=None, transfer_policy_number=None, policy_term_id=None)[source]

Creates a refund on the given policy regardless of the policy balance. :param policy_number: Any valid policy_number. :type policy_number: string :param refund_amount: The amount of the refund. :type refund_amount: float :param refund_reason: The reason for creating a refund. :type refund_reason: string :param transfer_policy_number: Optionally transfer the refund amount to another policy with this number. :type transfer_policy_number: string, # optional :param policy_term_id: The term to apply the refund to.

Returns:
  • success (bool) – True if the refund was successfully created.
  • messages (list) – List of human-readable messages including information regarding encountered errors.
api.v2.utils.retrieve_background_job(job_id=None)[source]

Retrieves the background job info. :param job_id: The database UUID associated with the background job :type job_id: uuid

Returns:
  • success (bool) – True if the query was succesful.
  • messages (list) – List of human-readable messages including information regarding encountered errors.
  • data (dict) – The data response having the form:
    {
        'job_id'  uuid: ID of the async task
        'group_id' uuid:
        'task'  str: task name
        'contact_id' uuid:
        'file_id'  uuid:
        'arguments' list: arguments passed for task
        'queue_time'  timestamp:
        'start_time' timestamp: Time when task started
        'end_time'  timestamp: Time when task finished
        'complete' bool: Indicate whether task completed
        'failed'  bool: Indicate whether task failed
        'acknowledged' bool: Indicate whether task got acknowledged
        'retries'  int: Number of retries of task
        'exception' str: Error during job execution. #  For Debugging purposes only. Front end should not consume.
        'results'  obj: task result
    }
    
api.v2.utils.retrieve_payments_on_policy(policy_number=None, only_missing_receipts=False)[source]

Gets all Payment records made against a particular policy.

Parameters:
  • policy_number (str) – The identifying Policy Number for a particular policy
  • only_missing_receipts (bool) – If True, only return payments that have missing receipts
Returns:

  • success (bool) – True if payments were successfully able to be returned
  • data (list) – List of Payment records

api.v2.utils.retrieve_receipts(number=None)[source]

This utility will return a number of the most recently added DCR / Sweep Payment receipts. :param number: The number of receipts needing to be retrieved.

Returns:
  • success (bool) – True if records were successfully gathered
  • data (list) – List containing objects with the following format:
    {“id”: “FILE UUID”, “title”: “Name of File”}
api.v2.utils.revert_agentcy_transfer(archive_id=None)[source]

Reverts the transfer of all policies between two Agents or Agencies. :param archive_id: The database UUID associated with the Archive that tracks the specific execution of the

Agent/Agency Switch Tool that is wished to be reverted.
Returns:
  • success (bool) – True if the process was evaluated for all policies.
  • messages (list) – List of human-readable messages including information regarding encountered errors.
api.v2.utils.revert_mortgagee_transfer(archive_id=None)[source]

Reverts the transfer of all policies between two Mortgagee. :param archive_id: The database UUID associated with the Archive that tracks the specific execution of the

Mortgagee Switch Tool that is wished to be reverted.
Returns:
  • success (bool) – True if the process was evaluated for all policies.
  • messages (list) – List of human-readable messages including information regarding encountered errors.
api.v2.utils.transfer_agentcy_policies(from_contact_id=None, to_contact_id=None, effective_date=None, print_decs=False)[source]

Transfers all policies connected an Agent/Agency to another Agent/Agency. :param from_contact_id: Database UUID associated with the current Agent/Agency contact being taken off of the policies. :type from_contact_id: string :param to_contact_id: Database UUID associated with the new Agent/Agency contact that the policies should be transferred to. :type to_contact_id: string :param effective_date: String in some common date format. Should be the date agent/agency transfer should become effective. :type effective_date: string :param print_decs: True/False, whether or not the Declarations should be regenerated for the policies being transferred.

Returns:
  • success (bool) – True if the process was evaluated for all policies.
  • success_messages (list) – List of human-readable messages including information regarding policies that were successfully transferred.
  • failure_messages (list) – List of human-readable messages including details for policies that may not have been able to be transferred.
  • data (dict) – Mapping of information regarding an asynchronous task, handling the act of transferring policies. This identifier can be used as a reference to poll the status of that action
api.v2.utils.transfer_mortgagee_policies(from_contact_id=None, to_contact_id=None, effective_date=None, print_decs=False)[source]

Transfers all policies associated with a mortgagee, to another :param from_contact_id: Database UUID associated with the current Mortgagee contact being taken off of the policies. :type from_contact_id: string :param to_contact_id: Database UUID associated with the new Mortgagee contact that the policies should be transferred to. :type to_contact_id: string :param effective_date: String in some common date format. Should be the date agent/agency transfer should become effective.

Returns:
  • success (bool) – True if the process was evaluated for all policies.
  • success_messages (list) – List of human-readable messages including information regarding policies that were successfully transferred.
  • failure_messages (list) – List of human-readable messages including details for policies that may not have been able to be transferred.
  • data (dict) – Mapping of information regarding an asynchronous task, handling the act of transferring policies. This identifier can be used as a reference to poll the status of that action
api.v2.utils.unarchive_record(db_table=None, unique_value=None)[source]

Unarchives a record from the contacts, claims, or policies modules. Updates one entry at a time.

Parameters:
  • db_table (string) – One of the following values: contacts | claims | policies
  • unique_value (string) –

    The defining column value for the chosen db table. Example:

    contacts –> id claims –> claim number policies –> policy number
Returns:

  • success (bool) – True if the record was found and updated, False otherwise
  • messages (list of str) – List of human-readable messages, descriptive of what occurred.

api.v2.utils.update_payment_information_for_term(term, enable, payment_method_id=None)[source]

Handles updating the “payment method” and “withdraw funds when” information for the policy term.

api.v2.utils.update_revision(revision_id=None, action=None)[source]

Performs the given action on the given Revision, assuming the action is supported. :param revision_id: The database UUID associated with the Revision that needs modification :type revision_id: string :param action: The action to perform on the Revision (‘delete’ or ‘archive’)

Returns:
  • success (bool) – True if the action was performed on the Revision successfully
  • messages (list) – List of human-readable messages, descriptive of what occurred
api.v2.utils.update_search_index(index_name=None, identifiers=None)[source]

Updates the Search Index. :param index_name: policies | claims | contacts | properties | protection_classes :type index_name: string :param identifiers: A list of data where each value is unique to its table.

Could be policy numbers, claim numbers, or UUIDs from policies, claims, contacts, properties, or protection_classes tables.
Returns:
  • success (bool) – True if successful, False if not
  • messages (list of str) – List of human-readable error messages
  • data (None)
api.v2.utils.validate_and_clean_claim_numbers_list(claim_numbers_list)[source]

Given a list of dicts, format: [{‘claim_number’: SOME_NUMBER}] check if claim exists. Will raise NoResultFound Exception if list is empty or a given claim number does not exists

Parameters:claim_numbers_list
Returns:a list of claim numbers