From 2f7b46c1564ef5248cc6711554b19a0509018eea Mon Sep 17 00:00:00 2001 From: Ben Verbeken Date: Fri, 4 Oct 2024 11:31:27 +0200 Subject: [PATCH] add methods to put up objects for resale (#132) --- src/Events/EventObjectInfo.php | 1 + src/Events/Events.php | 10 ++++++ tests/Events/PutObjectsUpForResaleTest.php | 39 ++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 tests/Events/PutObjectsUpForResaleTest.php diff --git a/src/Events/EventObjectInfo.php b/src/Events/EventObjectInfo.php index 010cb06..33c7d73 100644 --- a/src/Events/EventObjectInfo.php +++ b/src/Events/EventObjectInfo.php @@ -7,6 +7,7 @@ class EventObjectInfo public static $HELD = "reservedByToken"; public static $BOOKED = "booked"; public static $FREE = "free"; + public static $RESALE = "resale"; /** * @var string */ diff --git a/src/Events/Events.php b/src/Events/Events.php index dfb9432..f8df763 100644 --- a/src/Events/Events.php +++ b/src/Events/Events.php @@ -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 diff --git a/tests/Events/PutObjectsUpForResaleTest.php b/tests/Events/PutObjectsUpForResaleTest.php new file mode 100644 index 0000000..3855b6c --- /dev/null +++ b/tests/Events/PutObjectsUpForResaleTest.php @@ -0,0 +1,39 @@ +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); + } + +}