"""Logic for payee account.""" from payee.constants.constants import ( PAYONEER_ACCOUNT_STATUS_NAMES_CODES, PAYONEER_ACCOUNT_STATUSES, ) from payee.logic import payoneer def validate_payoneer_active_status(account_payee_id: int) -> bool: """Validate if payee payoneer account status `active`.""" payoneer_response = payoneer.get_payoneer_account(account_payee_id) payoneer_account = payoneer_response.message.get('result', {}) if payoneer_response.status != 200: return False is_active = ( payoneer_account.get('status', {}).get('type') == PAYONEER_ACCOUNT_STATUS_NAMES_CODES[PAYONEER_ACCOUNT_STATUSES.ACTIVE] ) return is_active