"""Vendor Agreement Logic. The logic is related to vendor agreements. If a vendor has accepted a specific agreement type a row should be returned from the VendorAgreement model. """ from users.models import vendor_agreement def create_vendor_agreement(data): """Create an entity to the vendor_agreement table. Args: data (dict): The vendor agreement data. This dictionary should contain the vendor_id and and the opt_in_preference_id Returns: response.Response: containing the created vendor_agreement. """ return vendor_agreement.create_vendor_agreement(data) def get_vendor_agreement(vendor_id, permission_type_id, exclude_impersonator=False): """Get a vendor agreement based on vendor_id and permission_type_id. Args: vendor_id (int): The vendor unique identifier permission_type_id: the opt_in_preference_id exclude_impersonator (bool): If True results with an impersonator user ID will be excluded. Optional, defaults to False. Returns: response.Response: containing the vendor permission agreement. """ return vendor_agreement.get_vendor_agreement( vendor_id, permission_type_id, exclude_impersonator ) def delete_vendor_agreement(vendor_agreement_id): """Delete a vendor agreement based on id. Args: vendor_agreement_id (int): The id of the vendor agreement to delete Returns: response.Response: Containing the result of the deletion """ return vendor_agreement.delete_vendor_agreement(vendor_agreement_id)