diff --git a/src/main/java/seatsio/events/EventObjectInfo.java b/src/main/java/seatsio/events/EventObjectInfo.java index 272e984..3fa95e1 100644 --- a/src/main/java/seatsio/events/EventObjectInfo.java +++ b/src/main/java/seatsio/events/EventObjectInfo.java @@ -20,6 +20,7 @@ public class EventObjectInfo extends ValueObject { public static final String FREE = "free"; public static final String BOOKED = "booked"; public static final String HELD = "reservedByToken"; + public static final String RESALE = "resale"; public String status; public String label; diff --git a/src/main/java/seatsio/events/Events.java b/src/main/java/seatsio/events/Events.java index ca3ffe8..d735b17 100644 --- a/src/main/java/seatsio/events/Events.java +++ b/src/main/java/seatsio/events/Events.java @@ -15,8 +15,7 @@ import static java.util.Collections.singletonList; import static java.util.stream.Collectors.toList; -import static seatsio.events.EventObjectInfo.BOOKED; -import static seatsio.events.EventObjectInfo.HELD; +import static seatsio.events.EventObjectInfo.*; import static seatsio.json.JsonArrayBuilder.aJsonArray; import static seatsio.json.JsonObjectBuilder.aJsonObject; import static seatsio.json.SeatsioGson.gson; @@ -260,6 +259,14 @@ public ChangeObjectStatusResult hold(List eventKeys, List objects, St return changeObjectStatus(eventKeys, objects, HELD, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys); } + public ChangeObjectStatusResult putUpForResale(String eventKey, List objects) { + return changeObjectStatus(eventKey, objects, RESALE, null, null, null, null, null); + } + + public ChangeObjectStatusResult putUpForResale(List eventKeys, List objects) { + return changeObjectStatus(eventKeys, objects, RESALE, null, null, null, null, null); + } + public ChangeObjectStatusResult release(String eventKey, List objects) { return release(eventKey, objects, null, null, null, null, null); } diff --git a/src/test/java/seatsio/events/PutUpForResaleTest.java b/src/test/java/seatsio/events/PutUpForResaleTest.java new file mode 100644 index 0000000..c9cc7b0 --- /dev/null +++ b/src/test/java/seatsio/events/PutUpForResaleTest.java @@ -0,0 +1,40 @@ +package seatsio.events; + +import org.junit.jupiter.api.Test; +import seatsio.SeatsioClientTest; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static seatsio.events.EventObjectInfo.RESALE; + +public class PutUpForResaleTest extends SeatsioClientTest { + + @Test + public void putUpForResaleForSingleEvent() { + String chartKey = createTestChart(); + Event event = client.events.create(chartKey); + + ChangeObjectStatusResult result = client.events.putUpForResale(event.key, List.of("A-1", "A-2")); + + assertThat(client.events.retrieveObjectInfo(event.key, "A-1").status).isEqualTo(RESALE); + assertThat(client.events.retrieveObjectInfo(event.key, "A-2").status).isEqualTo(RESALE); + assertThat(result.objects).containsOnlyKeys("A-1", "A-2"); + } + + @Test + public void putUpForResaleForEventGroup() { + String chartKey = createTestChart(); + Event event1 = client.events.create(chartKey); + Event event2 = client.events.create(chartKey); + + ChangeObjectStatusResult result = client.events.putUpForResale(List.of(event1.key, event2.key), List.of("A-1", "A-2")); + + assertThat(client.events.retrieveObjectInfo(event1.key, "A-1").status).isEqualTo(RESALE); + assertThat(client.events.retrieveObjectInfo(event1.key, "A-2").status).isEqualTo(RESALE); + assertThat(client.events.retrieveObjectInfo(event2.key, "A-1").status).isEqualTo(RESALE); + assertThat(client.events.retrieveObjectInfo(event2.key, "A-2").status).isEqualTo(RESALE); + assertThat(result.objects).containsOnlyKeys("A-1", "A-2"); + } + +}