diff --git a/src/Events/StatusChangeRequest.php b/src/Events/StatusChangeRequest.php index 17cfb16..db7bd8d 100644 --- a/src/Events/StatusChangeRequest.php +++ b/src/Events/StatusChangeRequest.php @@ -7,6 +7,8 @@ class StatusChangeRequest public static $TYPE_CHANGE_STATUS_TO = "CHANGE_STATUS_TO"; public static $TYPE_RELEASE = "RELEASE"; + public static $TYPE_OVERRIDE_SEASON_STATUS = "OVERRIDE_SEASON_STATUS"; + public static $TYPE_USE_SEASON_STATUS = "USE_SEASON_STATUS"; /** * @var string diff --git a/tests/Events/ChangeObjectStatusInBatchTest.php b/tests/Events/ChangeObjectStatusInBatchTest.php index 3d31c95..041f6f6 100644 --- a/tests/Events/ChangeObjectStatusInBatchTest.php +++ b/tests/Events/ChangeObjectStatusInBatchTest.php @@ -2,6 +2,7 @@ namespace Seatsio\Events; +use Seatsio\Seasons\SeasonCreationParams; use Seatsio\SeatsioClientTest; use Seatsio\SeatsioException; @@ -111,4 +112,33 @@ public function testRelease() $objectInfo1 = $this->seatsioClient->events->retrieveObjectInfo($event->key, "A-1"); self::assertEquals(EventObjectInfo::$FREE, $objectInfo1->status); } + + public function testOverrideSeasonStatus() + { + $chartKey = $this->createTestChart(); + $season = $this->seatsioClient->seasons->create($chartKey, (new SeasonCreationParams())->setEventKeys(["anEvent"])); + $this->seatsioClient->events->book($season->key, ["A-1", "A-2"]); + + $response = $this->seatsioClient->events->changeObjectStatusInBatch([ + (new StatusChangeRequest())->setType(StatusChangeRequest::$TYPE_OVERRIDE_SEASON_STATUS)->setEvent("anEvent")->setObjects(["A-1", "A-2"]), + ]); + + self::assertEquals(EventObjectInfo::$FREE, $response[0]->objects['A-1']->status); + self::assertEquals(EventObjectInfo::$FREE, $response[0]->objects['A-2']->status); + } + + public function testUseSeasonStatus() + { + $chartKey = $this->createTestChart(); + $season = $this->seatsioClient->seasons->create($chartKey, (new SeasonCreationParams())->setEventKeys(["anEvent"])); + $this->seatsioClient->events->book($season->key, ["A-1", "A-2"]); + $this->seatsioClient->events->overrideSeasonStatus("anEvent", ["A-1", "A-2"]); + + $response = $this->seatsioClient->events->changeObjectStatusInBatch([ + (new StatusChangeRequest())->setType(StatusChangeRequest::$TYPE_USE_SEASON_STATUS)->setEvent("anEvent")->setObjects(["A-1", "A-2"]), + ]); + + self::assertEquals(EventObjectInfo::$BOOKED, $response[0]->objects['A-1']->status); + self::assertEquals(EventObjectInfo::$BOOKED, $response[0]->objects['A-2']->status); + } }