DCB Lending Flow Details
Purpose:
This page will provide the steps for all the state transition in Lending library.
STATUS TRANSITION:
1) CREATED
For the first time, if user wants to create a transaction they can call the edge-api with the below payload.
Note: API key should change based on tenant.
HTTP Method : POST
Request Body :
{
"item": {
"id": "948b3fd4-047c-4291-9509-b583f860d6c5",
"barcode": "SystemDemoItem4"
},
"patron": {
"id": "11b526a6-37d6-47c2-a4df-e46189791256",
"group": "staff",
"barcode": "systemDemoUser1",
"localNames": "[{{$randomFirstName}}, {{$randomLastName}}]"
},
"pickup": {
"servicePointId": "5d2625ef-81eb-4e61-a8a9-87c94ba3764d",
"servicePointName": "circDesk2",
"libraryCode": "GVSU"
},
"role": "LENDER"
}
Note - The above payload fields with values are required for the "role": "LENDER".
For Lending library,
Item id and Item barcode needs to be valid.
Patron group needs to be valid.
Role should be LENDER.
Transaction Id should be unique
When this request executes, below actions will happen.
If the patron exist with the following combination of lookup (id and barcode), we will use that patron or a new virtual patron will be created and tagged to type DCB.
From Sunflower SP#3: If localNames are provided, they are mapped to new DCB user’s First name, Middle name and Last name, accordingly. If only 2 names are provided → only First name and Last name are populated, if only one name → Last name. If localNames are not passed → user is created with default DcbSystem Last name.We will create a service point with the details given in the Pickup object of the above payload. If the service point already exists, we will reuse it. servicePointId is optional.
Assuming the item is in available status and Page request will be created for the given real item and the created virtual patron. Once the request is created, Request status is Open-Not yet Filled and item status is paged. If item status is other that Available → Hold request is created.
At the end, new transaction is created with status CREATED.
2) CREATED to OPEN
If the user check in the item (Manual) which is paged in step1, status of the item will be changed to In-Transit and the request status will be Open-In Transit.
DCB will listen to the check in event and change the transaction status from CREATED to OPEN
3) OPEN to AWAITING_PICKUP
If the item reaches the Borrowing library and user do the checkin in the Borrowing library, status of the transaction will change from OPEN to Awaiting_pickup in Borrowing library. DCB will poll this status change using get API and propagate it to lending library with the below API.
HTTP Method : PUT
Request Body :
{
"status" : "AWAITING_PICKUP"
}
When this request executes, below actions will happen.
Automatic checkin happens in the same service point in which the request is created in step1. So that status of the item is changed to Awaiting_pickup and request is changed to Open-Awaiting pickup.
Status of the transaction change from OPEN to AWAITING_PICKUP
4) AWAITING_PICKUP to ITEM_CHECKED_OUT
Patron reaches the Borrowing library and do the checkout in the Borrowing library, status of the transaction will change from AWAITING_PICKUP to ITEM_CHECKED_OUT in Borrowing library. DCB will poll this status change using get API and propagate it to lending library with the below API.
HTTP Method : PUT
Request Body :
{
"status" : "ITEM_CHECKED_OUT"
}
When this request executes, below actions will happen.
Automatic checkout happens in Lending library. As a result of checkout, loan will be created and status of the item is changed to checked out and request is changed to Closed .
Status of the transaction change from AWAITING_PICKUP to ITEM_CHECKED_OUT
5) ITEM_CHECKED_OUT to ITEM_CHECKED_IN
Patron return the item so that checkin action takes place in the Borrowing library, status of the transaction will change from ITEM_CHECKED_OUT to ITEM_CHECKED_IN in Borrowing library. DCB will poll this status change using get API and propagate it to lending library with the below API.
HTTP Method : PUT
Request Body :
{
"status" : "ITEM_CHECKED_IN"
}
When this request executes, below actions will happen.
Status of the transaction change from ITEM_CHECKED_OUT to ITEM_CHECKED_IN
There will be no other action happens here, we are just synchronizing the states.
6) ITEM_CHECKED_IN to CLOSED
Item reaches the lending library and the user do the checkin action (Manual). mod-dcb will listen to the check-in action and update the status from ITEM_CHECKED_IN to CLOSED.
POLLING/RETRIEVING status
If user wants to poll/get the status of the transaction, they can call the below API.
HTTP Method : GET