"""Logic for Account Payee History.""" from owsresponse import response from abacus_account import models from abacus_account.schemas.account_payee_history import AccountPayeeHistorySchema def get_account_payee_history(account_id): """Retrieve account payee history for the specified account.""" account_obj = models.Account.get_by_id_or_error(account_id) history_list = AccountPayeeHistorySchema(many=True).dump( account_obj.account_payee_history ) history_list.reverse() return response.Response(message=history_list, status=200)