Skip to content

Commit

Permalink
add methods to put up objects for resale (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
bverbeken authored Oct 4, 2024
1 parent f9b66a0 commit 2f7b46c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Events/EventObjectInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class EventObjectInfo
public static $HELD = "reservedByToken";
public static $BOOKED = "booked";
public static $FREE = "free";
public static $RESALE = "resale";
/**
* @var string
*/
Expand Down
10 changes: 10 additions & 0 deletions src/Events/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,16 @@ public function bookBestAvailable(string $eventKey, BestAvailableParams $bestAva
return $this::changeBestAvailableObjectStatus($eventKey, $bestAvailableParams, EventObjectInfo::$BOOKED, $holdToken, $orderId, $keepExtraData, $ignoreChannels, $channelKeys);
}

/**
* @param $eventKeyOrKeys string|string[]
* @param $objectOrObjects mixed
* @return ChangeObjectStatusResult
*/
public function putUpForResale($eventKeyOrKeys, $objectOrObjects)
{
return $this::changeObjectStatus($eventKeyOrKeys, $objectOrObjects, EventObjectInfo::$RESALE, null, null, null, null, null, null);
}

/**
* @param $eventKeyOrKeys string|string[]
* @param $objectOrObjects mixed
Expand Down
39 changes: 39 additions & 0 deletions tests/Events/PutObjectsUpForResaleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Seatsio\Charts;

use Seatsio\Events\EventObjectInfo;
use Seatsio\SeatsioClientTest;

class PutObjectsUpForResaleTest extends SeatsioClientTest
{

public function test()
{
$chartKey = $this->createTestChart();
$event = $this->seatsioClient->events->create($chartKey);

$res = $this->seatsioClient->events->putUpForResale($event->key, ["A-1", "A-2"]);

self::assertEquals(EventObjectInfo::$RESALE, $this->seatsioClient->events->retrieveObjectInfo($event->key, "A-1")->status);
self::assertEquals(EventObjectInfo::$RESALE, $this->seatsioClient->events->retrieveObjectInfo($event->key, "A-2")->status);

self::assertEquals(["A-1", "A-2"], SeatsioClientTest::sort(array_keys($res->objects)));
}

public function testMultipleEvents()
{
$chartKey = $this->createTestChart();
$event1 = $this->seatsioClient->events->create($chartKey);
$event2 = $this->seatsioClient->events->create($chartKey);

$res = $this->seatsioClient->events->putUpForResale([$event1->key, $event2->key], "A-1");

$objectInfo1 = $this->seatsioClient->events->retrieveObjectInfo($event1->key, "A-1");
self::assertEquals(EventObjectInfo::$RESALE, $objectInfo1->status);

$objectInfo2 = $this->seatsioClient->events->retrieveObjectInfo($event2->key, "A-1");
self::assertEquals(EventObjectInfo::$RESALE, $objectInfo2->status);
}

}

0 comments on commit 2f7b46c

Please sign in to comment.