Skip to content

Commit

Permalink
Zone can be passed in to best available calls (#123)
Browse files Browse the repository at this point in the history
* Introduced BestAvailableParams

* Zone can be passed in

* Fixed test
  • Loading branch information
mroloux authored Jul 17, 2024
1 parent f9c2f95 commit 38606f1
Show file tree
Hide file tree
Showing 15 changed files with 138 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/Charts/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Chart
*/
public $events;
/**
* @var boolean
* @var bool
*/
public $archived;
/**
Expand Down
8 changes: 4 additions & 4 deletions src/Charts/ChartListParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ class ChartListParams
public $tag;

/**
* @var boolean
* @var bool
*/
public $expandEvents;

/**
* @var boolean
* @var bool
*/
public $expandValidation;

/**
* @var boolean
* @var bool
*/
public $expandVenueType;

/**
* @var boolean
* @var bool
*/
public $expandZones;

Expand Down
2 changes: 1 addition & 1 deletion src/Events/BestAvailableObjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BestAvailableObjects
*/
public $objectDetails;
/**
* @var boolean
* @var bool
*/
public $nextToEachOther;

Expand Down
72 changes: 72 additions & 0 deletions src/Events/BestAvailableParams.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace Seatsio\Events;

class BestAvailableParams
{
/**
* @var int
*/
public $number;

/**
* @var string[]
*/
public $categories;

/**
* @var string
*/
public $zone;

/**
* @var array
*/
public $extraData;

/**
* @var string[]
*/
public $ticketTypes;

/**
* @var bool
*/
public $tryToPreventOrphanSeats;

public function setNumber(int $number): self
{
$this->number = $number;
return $this;
}

public function setCategories(array $categories): self
{
$this->categories = $categories;
return $this;
}

public function setZone(string $zone): self
{
$this->zone = $zone;
return $this;
}

public function setExtraData(array $extraData): self
{
$this->extraData = $extraData;
return $this;
}

public function setTicketTypes(array $ticketTypes): self
{
$this->ticketTypes = $ticketTypes;
return $this;
}

public function setTryToPreventOrphanSeats(bool $tryToPreventOrphanSeats): self
{
$this->tryToPreventOrphanSeats = $tryToPreventOrphanSeats;
return $this;
}
}
2 changes: 1 addition & 1 deletion src/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Event
public $date;

/**
* @var boolean
* @var bool
*/
public $supportsBestAvailable;

Expand Down
12 changes: 6 additions & 6 deletions src/Events/EventObjectInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class EventObjectInfo
*/
public $orderId;
/**
* @var boolean
* @var bool
*/
public $forSale;
/**
Expand Down Expand Up @@ -88,15 +88,15 @@ class EventObjectInfo
*/
public $extraData;
/**
* @var boolean
* @var bool
*/
public $isAccessible;
/**
* @var boolean
* @var bool
*/
public $isCompanionSeat;
/**
* @var boolean
* @var bool
*/
public $hasRestrictedView;
/**
Expand All @@ -112,7 +112,7 @@ class EventObjectInfo
*/
public $rightNeighbour;
/**
* @var boolean
* @var bool
*/
public $isAvailable;
/**
Expand All @@ -136,7 +136,7 @@ class EventObjectInfo
*/
public $numSeats;
/**
* @var boolean
* @var bool
*/
public $variableOccupancy;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Events/EventParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class EventParams
public $date;

/**
* @var boolean|object|array
* @var bool|object|array
*/
public $tableBookingConfig;

Expand Down
40 changes: 18 additions & 22 deletions src/Events/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,11 @@ public function book($eventKeyOrKeys, $objectOrObjects, string $holdToken = null
}

/**
* @param $categories string[]|null
* @param $ticketTypes string[]|null
* @param $channelKeys string[]|null
*/
public function bookBestAvailable(string $eventKey, int $number, array $categories = null, string $holdToken = null, array $extraData = null, array $ticketTypes = null, string $orderId = null, bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null): BestAvailableObjects
public function bookBestAvailable(string $eventKey, BestAvailableParams $bestAvailableParams, string $holdToken = null, string $orderId = null, bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null): BestAvailableObjects
{
return $this::changeBestAvailableObjectStatus($eventKey, $number, EventObjectInfo::$BOOKED, $categories, $holdToken, $extraData, $ticketTypes, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
return $this::changeBestAvailableObjectStatus($eventKey, $bestAvailableParams, EventObjectInfo::$BOOKED, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
}

/**
Expand All @@ -482,38 +480,36 @@ public function hold($eventKeyOrKeys, $objectOrObjects, string $holdToken, strin
}

/**
* @param $categories string[]|null
* @param $ticketTypes string[]|null
* @param $channelKeys string[]|null
*/
public function holdBestAvailable(string $eventKey, int $number, string $holdToken, array $categories = null, array $extraData = null, array $ticketTypes = null, string $orderId = null, bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null): BestAvailableObjects
public function holdBestAvailable(string $eventKey,BestAvailableParams $bestAvailableParams, string $holdToken, string $orderId = null, bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null): BestAvailableObjects
{
return $this::changeBestAvailableObjectStatus($eventKey, $number, EventObjectInfo::$HELD, $categories, $holdToken, $extraData, $ticketTypes, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
return $this::changeBestAvailableObjectStatus($eventKey, $bestAvailableParams, EventObjectInfo::$HELD, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
}

/**
* @param $categories string[]|null
* @param $ticketTypes string[]|null
* @param $channelKeys string[]|null
*/
public function changeBestAvailableObjectStatus(string $eventKey, int $number, string $status, array $categories = null, string $holdToken = null, array $extraData = null, array $ticketTypes = null, string $orderId = null, bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null, bool $tryToPreventOrphanSeats = null): BestAvailableObjects
public function changeBestAvailableObjectStatus(string $eventKey, BestAvailableParams $bestAvailableParams, string $status, string $holdToken = null, string $orderId = null, bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null): BestAvailableObjects
{
$request = new stdClass();
$bestAvailable = new stdClass();
$bestAvailable->number = $number;
if ($categories !== null) {
$bestAvailable->categories = $categories;
$request->bestAvailable = new stdClass();
$request->bestAvailable->number = $bestAvailableParams->number;
if ($bestAvailableParams->categories !== null) {
$request->bestAvailable->categories = $bestAvailableParams->categories;
}
if ($bestAvailableParams->extraData != null) {
$request->bestAvailable->extraData = $bestAvailableParams->extraData;
}
if ($extraData != null) {
$bestAvailable->extraData = $extraData;
if ($bestAvailableParams->ticketTypes !== null) {
$request->bestAvailable->ticketTypes = $bestAvailableParams->ticketTypes;
}
if ($ticketTypes !== null) {
$bestAvailable->ticketTypes = $ticketTypes;
if ($bestAvailableParams->tryToPreventOrphanSeats !== null) {
$request->bestAvailable->tryToPreventOrphanSeats = $bestAvailableParams->tryToPreventOrphanSeats;
}
if ($tryToPreventOrphanSeats !== null) {
$bestAvailable->tryToPreventOrphanSeats = $tryToPreventOrphanSeats;
if ($bestAvailableParams->zone !== null) {
$request->bestAvailable->zone = $bestAvailableParams->zone;
}
$request->bestAvailable = $bestAvailable;
$request->status = $status;
if ($holdToken !== null) {
$request->holdToken = $holdToken;
Expand Down
2 changes: 1 addition & 1 deletion src/Events/ForSaleConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class ForSaleConfig
{
/**
* @var boolean
* @var bool
*/
public $forSale;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Events/StatusChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class StatusChange
*/
public $origin;
/**
* @var boolean
* @var bool
*/
public $isPresentOnChart;
/**
Expand Down
4 changes: 2 additions & 2 deletions src/Events/StatusChangeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class StatusChangeRequest
public $orderId;

/**
* @var boolean
* @var bool
*/
public $keepExtraData;

/**
* @var boolean
* @var bool
*/
public $ignoreChannels;

Expand Down
2 changes: 1 addition & 1 deletion src/Reports/Usage/DetailsForMonth/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Event
public $key;

/**
* @var boolean
* @var bool
*/
public $deleted;

Expand Down
2 changes: 1 addition & 1 deletion src/Seasons/SeasonCreationParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SeasonCreationParams
public $numberOfEvents;

/**
* @var boolean|object|array
* @var bool|object|array
*/
public $tableBookingConfig;

Expand Down
6 changes: 3 additions & 3 deletions src/Workspaces/Workspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ class Workspace
public $secretKey;

/**
* @var boolean
* @var bool
*/
public $isTest;

/**
* @var boolean
* @var bool
*/
public $isDefault;

/**
* @var boolean
* @var bool
*/
public $isActive;

Expand Down
Loading

0 comments on commit 38606f1

Please sign in to comment.