diff --git a/src/Events/Events.php b/src/Events/Events.php index 790bf11..cb8dabe 100644 --- a/src/Events/Events.php +++ b/src/Events/Events.php @@ -269,10 +269,11 @@ public function holdBestAvailable($eventKey, $number, $holdToken, $categories = * @param $status string * @param $categories string[] * @param $holdToken string + * @param $extraData array * @param $orderId string * @return BestAvailableObjects */ - public function changeBestAvailableObjectStatus($eventKey, $number, $status, $categories = null, $holdToken = null, $orderId = null) + public function changeBestAvailableObjectStatus($eventKey, $number, $status, $categories = null, $holdToken = null, $extraData = null, $orderId = null) { $request = new \stdClass(); $bestAvailable = new \stdClass(); @@ -280,6 +281,9 @@ public function changeBestAvailableObjectStatus($eventKey, $number, $status, $ca if ($categories !== null) { $bestAvailable->categories = $categories; } + if ($extraData != null) { + $bestAvailable->extraData = $extraData; + } $request->bestAvailable = $bestAvailable; $request->status = $status; if ($holdToken !== null) { diff --git a/tests/Events/ChangeBestAvailableObjectStatusTest.php b/tests/Events/ChangeBestAvailableObjectStatusTest.php index e75b7b0..1fb7e93 100644 --- a/tests/Events/ChangeBestAvailableObjectStatusTest.php +++ b/tests/Events/ChangeBestAvailableObjectStatusTest.php @@ -28,6 +28,24 @@ public function testCategories() self::assertEquals(["C-4", "C-5", "C-6"], $bestAvailableObjects->objects, '', 0.0, 10, true); } + public function testExtraData() + { + $chartKey = $this->createTestChart(); + $event = $this->seatsioClient->events()->create($chartKey); + $extraData = [ + ["foo" => "bar"], + ["foo" => "baz"] + ]; + + $bestAvailableObjects = $this->seatsioClient->events()->changeBestAvailableObjectStatus($event->key, 2, "lolzor", null, null, $extraData); + + self::assertEquals(["B-4", "B-5"], $bestAvailableObjects->objects, '', 0.0, 10, true); + $b4Status = $this->seatsioClient->events()->retrieveObjectStatus($event->key, "B-4"); + self::assertEquals($b4Status->extraData, (object)["foo" => "bar"]); + $b5Status = $this->seatsioClient->events()->retrieveObjectStatus($event->key, "B-5"); + self::assertEquals($b5Status->extraData, (object)["foo" => "baz"]); + } + public function testHoldToken() { $chartKey = $this->createTestChart(); @@ -46,13 +64,13 @@ public function testOrderId() $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events()->create($chartKey); - $bestAvailableObjects = $this->seatsioClient->events()->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, "anOrder"); + $bestAvailableObjects = $this->seatsioClient->events()->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, "anOrder"); $objectStatus = $this->seatsioClient->events()->retrieveObjectStatus($event->key, $bestAvailableObjects->objects[0]); self::assertEquals("anOrder", $objectStatus->orderId); } - public function book() + public function testBook() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events()->create($chartKey); @@ -60,10 +78,10 @@ public function book() $bestAvailableObjects = $this->seatsioClient->events()->bookBestAvailable($event->key, 3); self::assertTrue($bestAvailableObjects->nextToEachOther); - self::assertEquals(["B-3", "B-4", "B-5"], $bestAvailableObjects->objects, '', 0.0, 10, true); + self::assertEquals(["B-4", "B-5", "B-6"], $bestAvailableObjects->objects, '', 0.0, 10, true); } - public function hold() + public function testHold() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events()->create($chartKey);