Bug 40345: Force checkout

Pass the confirmation token to force the checkout

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit ed2c56ee6e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Jonathan Druart 2025-07-10 23:05:14 +02:00 committed by Paul Derscheid
parent e723214b74
commit d942d12dba
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 13 additions and 1 deletions

View File

@ -517,8 +517,20 @@ const insertObject = async ({ type, object, baseUrl, authHeader }) => {
} else if (type == "checkout") {
const { issuer, patron, ...checkout } = object;
let endpoint = "/api/v1/checkouts";
// Force the checkout - we might need a parameter to control this behaviour later
await apiGet({
endpoint: `/api/v1/checkouts/availability?item_id=${object.item_id}&patron_id=${object.patron_id}`,
baseUrl,
authHeader,
}).then(result => {
if (result.confirmation_token) {
endpoint += `?confirmation=${result.confirmation_token}`;
}
});
return apiPost({
endpoint: "/api/v1/checkouts",
endpoint,
body: checkout,
baseUrl,
authHeader,