public function whenBookSoldToMember(BookSoldToMember $event)
 {
     $book = $this->books->find((string) $event->bookId());
     $buyer = $this->members->find((string) $event->buyersId());
     $book = new BookTransaction($book->bookId(), $book->title(), $book->sellersId(), $book->sellersName(), $buyer->memberId(), $buyer->fullName(), $book->price(), false, false);
     $this->books->save($book);
 }
 /** @test */
 public function an_event_holds_data()
 {
     $bookId = BookId::generate();
     $buyersId = MemberId::generate();
     $event = new BookSoldToMember($bookId, $buyersId);
     $this->assertEquals($event->bookId(), $bookId);
     $this->assertEquals($event->buyersId(), $buyersId);
 }
 public function whenBookSoldToMember(BookSoldToMember $event)
 {
     $book = $this->books->find((string) $event->bookId());
     $book = new AvailableBook($book->bookId(), $book->title(), $book->author(), $book->price(), $book->isbn(), $book->pathToCover(), true);
     $this->books->save($book);
 }