Bugzilla – Attachment 156186 Details for
Bug 34277
Add an API endpoint to return all patrons with outstanding charges
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[ALTERNATE] Bug 34277: Add option to embed balance details on GET /patrons
ALTERNATE-Bug-34277-Add-option-to-embed-balance-de.patch (text/plain), 2.36 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-09-25 19:02:44 UTC
(
hide
)
Description:
[ALTERNATE] Bug 34277: Add option to embed balance details on GET /patrons
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-09-25 19:02:44 UTC
Size:
2.36 KB
patch
obsolete
>From f35304b6ed28e18835b72d60b88e0cbd78714266 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 25 Sep 2023 15:56:48 -0300 >Subject: [PATCH] [ALTERNATE] Bug 34277: Add option to embed balance details on > GET /patrons > >--- > Koha/Patron.pm | 30 ++++++++++++++++++++++++++ > api/v1/swagger/definitions/patron.yaml | 5 +++++ > api/v1/swagger/paths/patrons.yaml | 1 + > 3 files changed, 36 insertions(+) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 7b4f8c8f09f..9fd4ebc62c3 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -2374,6 +2374,36 @@ sub account_balance { > return $self->account->balance; > } > >+=head3 balance_details >+ >+ my $balance_details = $patron->balance_details >+ >+Return the patron's account balance details. >+ >+=cut >+ >+sub balance_details { >+ my ($self) = @_; >+ >+ my $account = $self->account; >+ >+ # get outstanding debits and credits >+ my $debits = $account->outstanding_debits; >+ my $credits = $account->outstanding_credits; >+ >+ return { >+ balance => $account->balance, >+ outstanding_debits => { >+ total => $debits->total_outstanding, >+ lines => $debits->to_api, >+ }, >+ outstanding_credits => { >+ total => $credits->total_outstanding, >+ lines => $credits->to_api, >+ } >+ }; >+} >+ > =head3 notify_library_of_registration > > $patron->notify_library_of_registration( $email_patron_registrations ); >diff --git a/api/v1/swagger/definitions/patron.yaml b/api/v1/swagger/definitions/patron.yaml >index 7967722db74..a05f7eaa9bf 100644 >--- a/api/v1/swagger/definitions/patron.yaml >+++ b/api/v1/swagger/definitions/patron.yaml >@@ -369,6 +369,11 @@ properties: > - number > - "null" > description: Balance of the patron's account >+ balance_details: >+ type: >+ - object >+ - "null" >+ description: Detail for outstanding debits and credits > library: > type: > - object >diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml >index 1f46a68a972..ef5a9f828d7 100644 >--- a/api/v1/swagger/paths/patrons.yaml >+++ b/api/v1/swagger/paths/patrons.yaml >@@ -368,6 +368,7 @@ > - checkouts+count > - overdues+count > - account_balance >+ - balance_details > - library > collectionFormat: csv > responses: >-- >2.42.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34277
:
153477
|
153478
|
154516
|
156185
| 156186 |
156187