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:
parent
e723214b74
commit
d942d12dba
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue