public ISdkTicket GetTicketResponseFromJson(string json, string routingKey, TicketResponseType type, string correlationId, IDictionary <string, string> additionalInfo) { //new if (type == TicketResponseType.Ticket) { var ticketDto = TicketResponseDTO.FromJson(json); return(Map(ticketDto, correlationId, additionalInfo, json)); } if (type == TicketResponseType.TicketCancel) { var cancelDto = TicketCancelResponseDTO.FromJson(json); return(Map(cancelDto, correlationId, additionalInfo, json)); } if (type == TicketResponseType.TicketCashout) { var cashoutDto = TicketCashoutResponseDTO.FromJson(json); return(Map(cashoutDto, correlationId, additionalInfo, json)); } if (type == TicketResponseType.TicketNonSrSettle) { var nonSrSettleDto = TicketNonSrSettleResponseDTO.FromJson(json); return(Map(nonSrSettleDto, correlationId, additionalInfo, json)); } //old if (!routingKey.Contains("cancel")) { var ticketDto = TicketResponseDTO.FromJson(json); return(Map(ticketDto, correlationId, additionalInfo, json)); } var cancel2Dto = TicketCancelResponseDTO.FromJson(json); return(Map(cancel2Dto, correlationId, additionalInfo, json)); }
/// <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="RabbitMqMessageReceiver" /> class /// </summary> /// <param name="channel">A <see cref="IRabbitMqConsumerChannel" /> representing a consumer channel to the RabbitMQ broker</param> /// <param name="expectedResponseType">The type of the message receiver is expecting</param> public RabbitMqMessageReceiver(IRabbitMqConsumerChannel channel, TicketResponseType expectedResponseType) { Guard.Argument(channel, nameof(channel)).NotNull(); _consumerChannel = channel; _expectedTicketResponseType = expectedResponseType; }
/// <summary> /// Initializes a new instance of the <see cref="MessageReceivedEventArgs"/> class /// </summary> /// <param name="body">A JSON string representing the received message</param> /// <param name="routingKey">A routing key</param> /// <param name="correlationId">A correlation id</param> /// <param name="expectedTicketResponseType">Expected ticket response type</param> /// <param name="additionalInfo">Additional information</param> public MessageReceivedEventArgs(string body, string routingKey, string correlationId, TicketResponseType expectedTicketResponseType, IDictionary <string, string> additionalInfo) { Guard.Argument(body, nameof(body)).NotNull().NotEmpty(); JsonBody = body; RoutingKey = routingKey; CorrelationId = correlationId; ResponseType = expectedTicketResponseType; AdditionalInfo = additionalInfo; }