https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24401

--- Comment #80 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209546
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209546&action=edit
Bug 24401: Align POST /checkins with the bug 42383 endpoint design

Ports the main POST /checkins (Checkins#add) endpoint to the design
developed on bug 42383, which is a strict superset of the previous
implementation:

- Enforce the updatecharges.writeoff permission for exempt_fine with an
  explicit 403 (error_code: no_permission_for_exempt_fine), instead of
  silently dropping the flag.
- Reject supplying both item_id and external_id
  (error_code: mutually_exclusive_parameters), and rename the missing
  identifier error to missing_item_identifier.
- Default library_id to the logged in user's branch, matching AddReturn's
  own fallback so the availability dry-run and the checkin agree.
- Support return_date (gated behind the SpecifyReturnDate preference,
  error_code: return_date_not_allowed) and dropbox_mode.
- Return AddReturn's outcome messages: serialize the checkin object's
  object_messages into a `messages` array on the response, resolving the
  previous gap where ~25 outcome messages never reached API consumers.
- Use lower_snake_case error codes (checkin_blocked, confirmation_required,
  etc.), consistent with the rest of the API, and include the item in the
  412 confirmation response.

The bug 42383 module-policy and bundle-verification hooks are intentionally
left out here: they depend on framework not present on this branch and are
outside the scope of the main checkin endpoint.

Test plan:
1. Apply patch
2. Run the tests:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/checkins.t
=> SUCCESS: Tests pass!
3. Rebuild and validate the API spec:
  k$ yarn api:bundle
  k$ prove xt/api.t
=> SUCCESS: Tests pass!
4. As a user WITHOUT updatecharges.writeoff, POST /checkins with
   exempt_fine: true on an item with an outstanding overdue fine
=> SUCCESS: 403 no_permission_for_exempt_fine, the fine is not forgiven
5. Sign off :-D

Assisted-by: Sonnet 4.6 (Anthropic)
Signed-off-by: Tomás Cohen Arazi <[email protected]>
Signed-off-by: Brendan Lawlor <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to