diff --git a/src/Events/StatusChange.php b/src/Events/StatusChange.php index 5c21c11..20b8134 100644 --- a/src/Events/StatusChange.php +++ b/src/Events/StatusChange.php @@ -40,4 +40,12 @@ class StatusChange * @var StatusChangeOrigin */ public $origin; + /** + * @var boolean + */ + public $isPresentOnChart; + /** + * @var string + */ + public $notPresentOnChartReason; } diff --git a/tests/Events/ListStatusChangesTest.php b/tests/Events/ListStatusChangesTest.php index f242a2e..fa2c295 100644 --- a/tests/Events/ListStatusChangesTest.php +++ b/tests/Events/ListStatusChangesTest.php @@ -4,6 +4,7 @@ use Seatsio\Events\EventObjectInfo; use Seatsio\Events\ObjectProperties; +use Seatsio\Events\TableBookingConfig; use Seatsio\SeatsioClientTest; use function Functional\map; @@ -45,6 +46,22 @@ public function testPropertiesOfStatusChange() self::assertEquals((object)["foo" => "bar"], $statusChange->extraData); self::assertEquals("API_CALL", $statusChange->origin->type); self::assertNotNull($statusChange->origin->ip); + self::assertTrue($statusChange->isPresentOnChart); + self::assertNull($statusChange->notPresentOnChartReason); + } + + public function testNotPresentOnChartAnymore() + { + $chartKey = $this->createTestChartWithTables(); + $event = $this->seatsioClient->events->create($chartKey, null, TableBookingConfig::allByTable()); + $this->seatsioClient->events->book($event->key, "T1"); + $this->seatsioClient->events->update($event->key, null, null, TableBookingConfig::allBySeat()); + + $statusChanges = $this->seatsioClient->events->statusChanges($event->key)->all(); + $statusChange = $statusChanges->current(); + + self::assertFalse($statusChange->isPresentOnChart); + self::assertEquals("SWITCHED_TO_BOOK_BY_SEAT", $statusChange->notPresentOnChartReason); } public function testFilter()