public function applyBookOffered(BookOffered $event) { $this->id = $event->bookId(); $this->sellersId = $event->sellersId(); $this->isbn_10 = $event->isbn(); $this->price = $event->price(); }
public function whenBookOffered(BookOffered $event) { $bookDetails = $this->bookDetailRepository->getByISBN($event->isbn()); $book = new AvailableBook($event->bookId(), $bookDetails->title(), $bookDetails->author(), $event->price(), $event->isbn(), $bookDetails->pathToCover(), false); //salePending $this->books->save($book); }
/** @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); }
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); }