Bug 33573 - Add public endpoint for cancelling holds
Summary: Add public endpoint for cancelling holds
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-20 14:22 UTC by Nick Clemens (kidclamp)
Modified: 2023-12-28 20:47 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.02,22.11.08


Attachments
Bug 33573: Unit tests (3.43 KB, patch)
2023-06-07 13:44 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 33573: Add public endpoint for cancelling holds (4.83 KB, patch)
2023-06-07 13:45 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 33573: Unit tests (3.47 KB, patch)
2023-06-07 14:41 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33573: Add public endpoint for cancelling holds (4.86 KB, patch)
2023-06-07 14:41 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33573: Unit tests (3.54 KB, patch)
2023-06-07 14:57 UTC, Emily Lamancusa
Details | Diff | Splinter Review
Bug 33573: Add public endpoint for cancelling holds (4.93 KB, patch)
2023-06-07 14:57 UTC, Emily Lamancusa
Details | Diff | Splinter Review
Bug 33573: Unit tests (3.54 KB, patch)
2023-06-30 13:06 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 33573: Add public endpoint for cancelling holds (4.93 KB, patch)
2023-06-30 13:06 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2023-04-20 14:22:27 UTC
DELETE request to  /api/v1/holds/{holdkey} simply cancels a waiting hold if that is allowed. It should instead generate a cancellation request

We should add a new endpoint:
DELETE /api/v1/public/patrons/:patron_id/holds/:hold_id

And it should return a 202 accepted response as the actual deletion doesn't happen until the library confirms
Comment 1 Tomás Cohen Arazi 2023-06-07 13:44:57 UTC
Created attachment 152107 [details] [review]
Bug 33573: Unit tests
Comment 2 Tomás Cohen Arazi 2023-06-07 13:45:00 UTC
Created attachment 152108 [details] [review]
Bug 33573: Add public endpoint for cancelling holds

This patch introduces a public endpoint for cancelling holds.
Cancellation requests are generated when the hold is waiting and
configuration allows requesting cancellation, as the OPAC does right
now.

Tests cover all the use cases.

To test:
1. Apply this patches
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/patrons_holds.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Comment 3 Sam Lau 2023-06-07 14:41:19 UTC
Created attachment 152112 [details] [review]
Bug 33573: Unit tests

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 4 Sam Lau 2023-06-07 14:41:21 UTC
Created attachment 152113 [details] [review]
Bug 33573: Add public endpoint for cancelling holds

This patch introduces a public endpoint for cancelling holds.
Cancellation requests are generated when the hold is waiting and
configuration allows requesting cancellation, as the OPAC does right
now.

Tests cover all the use cases.

To test:
1. Apply this patches
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/patrons_holds.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 5 Emily Lamancusa 2023-06-07 14:57:32 UTC
Created attachment 152114 [details] [review]
Bug 33573: Unit tests

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 6 Emily Lamancusa 2023-06-07 14:57:34 UTC
Created attachment 152115 [details] [review]
Bug 33573: Add public endpoint for cancelling holds

This patch introduces a public endpoint for cancelling holds.
Cancellation requests are generated when the hold is waiting and
configuration allows requesting cancellation, as the OPAC does right
now.

Tests cover all the use cases.

To test:
1. Apply this patches
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/patrons_holds.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 7 Rhonda Kuiper 2023-06-29 22:34:19 UTC
Our Aspen library is excited to get this function.
Comment 8 Kyle M Hall 2023-06-30 13:06:41 UTC
Created attachment 152904 [details] [review]
Bug 33573: Unit tests

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 9 Kyle M Hall 2023-06-30 13:06:57 UTC
Created attachment 152905 [details] [review]
Bug 33573: Add public endpoint for cancelling holds

This patch introduces a public endpoint for cancelling holds.
Cancellation requests are generated when the hold is waiting and
configuration allows requesting cancellation, as the OPAC does right
now.

Tests cover all the use cases.

To test:
1. Apply this patches
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/patrons_holds.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 10 Tomás Cohen Arazi 2023-07-03 17:50:57 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 11 Emily Lamancusa 2023-07-05 14:44:21 UTC
Any chance for backport on this one? The API endpoint is necessary for the hold cancellation from OPAC feature to work correctly for Koha/Aspen libraries.
Comment 12 Rhonda Kuiper 2023-07-05 14:48:05 UTC
+1
Comment 13 Sally Lodico 2023-07-06 20:34:38 UTC
+1 for the backport to 22.11 and the quick fix. We'd like to be able to turn this on in Aspen, too.
Comment 14 Katrin Fischer 2023-07-08 13:04:16 UTC
We need a decision from the 23.05 RMaint first here. Marking the bug accordingly to get some attention.
Comment 15 Martin Renvoize 2023-07-17 14:56:30 UTC
This shouldn't cause any issues downstream or with end users.. choosing to backport.
Comment 16 Martin Renvoize 2023-07-17 15:00:09 UTC
Thanks for all the hard work!

Pushed to 23.05.x for the next release
Comment 17 Matt Blenkinsop 2023-07-18 14:45:14 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x