Bug 38931

Summary: Add endpoints for individual credits and debits
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: martin.renvoize, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 38932    
Attachments: Bug 38931: Unit tests
Bug 38931: Add endpoints for individual credits and debits
Bug 38931: Unit tests
Bug 38931: Add endpoints for individual credits and debits

Description Tomás Cohen Arazi (tcohen) 2025-01-20 19:45:24 UTC
We have a way to retrieve the account lines using

* `GET /api/v1/patrons/:patron_id/account/debits`
* `GET /api/v1/patrons/:patron_id/account/credits`

but we are missing the individual ones.
Comment 1 Tomás Cohen Arazi (tcohen) 2025-01-20 19:59:36 UTC
Created attachment 176840 [details] [review]
Bug 38931: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi (tcohen) 2025-01-20 19:59:38 UTC
Created attachment 176841 [details] [review]
Bug 38931: Add endpoints for individual credits and debits

As the title says, we are missing such endpoints and this patch adds
them.

To test:
1. Apply this patches
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> SUCCESS: The spec builds!
=> SUCCESS: The tests pass!
3. Verify all the codepaths are covered by tests
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 David Nind 2025-01-22 10:24:00 UTC
Created attachment 176892 [details] [review]
Bug 38931: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-01-22 10:24:03 UTC
Created attachment 176893 [details] [review]
Bug 38931: Add endpoints for individual credits and debits

As the title says, we are missing such endpoints and this patch adds
them.

To test:
1. Apply this patches
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> SUCCESS: The spec builds!
=> SUCCESS: The tests pass!
3. Verify all the codepaths are covered by tests
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>