[Bug 20942] New: Add route to get patron's account balance
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Bug ID: 20942 Summary: Add route to get patron's account balance Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: new feature Priority: P5 - low Component: REST api Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Depends on| |17586 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17586 [Bug 17586] Add the Koha::Account->balance method -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |15165 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15165 [Bug 15165] REST API routes to list, edit and pay borrower's accountlines -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- URL| |https://wiki.koha-community | |.org/wiki/Patrons_account_l | |ines_endpoint_RFC -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com, | |lari.taskula@jns.fi, | |m.de.rooy@rijksmuseum.nl, | |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 76053 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76053&action=edit Bug 20942: OpenAPI spec for /patrons/{patron_id}/account This patch adds the OpenAPI spec for the following paths: - /patrons/{patron_id}/account It also adds object definitions for: - balance - account line Account line is to be used on both /account/lines (when implemented) and for embeding the outstanding lines in the balance endpoint (/patrons/{patron_id}/account). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 76054 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76054&action=edit Bug 20942: Unit tests for /patrons/{patron_id}/account This patch adds tests for the /patrons/{patron_id}/account endpoint. To test: - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => FAIL: Tests should fail because the endpoint is not implemented. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 76055 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76055&action=edit Bug 20942: Add route to get patron's account balance This patch implements the /patrons/{patron_id}/account endpoint. It can be used to get the patron's balance information, including outstanding lines. To test: - Apply this patchset - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: tests pass! - Make your favourite REST testing tool (RESTer on Firefox?) do: GET /api/v1/patrons/{patron_id}/account to a valid patron_id. Play with Koha's UI to add credits/payments and notice the endpoint returns the right info following the voted RFC. [1] - Sign off :-D [1] https://wiki.koha-community.org/wiki/Patrons_account_lines_endpoint_RFC -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |20944 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20944 [Bug 20944] Add routes to add credits and debits to a patron's account -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |20990, 20946 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20946 [Bug 20946] Cannot pay fines for patrons with credits https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20990 [Bug 20990] Add Koha::Account::outstanding_credits -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 76393 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76393&action=edit Bug 20942: Split debit and credit lines This patch splits the balance to match this object schema: { balance => #, outstanding_credits => { total => #, lines => [ credit_line_1, ..., credit_line_n ] }, outstanding_debits => { total => #, lines => [ debit_line_1, ..., debit_line_m ] } } This change is made to ease usage from the UI. Also because the outstanding credits need to be applied to outstanding debits in order to the balance value to make sense. So we still need to have each total. Tests are added for this change, and the schema files are adjusted as well. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: Tests pass! - Sign off :-D staff_id is changed into user_id as voted on the dev meeting the RFC got approved. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #76053|0 |1 is obsolete| | Attachment #76054|0 |1 is obsolete| | Attachment #76055|0 |1 is obsolete| | Attachment #76393|0 |1 is obsolete| | --- Comment #5 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 76409 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76409&action=edit Bug 20942: OpenAPI spec for /patrons/{patron_id}/account This patch adds the OpenAPI spec for the following paths: - /patrons/{patron_id}/account It also adds object definitions for: - balance - account line Account line is to be used on both /account/lines (when implemented) and for embeding the outstanding lines in the balance endpoint (/patrons/{patron_id}/account). Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #6 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 76410 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76410&action=edit Bug 20942: Unit tests for /patrons/{patron_id}/account This patch adds tests for the /patrons/{patron_id}/account endpoint. To test: - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => FAIL: Tests should fail because the endpoint is not implemented. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #7 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 76411 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76411&action=edit Bug 20942: Add route to get patron's account balance This patch implements the /patrons/{patron_id}/account endpoint. It can be used to get the patron's balance information, including outstanding lines. To test: - Apply this patchset - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: tests pass! - Make your favourite REST testing tool (RESTer on Firefox?) do: GET /api/v1/patrons/{patron_id}/account to a valid patron_id. Play with Koha's UI to add credits/payments and notice the endpoint returns the right info following the voted RFC. [1] - Sign off :-D [1] https://wiki.koha-community.org/wiki/Patrons_account_lines_endpoint_RFC Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #8 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 76412 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76412&action=edit Bug 20942: Split debit and credit lines This patch splits the balance to match this object schema: { balance => #, outstanding_credits => { total => #, lines => [ credit_line_1, ..., credit_line_n ] }, outstanding_debits => { total => #, lines => [ debit_line_1, ..., debit_line_m ] } } This change is made to ease usage from the UI. Also because the outstanding credits need to be applied to outstanding debits in order to the balance value to make sense. So we still need to have each total. Tests are added for this change, and the schema files are adjusted as well. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: Tests pass! - Sign off :-D staff_id is changed into user_id as voted on the dev meeting the RFC got approved. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- General question: cannot we have only one of $to_api_mapping and $to_model_mapping, and generate the other one? It seems that we are duplicating the information. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 76641 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76641&action=edit Bug 20942: (QA follow-up) Use $lines->total_outstanding This patch makes the controller code use $lines->total_outstanding instead of expecting ->outstanding_debits and ->outstanding_credits return the total. Tests should pass as before. No behaviour change is expected. To test: - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: Tests still pass, no behaviour change. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #9)
General question: cannot we have only one of $to_api_mapping and $to_model_mapping, and generate the other one? It seems that we are duplicating the information.
I don't think this is urgent, but yes, we could have a hash of hashes, one of them generated by reverse. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #76409|0 |1 is obsolete| | Attachment #76410|0 |1 is obsolete| | Attachment #76411|0 |1 is obsolete| | Attachment #76412|0 |1 is obsolete| | Attachment #76641|0 |1 is obsolete| | --- Comment #12 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 76808 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76808&action=edit Bug 20942: OpenAPI spec for /patrons/{patron_id}/account This patch adds the OpenAPI spec for the following paths: - /patrons/{patron_id}/account It also adds object definitions for: - balance - account line Account line is to be used on both /account/lines (when implemented) and for embeding the outstanding lines in the balance endpoint (/patrons/{patron_id}/account). Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #13 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 76809 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76809&action=edit Bug 20942: Unit tests for /patrons/{patron_id}/account This patch adds tests for the /patrons/{patron_id}/account endpoint. To test: - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => FAIL: Tests should fail because the endpoint is not implemented. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #14 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 76810 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76810&action=edit Bug 20942: Add route to get patron's account balance This patch implements the /patrons/{patron_id}/account endpoint. It can be used to get the patron's balance information, including outstanding lines. To test: - Apply this patchset - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: tests pass! - Make your favourite REST testing tool (RESTer on Firefox?) do: GET /api/v1/patrons/{patron_id}/account to a valid patron_id. Play with Koha's UI to add credits/payments and notice the endpoint returns the right info following the voted RFC. [1] - Sign off :-D [1] https://wiki.koha-community.org/wiki/Patrons_account_lines_endpoint_RFC Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #15 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 76811 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76811&action=edit Bug 20942: Split debit and credit lines This patch splits the balance to match this object schema: { balance => #, outstanding_credits => { total => #, lines => [ credit_line_1, ..., credit_line_n ] }, outstanding_debits => { total => #, lines => [ debit_line_1, ..., debit_line_m ] } } This change is made to ease usage from the UI. Also because the outstanding credits need to be applied to outstanding debits in order to the balance value to make sense. So we still need to have each total. Tests are added for this change, and the schema files are adjusted as well. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: Tests pass! - Sign off :-D staff_id is changed into user_id as voted on the dev meeting the RFC got approved. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #16 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 76812 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76812&action=edit Bug 20942: (QA follow-up) Use $lines->total_outstanding This patch makes the controller code use $lines->total_outstanding instead of expecting ->outstanding_debits and ->outstanding_credits return the total. Tests should pass as before. No behaviour change is expected. To test: - Run: $ kshell k$ prove t/db_dependent/api/v1/patrons_accounts.t => SUCCESS: Tests still pass, no behaviour change. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Bug 20942 depends on bug 20990, which changed state. Bug 20990 Summary: Add Koha::Account::outstanding_credits https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20990 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |nick@bywatersolutions.com --- Comment #17 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 18.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #18 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Pushed to 18.05.x series for 18.05.03 I've made the decision to backport new api routes (one's that are a simple backport at least - where simple means there's not a lot of unported dependancies or the api route bug itself doesn't include lots of related refactoring work). My justification here is that an API route isn't immediately user facing and as such most users will not see the change. However, it does allow for third-party integrations to be developed against a more stable code base earlier and allow for a wider range of Koha versions to be supported by third-party applications.. that can only be seen as a good thing in my opinion. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |Introduces API endpoints release notes| |for dealing with patron | |accounts, a highly | |requested feature for | |third-party integrations. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 --- Comment #19 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Martin Renvoize from comment #18)
Pushed to 18.05.x series for 18.05.03
I've made the decision to backport new api routes (one's that are a simple backport at least - where simple means there's not a lot of unported dependancies or the api route bug itself doesn't include lots of related refactoring work).
My justification here is that an API route isn't immediately user facing and as such most users will not see the change. However, it does allow for third-party integrations to be developed against a more stable code base earlier and allow for a wider range of Koha versions to be supported by third-party applications.. that can only be seen as a good thing in my opinion.
I agree! Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Stable |RESOLVED CC| |fridolin.somers@biblibre.co | |m --- Comment #20 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- I prefer not to push to 17.11.x to focus on major bugs. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Bug 20942 depends on bug 20946, which changed state. Bug 20946 Summary: Cannot pay fines for patrons with credits https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20946 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Stable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |21786 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21786 [Bug 21786] Routes for credits should include library_id -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=15165 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20942 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |23607 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23607 [Bug 23607] Make /patrons/:patron_id/account privileged user only -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org