View Javadoc
1   package org.oxerr.vividseats.client.rescu.impl;
2   
3   import java.io.IOException;
4   import java.util.List;
5   import java.util.function.Supplier;
6   
7   import org.oxerr.vividseats.client.ListingService;
8   import org.oxerr.vividseats.client.model.BrokerListing;
9   import org.oxerr.vividseats.client.model.v1.Update;
10  import org.oxerr.vividseats.client.rescu.resource.ListingResource;
11  
12  public class ListingServiceImpl implements ListingService {
13  
14  	private final Supplier<String> tokenSupplier;
15  
16  	private final org.oxerr.vividseats.client.rescu.resource.v1.ListingResource listingResourceV1;
17  
18  	private final ListingResource listingResource;
19  
20  	public ListingServiceImpl(
21  		Supplier<String> tokenSupplier,
22  		org.oxerr.vividseats.client.rescu.resource.v1.ListingResource listingResourceV1,
23  		ListingResource listingResource
24  	) {
25  		this.tokenSupplier = tokenSupplier;
26  		this.listingResourceV1 = listingResourceV1;
27  		this.listingResource = listingResource;
28  	}
29  
30  	@Override
31  	public List<BrokerListing> get(
32  		Long listingId,
33  		String internalTicketId,
34  		Integer productionId,
35  		String fromEventDate,
36  		String toEventDate,
37  		Integer headlinerId,
38  		Boolean includeFiles
39  	) throws IOException {
40  		return listingResource.get(fromEventDate, toEventDate, listingId, internalTicketId, productionId, headlinerId, includeFiles).getListings();
41  	}
42  
43  	@Override
44  	public BrokerListing create(BrokerListing brokerListing) throws IOException {
45  		return listingResource.create(brokerListing).getListing();
46  	}
47  
48  	@Override
49  	public void updateListing(Update update) throws IOException {
50  		listingResourceV1.updateListing(
51  			this.tokenSupplier.get(),
52  			update.getTicketId(),
53  			update.getQuantity(),
54  			update.getSection(),
55  			update.getRow(),
56  			update.getSeatFrom(),
57  			update.getSeatThru(),
58  			update.getNotes(),
59  			update.getPrice(),
60  			update.getElectronic(),
61  			update.getInHandDate(),
62  			update.getSplitType(),
63  			update.getSplitValue(),
64  			update.getBarcode(),
65  			update.getFaceValue(),
66  			update.getUnitTaxedCost()
67  		);
68  	}
69  
70  	@Override
71  	public void update(BrokerListing brokerListing) throws IOException {
72  		listingResource.update(brokerListing);
73  	}
74  
75  	@Override
76  	public void deleteListing(String ticketId) throws IOException {
77  		this.listingResourceV1.deleteListing(this.tokenSupplier.get(), ticketId);
78  	}
79  
80  	@Override
81  	public void delete(Long listingId, String internalTicketId) throws IOException {
82  		listingResource.delete(listingId, internalTicketId);
83  	}
84  
85  }