Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add methods to put up objects for resale #202

Merged
merged 5 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/seatsio/events/EventObjectInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/seatsio/events/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -260,6 +259,14 @@ public ChangeObjectStatusResult hold(List<String> 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<String> 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);
}
Expand Down
40 changes: 40 additions & 0 deletions src/test/java/seatsio/events/PutUpForResaleTest.java
Original file line number Diff line number Diff line change
@@ -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");
}

}
Loading