"""Blueprint for payment hold 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.error import ERROR_CODE_AUTHORIZATION from abacus_account.logic import payment_hold_history as logic from abacus_account.utils.authorization import authorize_many_accounts payment_hold_history_api = Blueprint('payment_hold_history_api', __name__) @payment_hold_history_api.route('/account//payment-hold-history', methods=['GET']) def payment_hold_history(object_id): """Endpoint to GET payment hold 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_CODE_AUTHORIZATION, message='Unauthorized', status=403, )) return flaskify(logic.get_payment_hold_history(object_id))