From 0ef80e2c0cfbdd560b48716c5e1ade4a15172794 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 25 Sep 2023 16:01:17 -0300 Subject: [PATCH] [ALTERNATE] Bug 34277: (follow-up) Use Koha::Patron->balance_details in GET /patrons/{patron_id}/account This patch makes the existing route reuse the introduced method. To verify no behavior change: 1. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: Tests pass! 2. Sign off :-D --- Koha/REST/V1/Patrons/Account.pm | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/Koha/REST/V1/Patrons/Account.pm b/Koha/REST/V1/Patrons/Account.pm index 2cf643029cf..d3cb8e17020 100644 --- a/Koha/REST/V1/Patrons/Account.pm +++ b/Koha/REST/V1/Patrons/Account.pm @@ -50,25 +50,9 @@ sub get { } return try { - my $account = $patron->account; - - # get outstanding debits and credits - my $debits = $account->outstanding_debits; - my $credits = $account->outstanding_credits; - return $c->render( status => 200, - openapi => { - balance => $account->balance, - outstanding_debits => { - total => $debits->total_outstanding, - lines => $debits->to_api - }, - outstanding_credits => { - total => $credits->total_outstanding, - lines => $credits->to_api - } - } + openapi => $patron->balance_details, ); } catch { -- 2.42.0