/// <summary> /// Initializes a new instance of the <see cref="TicketResponseReceivedEventArgs"/> class /// </summary> /// <param name="response">a <see cref="ISdkTicket"/> representing the received response</param> public TicketResponseReceivedEventArgs(ISdkTicket response) { Guard.Argument(response, nameof(response)).NotNull(); Response = response; Type = MtsTicketHelper.Convert(response); }
/// <summary> /// Initializes a new instance of the <see cref="BetDetail"/> class /// </summary> /// <param name="betDetail">The bet detail</param> public BetDetail(Anonymous2 betDetail) { Guard.Argument(betDetail, nameof(betDetail)).NotNull(); BetId = betDetail.BetId; if (betDetail.Reason != null) { Reason = new ResponseReason(betDetail.Reason.Code, betDetail.Reason.Message); } if (betDetail.AlternativeStake != null && betDetail.AlternativeStake.Stake > 0) { AlternativeStake = new AlternativeStake(betDetail.AlternativeStake.Stake); } if (betDetail.SelectionDetails != null && betDetail.SelectionDetails.Any()) { SelectionDetails = betDetail.SelectionDetails.ToList().ConvertAll(s => new SelectionDetail(s.SelectionIndex, new ResponseReason(s.Reason.Code, s.Reason.Message), s.RejectionInfo == null ? null : new RejectionInfo(s.RejectionInfo.Id, s.RejectionInfo.EventId, s.RejectionInfo.Odds))); } if (betDetail.Reoffer != null && betDetail.Reoffer.Stake > 0) { Reoffer = new BetReoffer(betDetail.Reoffer.Stake, MtsTicketHelper.Convert(betDetail.Reoffer.Type)); } }
public TicketReofferCancelDTO(ITicketReofferCancel ticket) { _timestampUtc = MtsTicketHelper.Convert(ticket.Timestamp); _ticketId = ticket.TicketId; _version = ticket.Version; _sender = new Sender(ticket.BookmakerId); }
public TicketNonSrSettleDTO(ITicketNonSrSettle ticket) { _timestampUtc = MtsTicketHelper.Convert(ticket.Timestamp); _ticketId = ticket.TicketId; _nonSrSettleStake = ticket.NonSrSettleStake; _version = ticket.Version; _sender = new Sender(ticket.BookmakerId); }
public TicketCancelAckDTO(ITicketCancelAck ticket) { _ticketId = ticket.TicketId; _ticketCancelStatus = MtsTicketHelper.Convert(ticket.TicketCancelStatus); _code = ticket.Code; _message = ticket.Message; _timestampUtc = MtsTicketHelper.Convert(ticket.Timestamp); _version = ticket.Version; _sender = new Sender(ticket.BookmakerId); }
public TicketAckDTO(string ticketId, int bookmakerId, TicketAckStatus ackStatus, string message, int code, DateTime timestamp, string version) { TicketId = ticketId; Sender = new Sender(bookmakerId); Code = code; Message = message; TicketStatus = MtsTicketHelper.Convert(ackStatus); TimestampUtc = MtsTicketHelper.Convert(timestamp); Version = version; }
public TicketAckDTO(ITicketAck ticket) { TicketId = ticket.TicketId; Sender = new Sender(ticket.BookmakerId); Code = ticket.Code; Message = ticket.Message; TicketStatus = MtsTicketHelper.Convert(ticket.TicketStatus); TimestampUtc = MtsTicketHelper.Convert(ticket.Timestamp); Version = ticket.Version; }
//public Cancel(long timestamp, string ticketId, int bookmakerId, int code, string version) //{ // _timestampUtc = timestamp; // _ticketId = ticketId; // _code = code; // _version = version; // _sender = new Sender(bookmakerId); //} public Cancel(ITicketCancel ticket) { _timestampUtc = MtsTicketHelper.Convert(ticket.Timestamp); _ticketId = ticket.TicketId; _code = (int)ticket.Code; _version = ticket.Version; _sender = new Sender(ticket.BookmakerId); _cancelPercent = ticket.CancelPercent; _betCancel = ticket.BetCancels?.ToList().ConvertAll(c => new Anonymous(c)); }
public TicketCashoutDTO(ITicketCashout ticket) { _timestampUtc = MtsTicketHelper.Convert(ticket.Timestamp); _ticketId = ticket.TicketId; _cashoutStake = ticket.CashoutStake; _version = ticket.Version; _sender = new Sender(ticket.BookmakerId); _cashoutPercent = ticket.CashoutPercent; _betCashout = ticket.BetCashouts?.ToList().ConvertAll(c => new Anonymous(c)); }
public static void Compare(ITicketReofferCancel ticket, TicketReofferCancelDTO dto) { Assert.IsTrue(ticket != null); Assert.IsTrue(dto != null); Assert.AreEqual(ticket.TicketId, dto.TicketId); Assert.AreEqual(ticket.BookmakerId, dto.Sender.BookmakerId); Assert.AreEqual(MtsTicketHelper.Convert(ticket.Timestamp), dto.TimestampUtc); Assert.AreEqual(ticket.Version, dto.Version); Assert.IsFalse(string.IsNullOrEmpty(ticket.CorrelationId)); }
internal static void Compare(ITicketCashout ticket, TicketCashoutDTO dto) { Assert.IsTrue(ticket != null); Assert.IsTrue(dto != null); Assert.AreEqual(ticket.TicketId, dto.TicketId); Assert.AreEqual(ticket.BookmakerId, dto.Sender.BookmakerId); Assert.AreEqual(MtsTicketHelper.Convert(ticket.Timestamp), dto.TimestampUtc); Assert.AreEqual(ticket.Version, dto.Version); Assert.AreEqual(ticket.CashoutStake, dto.CashoutStake); Assert.IsFalse(string.IsNullOrEmpty(ticket.CorrelationId)); }
/// <summary> /// Maps the specified source. /// </summary> /// <param name="source">The source</param> /// <param name="correlationId">The correlation id of the response</param> /// <param name="orgJson">The original json string received from the mts</param> /// <param name="additionalInfo">The additional information</param> /// <returns>TicketNonSrSettleResponse</returns> public ITicketNonSrSettleResponse Map(TicketNonSrSettleResponseDTO source, string correlationId, IDictionary <string, string> additionalInfo, string orgJson) { return(new TicketNonSrSettleResponse(_ticketSender, source.Result.TicketId, MtsTicketHelper.Convert(source.Result.Status), new ResponseReason(source.Result.Reason.Code, source.Result.Reason.Message), correlationId, source.Signature, source.Version, additionalInfo, orgJson)); }
public static void Compare(ITicketNonSrSettleResponse ticket, TicketNonSrSettleResponseDTO dto) { Assert.IsTrue(ticket != null); Assert.IsTrue(dto != null); Assert.AreEqual(ticket.TicketId, dto.Result.TicketId); Assert.AreEqual(ticket.Signature, dto.Signature); Assert.AreEqual(ticket.Version, dto.Version); Assert.AreEqual(ticket.Status, MtsTicketHelper.Convert(dto.Result.Status)); Assert.AreEqual(ticket.Reason.Code, dto.Result.Reason.Code); Assert.AreEqual(ticket.Reason.Message, dto.Result.Reason.Message); Assert.IsFalse(string.IsNullOrEmpty(ticket.CorrelationId)); }
public static void Compare(ITicketResponse ticket, TicketResponseDTO dto) { Assert.IsTrue(ticket != null); Assert.IsTrue(dto != null); Assert.AreEqual(ticket.TicketId, dto.Result.TicketId); Assert.AreEqual(ticket.Status, MtsTicketHelper.Convert(dto.Result.Status)); Assert.AreEqual(ticket.Signature, dto.Signature); Assert.AreEqual(ticket.ExchangeRate, dto.ExchangeRate); Assert.AreEqual(ticket.Version, dto.Version); Assert.AreEqual(ticket.Reason.Code, dto.Result.Reason.Code); Assert.AreEqual(ticket.Reason.Message, dto.Result.Reason.Message); Assert.IsNull(ticket.Reason.InternalMessage); if (ticket.BetDetails == null || !ticket.BetDetails.Any()) { return; } for (var i = 0; i < ticket.BetDetails.Count(); i++) { var bd1 = ticket.BetDetails.ToList()[i]; var bd2 = dto.Result.BetDetails.ToList()[i]; Compare(bd1.Reason, bd2.Reason); Assert.AreEqual(bd1.BetId, bd2.BetId); if (bd1.AlternativeStake != null) { Assert.AreEqual(bd1.AlternativeStake.Stake, bd2.AlternativeStake.Stake); } if (bd1.Reoffer != null) { Assert.AreEqual(bd1.Reoffer.Stake, bd2.Reoffer.Stake); Assert.AreEqual(bd1.Reoffer.Type, MtsTicketHelper.Convert(bd2.Reoffer.Type)); } if (bd2.SelectionDetails != null && bd2.SelectionDetails.Any()) { for (var j = 0; j < bd2.SelectionDetails.Count(); j++) { Compare(bd1.SelectionDetails.ToList()[i].Reason, bd2.SelectionDetails.ToList()[i].Reason); Assert.AreEqual(bd1.SelectionDetails.ToList()[i].SelectionIndex, bd2.SelectionDetails.ToList()[i].SelectionIndex); if (bd2.SelectionDetails.ToList()[i].RejectionInfo != null) { Compare(bd1.SelectionDetails.ToList()[i].RejectionInfo, bd2.SelectionDetails.ToList()[i].RejectionInfo); } } } } Assert.IsFalse(string.IsNullOrEmpty(ticket.CorrelationId)); }
/// <summary> /// Initializes a new instance of the <see cref="Ticket"/> class /// </summary> /// <param name="ticketId">The ticket identifier</param> /// <param name="sender">The sender</param> /// <param name="bets">The bets</param> /// <param name="selections">The selections</param> /// <param name="oddsChange">The odds change</param> /// <param name="isTestSource">if set to <c>true</c> [is test source]</param> /// <param name="timestamp">The timestamp</param> /// <param name="version">The version</param> /// <param name="reofferRefId">The reoffer reference id</param> /// <param name="altStakeRefId">The alternative stake reference id</param> /// <param name="totalCombinations">Expected total number of generated combinations on this ticket (optional, default null). If present is used to validate against actual number of generated combinations</param> /// <param name="lastMatchEndTime">Time of last non-sportradar selection on ticket</param> public Ticket(string ticketId, Sender sender, IEnumerable <Anonymous> bets, IEnumerable <Anonymous2> selections, TicketOddsChange oddsChange, bool isTestSource, DateTime timestamp, string version, string reofferRefId, string altStakeRefId, int?totalCombinations, DateTime?lastMatchEndTime) { TicketId = ticketId; Sender = sender; Bets = bets as ObservableCollection <Anonymous>; Selections = selections as ObservableCollection <Anonymous2>; OddsChange = oddsChange; TestSource = isTestSource; TimestampUtc = MtsTicketHelper.Convert(timestamp); Version = version; ReofferRefId = string.IsNullOrEmpty(reofferRefId) ? null : reofferRefId; AltStakeRefId = string.IsNullOrEmpty(altStakeRefId) ? null : altStakeRefId; TotalCombinations = totalCombinations; LastMatchEndTime = lastMatchEndTime == null ? (long?)null : MtsTicketHelper.Convert(lastMatchEndTime.Value); }
public Sender(ISender sender) { Guard.Argument(sender, nameof(sender)).NotNull(); if (sender.EndCustomer != null) { EndCustomer = new EndCustomer(sender.EndCustomer); } Channel = MtsTicketHelper.Convert(sender.Channel); Currency = sender.Currency; LimitId = sender.LimitId; BookmakerId = sender.BookmakerId; ShopId = sender.ShopId; TerminalId = sender.TerminalId; }
public static void Compare(ITicketAck ticket, TicketAckDTO dto) { Assert.IsTrue(ticket != null); Assert.IsTrue(dto != null); Assert.AreEqual(ticket.TicketId, dto.TicketId); Assert.AreEqual(MtsTicketHelper.Convert(ticket.Timestamp), dto.TimestampUtc); Assert.AreEqual(ticket.Version, dto.Version); Assert.AreEqual(ticket.BookmakerId, dto.Sender.BookmakerId); Assert.AreEqual(ticket.Code, dto.Code); Assert.AreEqual(ticket.Message, dto.Message); Assert.AreEqual(MtsTicketHelper.Convert(ticket.TicketStatus), dto.TicketStatus); Assert.IsFalse(string.IsNullOrEmpty(ticket.CorrelationId)); }
public ITicketResponse Map(TicketResponseDTO source, string correlationId, IDictionary <string, string> additionalInfo, string orgJson) { var autoAcceptedOdds = source.AutoAcceptedOdds?.Select(s => new AutoAcceptedOdds(s.SelectionIndex, s.RequestedOdds, s.UsedOdds)); return(new TicketResponse(_ticketAckSender, source.Result.TicketId, MtsTicketHelper.Convert(source.Result.Status), new ResponseReason(source.Result.Reason.Code, source.Result.Reason.Message), source.Result.BetDetails?.ToList().ConvertAll(b => new BetDetail(b)), correlationId, source.Signature, source.ExchangeRate, source.Version, additionalInfo, autoAcceptedOdds, orgJson)); }
/// <summary> /// Initializes a new instance of the <see cref="Ticket"/> class /// </summary> /// <param name="ticket">The ticket</param> public Ticket(ITicket ticket) { TicketId = ticket.TicketId; Sender = new Sender(ticket.Sender); OddsChange = ticket.OddsChange.HasValue ? MtsTicketHelper.Convert(ticket.OddsChange.Value) : (TicketOddsChange?)null; TestSource = ticket.TestSource; TimestampUtc = MtsTicketHelper.Convert(ticket.Timestamp); Version = ticket.Version; var selections = ticket.Selections.ToList().ConvertAll(c => new Anonymous2(c)); Selections = selections.Distinct().ToList(); Bets = ticket.Bets.ToList().ConvertAll(b => new Anonymous(b, GetBetSelectionRefs(b, Selections as IReadOnlyList <Anonymous2>, ticket.Selections.Any(a => a.IsBanker)))); ReofferRefId = string.IsNullOrEmpty(ticket.ReofferId) ? null : ticket.ReofferId; AltStakeRefId = string.IsNullOrEmpty(ticket.AltStakeRefId) ? null : ticket.AltStakeRefId; TotalCombinations = ticket.TotalCombinations; LastMatchEndTime = ticket.LastMatchEndTime == null ? (long?)null : MtsTicketHelper.Convert(ticket.LastMatchEndTime.Value); }
public static void Compare(IBet bet, Anonymous dto) { Assert.IsTrue(bet != null); Assert.IsTrue(dto != null); Assert.AreEqual(bet.Id, dto.Id); Assert.AreEqual(bet.ReofferRefId, dto.ReofferRefId); if (bet.SumOfWins == 0) { Assert.IsNull(dto.SumOfWins); } else { Assert.AreEqual(bet.SumOfWins, dto.SumOfWins); } if (bet.Bonus != null) { Assert.AreEqual(bet.Bonus.Value, dto.Bonus.Value); Assert.AreEqual(MtsTicketHelper.Convert(bet.Bonus.Type), dto.Bonus.Type); Assert.AreEqual(MtsTicketHelper.Convert(bet.Bonus.Mode), dto.Bonus.Mode); } Assert.AreEqual(bet.Stake.Value, dto.Stake.Value); if (bet.Stake.Type.HasValue) { Assert.AreEqual(MtsTicketHelper.ConvertStakeType(bet.Stake.Type.Value), dto.Stake.Type); } Assert.AreEqual(bet.SelectedSystems.Count(), dto.SelectedSystems.Count()); for (int i = 0; i < bet.SelectedSystems.Count(); i++) { Assert.AreEqual(bet.SelectedSystems.ToList()[i], dto.SelectedSystems.ToList()[i]); } //if (bet.SelectionRefs != null && bet.SelectionRefs.Any()) //{ // for (int i = 0; i < bet.SelectionRefs.Count(); i++) // { // Assert.AreEqual(bet.SelectionRefs.ToList()[i].SelectionIndex, dto.SelectionRefs.ToList()[i].SelectionIndex); // Assert.AreEqual(bet.SelectionRefs.ToList()[i].Banker, dto.SelectionRefs.ToList()[i].Banker); // } //} }
public static void Compare(ITicket ticket, TicketDTO dto) { Assert.IsTrue(ticket != null); Assert.IsTrue(dto != null); Assert.AreEqual(ticket.TicketId, dto.Ticket.TicketId); Assert.AreEqual(MtsTicketHelper.Convert(ticket.Timestamp), dto.Ticket.TimestampUtc); Assert.AreEqual(ticket.Version, dto.Ticket.Version); Assert.AreEqual(ticket.AltStakeRefId, dto.Ticket.AltStakeRefId); Assert.AreEqual(ticket.OddsChange.ToString(), dto.Ticket.OddsChange.ToString()); Assert.AreEqual(ticket.ReofferId, dto.Ticket.ReofferRefId); Assert.AreEqual(ticket.TestSource, dto.Ticket.TestSource); Assert.AreEqual(ticket.Sender.BookmakerId, dto.Ticket.Sender.BookmakerId); Assert.AreEqual(MtsTicketHelper.Convert(ticket.Sender.Channel), dto.Ticket.Sender.Channel); Assert.AreEqual(ticket.Sender.Currency.ToUpper(), dto.Ticket.Sender.Currency.ToUpper()); Assert.AreEqual(ticket.Sender.LimitId, dto.Ticket.Sender.LimitId); Assert.AreEqual(ticket.Sender.ShopId, dto.Ticket.Sender.ShopId); Assert.AreEqual(ticket.Sender.TerminalId, dto.Ticket.Sender.TerminalId); Assert.AreEqual(ticket.Sender.EndCustomer.Id, dto.Ticket.Sender.EndCustomer.Id); Assert.AreEqual(ticket.Sender.EndCustomer.Confidence, dto.Ticket.Sender.EndCustomer.Confidence); Assert.AreEqual(ticket.Sender.EndCustomer.DeviceId, dto.Ticket.Sender.EndCustomer.DeviceId); Assert.AreEqual(ticket.Sender.EndCustomer.Ip, dto.Ticket.Sender.EndCustomer.Ip); Assert.AreEqual(ticket.Sender.EndCustomer.LanguageId, dto.Ticket.Sender.EndCustomer.LanguageId); for (var i = 0; i < ticket.Bets.Count(); i++) { Compare(ticket.Bets.ToList()[i], dto.Ticket.Bets.ToList()[i]); } for (var i = 0; i < ticket.Selections.Count(); i++) { var ticketSelection = ticket.Selections.ToList()[i]; var dtoSelection = dto.Ticket.Selections.First(f => f.Id == ticketSelection.Id && f.EventId == ticketSelection.EventId && f.Odds == ticketSelection.Odds); Compare(ticketSelection, dtoSelection); } Assert.IsFalse(string.IsNullOrEmpty(ticket.CorrelationId)); Assert.AreEqual(ticket.TotalCombinations, dto.Ticket.TotalCombinations); }
public Bonus(IBetBonus bonus) { _value = bonus.Value; _type = MtsTicketHelper.Convert(bonus.Type); _mode = MtsTicketHelper.Convert(bonus.Mode); }