"""Blueprint for Account Payee History API.""" from flask import Blueprint from flask import request from owsrequest import flask_request from owsresponse import response from owsresponse.adaptors.flask import flaskify from abacus_account.constants import error from abacus_account.logic import account_payee_history as logic from abacus_account.utils.authorization import authorize_many_accounts account_payee_history_api = Blueprint('account_payee_history_api', __name__) @account_payee_history_api.route( '/account//account-payee-history', methods=['GET'] ) def account_payee_history(object_id): """Endpoint to GET account payee history for a specified account.""" access_rule_decision = flask_request.verify_rules_access_standalone(request) if not access_rule_decision: authorized = authorize_many_accounts([object_id]) if not authorized: return flaskify(response.create_error_response( code=error.ERROR_CODE_AUTHORIZATION, message='Unauthorized', status=403, )) return flaskify(logic.get_account_payee_history(object_id))