MTS Specifics
Sending tickets to MTS
Ticket filter
SDK examples for filtering Sim-Play selections
.NET SDK
var config = MtsSdk.GetConfiguration();
_mtsSdk = new MtsSdk(config);
AttachToFeedEvents(_mtsSdk);
_mtsSdk.Open();
_factory = _mtsSdk.BuilderFactory;
// selections from punter's ticket
List<Selection> selectionList = new List<Selection>
{
// event URN, producer, sport URN, market ID, outcome ID, specifiers,
// sportEventStatus, odds
new Selection { matchId = "sr:match:21786073", product = 3, sportId =
"sr:sport:1",marketId = 1, selectionId = "1", specifiers = null, sportEventStatus =
null, matchOdds = 10100 },
new Selection { matchId = "vf:match:1223448422", product = 6, sportId =
"sr:sport:1",marketId = 1, selectionId = "1", specifiers = null, sportEventStatus =
null, matchOdds = 12000 },
new Selection { matchId = "sr:match:21768853", product = 3, sportId =
"sr:sport:1",marketId = 1, selectionId = "1", specifiers = null, sportEventStatus =
null, matchOdds = 12000 }
};
// define whether mixed tickets should be allowed or not
bool allowMixedVirtualTickets = false;
// method 1 - filter based on producer ID
int[] producers = { 1, 2, 3, 4, 5, 14, 16}; // Producers array contains producers where
tickets should be sent to MTS
// check the producer on each selection of the ticket you're trying to build
// if the producer on the selection is not valid for MTS, raise an error
foreach (var selection in selectionList)
{
// if the producer is a valid MTS producer or mixed tickets are allowed
if (producers.Contains(product) || allowMixedVirtualTickets)
{
// build selection
bet.AddSelection(_builderFactory.CreateSelectionBuilder().Build());
}
// if the producer is not a valid MTS producer and mixed tickets are not allowed
else
{
// DO NOT send the ticket to MTS and reject the ticket to the punter
throw new MixedTicketException("Ticket contains a selection from virtual
producers and cannot be accepted");
}
}
// if no exception was thrown, build the ticket and send it
// method 2 - filter based on URN of the sport event
string validPrefix = "sr";
// if prefix of the related sport event is anything other than sr, ticket will be
// rejected by MTS
foreach (var selection in selectionList)
{
// if the producer is a valid MTS producer or mixed tickets are allowed
if ((eventId.Trim().StartsWith(validPrefix)) || allowMixedVirtualTickets)
{
// build selection
bet.AddSelection(_builderFactory.CreateSelectionBuilder()
.Build());
}
// if the producer is not a valid MTS producer and mixed tickets are not allowed
else
{
// DO NOT send the ticket to MTS and reject the ticket to the punter
throw new MixedTicketException("Ticket contains a selection from virtual
producers and cannot be accepted");
}
}
// if no exception was thrown, build the ticket and send itJava SDK
Last updated
Was this helpful?