Skip to content

Commit

Permalink
Calls to book and hold best available places now support ticket types…
Browse files Browse the repository at this point in the history
… and extra data
  • Loading branch information
mroloux committed Jul 29, 2020
1 parent ae2eeb0 commit d9b87e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
16 changes: 10 additions & 6 deletions src/Events/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,17 @@ public function book($eventKeyOrKeys, $objectOrObjects, $holdToken = null, $orde
* @param $number int
* @param $categories string[]
* @param $holdToken string
* @param $extraData array
* @param $ticketTypes string[]
* @param $orderId string
* @param $keepExtraData boolean
* @param $ignoreChannels boolean
* @param $channelKeys string[]
* @return BestAvailableObjects
*/
public function bookBestAvailable($eventKey, $number, $categories = null, $holdToken = null, $orderId = null, $keepExtraData = null, $ignoreChannels = null, $channelKeys = null)
public function bookBestAvailable($eventKey, $number, $categories = null, $holdToken = null, $extraData = null, $ticketTypes = null, $orderId = null, $keepExtraData = null, $ignoreChannels = null, $channelKeys = null)
{
return $this::changeBestAvailableObjectStatus($eventKey, $number, ObjectStatus::$BOOKED, $categories, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
return $this::changeBestAvailableObjectStatus($eventKey, $number, ObjectStatus::$BOOKED, $categories, $holdToken, $extraData, $ticketTypes, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
}

/**
Expand Down Expand Up @@ -480,15 +482,17 @@ public function hold($eventKeyOrKeys, $objectOrObjects, $holdToken, $orderId = n
* @param $number int
* @param $categories string[]
* @param $holdToken string
* @param $extraData array
* @param $ticketTypes string[]
* @param $orderId string
* @param $keepExtraData boolean
* @param $ignoreChannels boolean
* @param $channelKeys string[]
* @return BestAvailableObjects
*/
public function holdBestAvailable($eventKey, $number, $holdToken, $categories = null, $orderId = null, $keepExtraData = null, $ignoreChannels = null, $channelKeys = null)
public function holdBestAvailable($eventKey, $number, $holdToken, $categories = null, $extraData = null, $ticketTypes = null, $orderId = null, $keepExtraData = null, $ignoreChannels = null, $channelKeys = null)
{
return $this::changeBestAvailableObjectStatus($eventKey, $number, ObjectStatus::$HELD, $categories, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
return $this::changeBestAvailableObjectStatus($eventKey, $number, ObjectStatus::$HELD, $categories, $holdToken, $extraData, $ticketTypes, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
}

/**
Expand All @@ -498,14 +502,14 @@ public function holdBestAvailable($eventKey, $number, $holdToken, $categories =
* @param $categories string[]
* @param $holdToken string
* @param $extraData array
* @param $ticketTypes string[]
* @param $orderId string
* @param $keepExtraData boolean
* @param $ignoreChannels boolean
* @param $channelKeys string[]
* @param $ticketTypes string[]
* @return BestAvailableObjects
*/
public function changeBestAvailableObjectStatus($eventKey, $number, $status, $categories = null, $holdToken = null, $extraData = null, $orderId = null, $keepExtraData = null, $ignoreChannels = null, $channelKeys = null, $ticketTypes = null)
public function changeBestAvailableObjectStatus($eventKey, $number, $status, $categories = null, $holdToken = null, $extraData = null, $ticketTypes = null, $orderId = null, $keepExtraData = null, $ignoreChannels = null, $channelKeys = null)
{
$request = new \stdClass();
$bestAvailable = new \stdClass();
Expand Down
10 changes: 5 additions & 5 deletions tests/Events/ChangeBestAvailableObjectStatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testTicketTypes()
$chartKey = $this->createTestChart();
$event = $this->seatsioClient->events->create($chartKey);

$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 2, "lolzor", null, null, null, null, null, null, null, ["adult", "child"]);
$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 2, "lolzor", null, null, null, ["adult", "child"]);

self::assertEquals(["B-4", "B-5"], $bestAvailableObjects->objects, '', 0.0, 10, true);
$b4Status = $this->seatsioClient->events->retrieveObjectStatus($event->key, "B-4");
Expand All @@ -101,7 +101,7 @@ public function testOrderId()
$chartKey = $this->createTestChart();
$event = $this->seatsioClient->events->create($chartKey);

$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, "anOrder");
$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, null, "anOrder");

$objectStatus = $this->seatsioClient->events->retrieveObjectStatus($event->key, $bestAvailableObjects->objects[0]);
self::assertEquals("anOrder", $objectStatus->orderId);
Expand Down Expand Up @@ -138,7 +138,7 @@ public function testKeepExtraData()
$extraData = ["foo" => "bar"];
$this->seatsioClient->events->updateExtraData($event->key, "B-5", $extraData);

$this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, null, true);
$this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, null, null, true);

$objectStatus = $this->seatsioClient->events->retrieveObjectStatus($event->key, "B-5");
self::assertEquals((object)$extraData, $objectStatus->extraData);
Expand All @@ -155,7 +155,7 @@ public function testChannelKeys()
"channelKey1" => ["B-6"]
]);

$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, null, null, null, ["channelKey1"]);
$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, null, null, null, null, ["channelKey1"]);

self::assertEquals(["B-6"], $bestAvailableObjects->objects);
}
Expand All @@ -171,7 +171,7 @@ public function testIgnoreChannels()
"channelKey1" => ["B-5"]
]);

$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, null, null, true);
$bestAvailableObjects = $this->seatsioClient->events->changeBestAvailableObjectStatus($event->key, 1, "lolzor", null, null, null, null, null, null, true);

self::assertEquals(["B-5"], $bestAvailableObjects->objects);
}
Expand Down

0 comments on commit d9b87e8

Please sign in to comment.