# MTS Specifics

## Sending tickets to MTS

In general, MTS will reject all tickets that contain selections from Sim-Play producers.

### Ticket filter

MTS will reject all tickets that contain selections from Sim-Play producers.

To avoid ticket rejection on MTS side, please avoid sending tickets with selections from Sim-Play producers to MTS.

If a punter tries to place a bet that contains a selection for a Sim-Play match, the bet should be rejected on your side and should not be sent to MTS. MTS will also reject mixed tickets (multiples, systems where one or more selections are Sim-Play) are neither supported.

{% hint style="success" %}
Make it configurable - do not hard code the logic for rejecting Sim-Play selections. Selections from Sim-Play producers can be easily identified based on producer ID or based on URN of the related sports event. Producer IDs and URNs can found in the [General section of the Sim-Play Sports documentation](https://docs.sportradar.com/games/simplay-sports/general-information)
{% endhint %}

### SDK examples for filtering Sim-Play selections

#### .NET SDK

<pre class="language-csharp"><code class="lang-csharp">var config = MtsSdk.GetConfiguration();
_mtsSdk = new MtsSdk(config);
AttachToFeedEvents(_mtsSdk);
_mtsSdk.Open();
_factory = _mtsSdk.BuilderFactory;
// selections from punter's ticket
List&#x3C;Selection> selectionList = new List&#x3C;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
<strong>// rejected by MTS
</strong>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 it
</code></pre>

#### Java SDK

```java
// selections from punter's ticket
ArrayList<PunterSelection> punterSelections = new ArrayList<PunterSelection>();

// event URN, producer, sport URN, market ID, outcome ID, specifiers, sportEventStatus,
// odds
punterSelections.add(new PunterSelection("sr:match:21786073", 3, "sr:sport:1", 1, "1",
null, null, 10100));
punterSelections.add(new PunterSelection("vf:match:1223448422", 6, "sr:sport:1", 1,
"1", null, null, 12000));
punterSelections.add(new PunterSelection("sr:match:21768853", 1, "sr:sport:1", 1, "1",
null, null, 11500));
// define whether mixed tickets should be allowed or not
boolean allowMixedVirtualTickets = false;
SdkConfiguration config = MtsSdk.getConfiguration();
MtsSdkApi mtsSdk = new MtsSdk(config);
mtsSdk.open();
BuilderFactory builderFactory = mtsSdk.getBuilderFactory();
TicketSender ticketSender = mtsSdk.getTicketSender(new
TicketResponseHandler(ticketCancelSender, ticketAckSender, builderFactory));
TicketBuilder ticketBuilder = builderFactory.createTicketBuilder()
// add all the required parameters (sender, etc.)
.setTicketId("T-" + System.currentTimeMillis());
BetBuilder betBuilder = builderFactory.createBetBuilder()
// add all the required parameters (selectedSystem, stake, etc.)
.setBetId("Bet-" + System.currentTimeMillis());
SelectionBuilder selectionBuilder = builderFactory.createSelectionBuilder();

// method 1 - filter based on producer ID

ArrayList<Integer> validMTSProducers = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 14,
16)){}; // list of producers which MTS can work with
// 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
for(PunterSelection punterSelection : punterSelections) {
    punterProducerID = punterSelection.getProducer().getID();
    // if the producer is not a valid MTS producer and mixed tickets are not allowed
    if(!validMTSProducers.contains(punterProducerID) && !allowMixedVirtualTickets) {
        // 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");
        break;
    }
    // if the producer is a valid MTS producer or mixed tickets are allowed
    else {
        // add selection to the bet
        Selection selection = selectionBuilder.setEventId("11608059")
        // add all the required parameters (id, odds, banker, etc.)
        .build();
        betBuilder.addSelection(selection);
    }
}
// if no exception was thrown, build the ticket and send it

// method 2 - filter based on URN of the sport event

String validMTSPrefix = "sr";
// if prefix of the related sport event is anything other than sr, ticket will be
rejected by MTS
for(PunterSelection punterSelection : punterSelections) {
    URN sportEventURN = URN.parse(punterSelection.getEvent.getID());
    // if the prefix is not a valid MTS prefix and mixed tickets are not allowed
    if(!sportEventURN.getPrefix().equals(validPrefix) && !allowMixedVirtualTickets) {
        // 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");
        break;
    }
    // if the prefix is a valid MTS prefix or mixed tickets are allowed
    else {
        // add selection to the bet
        Selection selection = selectionBuilder.setEventId("11608059")
        // add all the required parameters (id, odds, banker, etc.)
        .build();
        betBuilder.addSelection(selection);
    }
}
// if no exception was thrown, build the ticket and send it
```
