public function whenBookOffered(BookOffered $event)
 {
     $bookDetails = $this->bookDetailRepository->getByISBN($event->isbn());
     $seller = $this->members->find((string) $event->selllersId());
     $book = new BookTransaction($event->bookId(), $bookDetails->title(), $event->sellersId(), $seller->fullName(), null, null, $event->price(), false, false);
     $this->books->save($book);
 }
Ejemplo n.º 2
0
 public function applyBookOffered(BookOffered $event)
 {
     $this->id = $event->bookId();
     $this->sellersId = $event->sellersId();
     $this->isbn_10 = $event->isbn();
     $this->price = $event->price();
 }
 /** @test */
 public function an_event_holds_data()
 {
     $bookId = BookId::generate();
     $sellersId = MemberId::generate();
     $isbn = "0534408133";
     $event = new BookOffered($bookId, $sellersId, $isbn, 1500);
     $this->assertEquals($event->bookId(), $bookId);
     $this->assertEquals($event->sellersId(), $sellersId);
     $this->assertEquals($event->isbn(), $isbn);
     $this->assertEquals($event->price(), 1500);
 }