BookReservation status is changed to RESERVED when user is checking out

I have few doubts around the functionality of BookReservation. I am mentioning it in terms of the three scenarios :

  1. When a user tries to checkout the book, the BookReservation status is changed to COMPLETE, though actual checkout might fail. This is fine, since in a real situation, item can still be in the cart, say after a failed payment.

  2. But when user is returning a book , we just check if BookReservation != null, without checking for member id. The BookReservation will already have an entry with COMPLETE status for this member id, because of the checkout process. We update the entry to RESERVED , but other user can not have any entry for BookReservation if the previous user already had an entry with COMPLETE, as per the following line in checkout function -->

     if (bookReservation != null && bookReservation.getMemberId() != this.getId()) {
           // book item has a pending reservation from another user
           ShowError("This book is reserved by another member");
           return false;

Maybe things have been abstracted, but I am not able to make sense of this

  1. In case of renewBookItem , we shouldn’t be decrementing total books checkout for the member, in case they can’t renew the book, since their date for returning might not have been reached and some other user might chose to let go of their reservation. (From the extensibility of code perspective)

Please let me know if my logic is flawed or if there is some gap in my understanding