"""Default Account Pricing Tier logic.""" from pricing.models import default_account_pricing_tier def set_default_account_pricing_tier( account_type, account_id, pricing_family_id, data): """Set the orchard pricing tier on the account by pricing family. Args: account_type (string): indicates if vendor or subaccount. account_id (int): indicates if vendor_id or subaccount_id. pricing_family_id (int): the ID of the pricing family. data (dict): the data from which to insert/update default pricing tier. Returns: response.Response: containing the created/updated default account pricing tier dict. """ instance = default_account_pricing_tier.\ get_by_account_and_pricing_family_id( account_type, account_id, pricing_family_id) if instance.message: default_account_pricing_tier.\ soft_delete_default_account_pricing_tier( account_type, account_id, pricing_family_id, data) return default_account_pricing_tier.\ insert_account_with_default_pricing_tier( account_type, account_id, pricing_family_id, data) def get_default_account_pricing_tier( account_type, account_id, pricing_family_id): """Get the default pricing tier on the account by pricing family. Args: account_type (string): indicates if vendor or subaccount. account_id (int): indicates if vendor_id or subaccount_id. pricing_family_id (int): the ID of the pricing family. Returns: response.Response: containing the default account pricing tier dict. """ return default_account_pricing_tier.\ get_by_account_and_pricing_family_id( account_type, account_id, pricing_family_id) def soft_delete_default_account_pricing_tier( account_type, account_id, pricing_family_id, data): """Soft delete default pricing tier on the account by pricing family. Args: account_type (string): indicates if vendor or subaccount. account_id (int): indicates if vendor_id or subaccount_id. pricing_family_id (int): the ID of the pricing family. Returns: response.Response: containing the soft deleted default account pricing tier dict. """ return default_account_pricing_tier.\ soft_delete_default_account_pricing_tier( account_type, account_id, pricing_family_id, data)