Skip to content

Commit

Permalink
instead of passing in FREE as a status, we now use RELEASE as statusC…
Browse files Browse the repository at this point in the history
…hangeCommand type. (#128)
  • Loading branch information
bverbeken authored Oct 4, 2024
1 parent fe4e9ae commit f9b66a0
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Events/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,23 @@ public function retrieveObjectInfos(string $eventKey, array $objectLabels): arra
public function changeObjectStatus($eventKeyOrKeys, $objectOrObjects, string $status, string $holdToken = null, string $orderId = null,
bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null,
array $allowedPreviousStatuses = null, array $rejectedPreviousStatuses = null): ChangeObjectStatusResult
{
return $this->changeObjectStatusWithType($eventKeyOrKeys, $objectOrObjects, "CHANGE_STATUS_TO", $status, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys, $allowedPreviousStatuses, $rejectedPreviousStatuses);
}

private function changeObjectStatusWithType(
$eventKeyOrKeys, $objectOrObjects, string $statusChangeCommandType, string $status = null, string $holdToken = null, string $orderId = null,
bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null,
array $allowedPreviousStatuses = null, array $rejectedPreviousStatuses = null): ChangeObjectStatusResult
{
$request = new stdClass();
$request->objects = self::normalizeObjects($objectOrObjects);
$request->status = $status;
if ($statusChangeCommandType != null) {
$request->type = $statusChangeCommandType;
}
if ($status != null) {
$request->status = $status;
}
if ($holdToken !== null) {
$request->holdToken = $holdToken;
}
Expand Down Expand Up @@ -466,7 +479,7 @@ public function bookBestAvailable(string $eventKey, BestAvailableParams $bestAva
*/
public function release($eventKeyOrKeys, $objectOrObjects, string $holdToken = null, string $orderId = null, bool $keepExtraData = null, bool $ignoreChannels = null, array $channelKeys = null): ChangeObjectStatusResult
{
return $this::changeObjectStatus($eventKeyOrKeys, $objectOrObjects, EventObjectInfo::$FREE, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
return $this::changeObjectStatusWithType($eventKeyOrKeys, $objectOrObjects, "RELEASE", null, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
}

/**
Expand All @@ -482,7 +495,7 @@ public function hold($eventKeyOrKeys, $objectOrObjects, string $holdToken, strin
/**
* @param $channelKeys string[]|null
*/
public function holdBestAvailable(string $eventKey,BestAvailableParams $bestAvailableParams, string $holdToken, 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, $bestAvailableParams, EventObjectInfo::$HELD, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
}
Expand Down

0 comments on commit f9b66a0

Please sign in to comment.