As the title says.. we should have API routes for fetching a patrons credits and debits by now ;)
Created attachment 130350 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits.
Created attachment 144619 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits.
Rebased
When I try testing this, applying patch and restarting all services, then going to 'http://localhost:8081/api/v1/.html' I get this: The application raised the following error: Can't use an undefined value as an ARRAY reference at template mojo/debug.html.ep line 288. Context: 283: </div> 284: <div class="tap tap-border-top">tap for more</div> 285: </div> 286: </div> 287: <div class="row"> 288: % if (@{app->log->history}) { 289: % my $log = join '', map { scalar app->log->format->(@$_) } @{app->log->history}; 290: <pre class="mojo-terminal"><code class="nohighlight"><%= $log %></code></pre> 291: % } 292: % else { 293: <div class="alert alert-warning wide" role="alert"> Traceback (most recent call first): and the StackTrace middleware couldn't catch its stack trace, possibly because your application overrides $SIG{__DIE__} by itself, preventing the middleware from working correctly. Remove the offending code or module that does it: known examples are CGI::Carp and Carp::Always. Am I doing something wrong?
Probably a rebase error on my part.. I'll have a look today.
Created attachment 144713 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits.
Yup, it was a rebase issue.. sorted now :)
Note: I am testing by playing around with this JS: let bn = 5; let api_url = "/api/v1/patrons/" + bn + "/account/debits"; $.getJSON(api_url, function(data) { console.log(data) }); Works well.
The QA tool complains: OK Koha/Account.pm FAIL Koha/Account/Credit.pm FAIL valid Inconsistent hierarchy during C3 merge of class 'Koha::Account::Credit': current merge results [ Koha::Account::Credit, ] merging failed on 'Koha::Account::Line' OK Koha/Account/Credits.pm FAIL Koha/Account/Debit.pm FAIL valid Inconsistent hierarchy during C3 merge of class 'Koha::Account::Debit': current merge results [ Koha::Account::Debit, ] merging failed on 'Koha::Account::Line'
Created attachment 144718 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
FAIL valid Inconsistent hierarchy during C3 merge of class 'Koha::Account::Credit': current merge results [ Koha::Account::Credit, ] merging failed on 'Koha::Account::Line' FAIL valid Inconsistent hierarchy during C3 merge of class 'Koha::Account::Debit': current merge results [ Koha::Account::Debit, ] merging failed on 'Koha::Account::Line'
Created attachment 147565 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
OK.. the QA Script issue here is a bit of a red herring.. but there is still work to be done anyway. We ought to have some api tests.. seems I didn't add them here yet! I'm also considering just outright dropping Koha::Account::Line(s) classes and migrating the appropriate methods into the ::Credit(s) and ::Debit(s) classes instead.. There might still be some need for a base class to share some methods between them.. I'm not sure yet. Dropping the base class would get rid of the QA Script unhappiness.
Created attachment 147570 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 147644 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 150670 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Created attachment 150671 [details] [review] Bug 29453: (follow-up) Add tests and fix minimum amount in credit.yaml definition
Created attachment 150763 [details] [review] Bug 29453: Add endpoints for fetching patron credits & debits This patch adds two new API endpoints for fetching a patrons credits and a patrons debits. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Agustin Moyano <agustinmoyano@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 150764 [details] [review] Bug 29453: (follow-up) Add tests and fix minimum amount in credit.yaml definition Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Pushed to master for 23.05. Nice work everyone, thanks!
New feature, no backport for 22.11.x series.