Bug 34365 - Hold cancellation request workflow cannot be triggered on API
Summary: Hold cancellation request workflow cannot be triggered on API
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-24 18:02 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2023-12-28 20:47 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.03,22.11.09
Circulation function:


Attachments
Bug 34365: Unit tests (4.17 KB, patch)
2023-07-24 19:58 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 34365: Add cancellation request flow to DELETE /holds (1.31 KB, patch)
2023-07-24 19:58 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 34365: Unit tests (4.24 KB, patch)
2023-07-26 18:40 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 34365: Add cancellation request flow to DELETE /holds (1.38 KB, patch)
2023-07-26 18:40 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 34365: Unit tests (4.30 KB, patch)
2023-08-02 11:22 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 34365: Add cancellation request flow to DELETE /holds (1.43 KB, patch)
2023-08-02 11:22 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2023-07-24 18:02:19 UTC
Rigth now the `DELETE /holds/:holds` route does a straight-cancellation of the hold. It should be possible to trigger the hold cancellation request workflow so thrid-party systems can use it.
Comment 1 Tomás Cohen Arazi (tcohen) 2023-07-24 19:58:56 UTC
Created attachment 153855 [details] [review]
Bug 34365: Unit tests
Comment 2 Tomás Cohen Arazi (tcohen) 2023-07-24 19:58:58 UTC
Created attachment 153856 [details] [review]
Bug 34365: Add cancellation request flow to DELETE /holds

This patch adds a new `x-koha-override` header to allow enforcing the
cancellation request flow for waiting holds.

If the hold is not waiting, the header has no effect.

To test:
1. Apply the tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: The endpoint doesn't implement the required logic
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The endpoint behavior is changed!
5. Sign off :-D
Comment 3 Emily Lamancusa (emlam) 2023-07-26 18:40:19 UTC
Created attachment 153935 [details] [review]
Bug 34365: Unit tests

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 4 Emily Lamancusa (emlam) 2023-07-26 18:40:21 UTC
Created attachment 153936 [details] [review]
Bug 34365: Add cancellation request flow to DELETE /holds

This patch adds a new `x-koha-override` header to allow enforcing the
cancellation request flow for waiting holds.

If the hold is not waiting, the header has no effect.

To test:
1. Apply the tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: The endpoint doesn't implement the required logic
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The endpoint behavior is changed!
5. Sign off :-D

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 5 Kyle M Hall (khall) 2023-08-02 11:22:23 UTC
Created attachment 154154 [details] [review]
Bug 34365: Unit tests

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall (khall) 2023-08-02 11:22:30 UTC
Created attachment 154155 [details] [review]
Bug 34365: Add cancellation request flow to DELETE /holds

This patch adds a new `x-koha-override` header to allow enforcing the
cancellation request flow for waiting holds.

If the hold is not waiting, the header has no effect.

To test:
1. Apply the tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: The endpoint doesn't implement the required logic
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The endpoint behavior is changed!
5. Sign off :-D

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Tomás Cohen Arazi (tcohen) 2023-08-15 08:24:53 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 8 Fridolin Somers 2023-08-17 19:24:11 UTC
Pushed to 23.05.x for 23.05.03
Comment 9 Pedro Amorim 2023-08-18 13:51:25 UTC
Nice work everyone!

Pushed to 22.11.x for next release