From 119af57c0546d7fc0dbe282330ab3fbb0f9e932a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 10 Jul 2025 23:05:14 +0200 Subject: [PATCH] Bug 40345: Force checkout Pass the confirmation token to force the checkout --- t/cypress/plugins/insertData.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/cypress/plugins/insertData.js b/t/cypress/plugins/insertData.js index 482de34cbd0..bc92c26bad7 100644 --- a/t/cypress/plugins/insertData.js +++ b/t/cypress/plugins/insertData.js @@ -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, -- 2.34.1