Lines 517-524
const insertObject = async ({ type, object, baseUrl, authHeader }) => {
Link Here
|
517 |
} else if (type == "checkout") { |
517 |
} else if (type == "checkout") { |
518 |
const { issuer, patron, ...checkout } = object; |
518 |
const { issuer, patron, ...checkout } = object; |
519 |
|
519 |
|
|
|
520 |
let endpoint = "/api/v1/checkouts"; |
521 |
// Force the checkout - we might need a parameter to control this behaviour later |
522 |
await apiGet({ |
523 |
endpoint: `/api/v1/checkouts/availability?item_id=${object.item_id}&patron_id=${object.patron_id}`, |
524 |
baseUrl, |
525 |
authHeader, |
526 |
}).then(result => { |
527 |
if (result.confirmation_token) { |
528 |
endpoint += `?confirmation=${result.confirmation_token}`; |
529 |
} |
530 |
}); |
531 |
|
520 |
return apiPost({ |
532 |
return apiPost({ |
521 |
endpoint: "/api/v1/checkouts", |
533 |
endpoint, |
522 |
body: checkout, |
534 |
body: checkout, |
523 |
baseUrl, |
535 |
baseUrl, |
524 |
authHeader, |
536 |
authHeader, |
525 |
- |
|
|