public FeelOrderConfirmationQueryResult Handle(FeelOrderConfirmationQuery query)
        {
            var transaction = _transactionRepository.GetByAltId(query.TransactionAltId);

            if (transaction == null)
            {
                return(new FeelOrderConfirmationQueryResult
                {
                });
            }
            var orderConfirmation = _orderConfirmationProvider.Get(transaction.Id,
                                                                   query.confirmationFrmMyOrders,
                                                                   query.Channel);

            // Check if transaction is Tiqets One
            var tiqetsTransactions = _tiqetsTransactionRepository.GetByTransactionId(transaction.Id);

            //for live online events
            var IsLiveOnline                        = false;
            var zoomUserModel                       = new ZoomUser();
            var liveOnlineDetailModelData           = new LiveOnlineTransactionDetailResponseModel();
            List <ZoomHostUserModel> hostUsersModel = new List <ZoomHostUserModel>();
            var liveOnlineDetailModel               = _transactionRepository.GetFeelOnlineDetails(transaction.Id);

            if (liveOnlineDetailModel.Any() &&
                liveOnlineDetailModel.Count() == 1 &&
                (liveOnlineDetailModel.Select(s => s.TicketCategoryId).Contains(19452) || liveOnlineDetailModel.Select(s => s.TicketCategoryId).Contains(12259)))
            {
                liveOnlineDetailModelData = liveOnlineDetailModel.FirstOrDefault();
            }
            else
            {
                liveOnlineDetailModelData = liveOnlineDetailModel.Where(s => s.TransactionType == Contracts.Enums.TransactionType.LiveOnline).FirstOrDefault();
            }
            if (liveOnlineDetailModelData != null && liveOnlineDetailModelData.EventcategoryId != 0)
            {
                if (orderConfirmation.orderConfirmationSubContainer.Any(s => s.Event.MasterEventTypeId == Contracts.Enums.MasterEventType.Online))
                {
                    IsLiveOnline  = true;
                    zoomUserModel = _zoomUserRepository.GetByTransactionId(transaction.Id);
                    if (zoomUserModel != null)
                    {
                        var transactionCount = _transactionRepository.GetTransactionCountByEvent(liveOnlineDetailModelData.EventId);
                        if (transactionCount == 1)
                        {
                            var eventHostUsersModel = _eventHostMappingRepository.GetAllByEventId(liveOnlineDetailModelData.EventId);
                            var zoomHostUserModel   = _zoomUserRepository.GetByHostUserIds(eventHostUsersModel.Select(s => s.Id));
                            foreach (var currentZoomUser in zoomHostUserModel)
                            {
                                var currentHostUsersModel = new ZoomHostUserModel();
                                var currentEventHost      = eventHostUsersModel.Where(s => s.Id == currentZoomUser.EventHostUserId).FirstOrDefault();
                                currentHostUsersModel.altId = currentZoomUser.AltId;
                                currentHostUsersModel.email = currentEventHost.Email;
                                hostUsersModel.Add(currentHostUsersModel);
                            }
                        }
                    }
                }
            }

            return(new FeelOrderConfirmationQueryResult
            {
                Transaction = orderConfirmation.Transaction,
                TransactionPaymentDetail = orderConfirmation.TransactionPaymentDetail,
                UserCardDetail = orderConfirmation.UserCardDetail,
                CurrencyType = orderConfirmation.CurrencyType,
                PaymentOption = orderConfirmation.PaymentOption,
                cardTypes = orderConfirmation.cardTypes,
                orderConfirmationSubContainer = orderConfirmation.orderConfirmationSubContainer,
                IsTiqets = tiqetsTransactions != null ? true : false,
                IsHoho = orderConfirmation.IsHoho,
                ZoomUser = zoomUserModel,
                liveOnlineDetailModel = liveOnlineDetailModelData,
                hostUsersModel = hostUsersModel,
                IsLiveOnline = IsLiveOnline
            });
        }
예제 #2
0
        public OrderConfirmationQueryResult Handle(OrderConfirmationQuery query)
        {
            var orderConfirmation = _orderConfirmationProvider.Get(query.TransactionId, false, Contracts.Enums.Channels.Website);

            if (orderConfirmation != null)
            {
                if (orderConfirmation.orderConfirmationSubContainer[0].Event.AltId.ToString().ToUpper() == "1F0257FA-EEA6-4469-A7BC-B878A215C8A9")
                {
                    orderConfirmation.Transaction.CreatedUtc = orderConfirmation.Transaction.CreatedUtc.AddHours(10);
                }

                // Check if transaction is Tiqets One
                var tiqetsTransactions = _tiqetsTransactionRepository.GetByTransactionId(query.TransactionId);

                //for live online events
                var zoomUserModel = new ZoomUser();
                List <ZoomHostUserModel> hostUsersModel = new List <ZoomHostUserModel>();
                var liveOnlineDetailModel = _transactionRepository.GetFeelOnlineDetails(query.TransactionId).FirstOrDefault();
                if (liveOnlineDetailModel != null)
                {
                    //check if subcategory is LiveOnline
                    var eventModel = _eventRepository.Get(liveOnlineDetailModel.EventId);
                    if (eventModel.EventCategoryId == 119)
                    {
                        zoomUserModel = _zoomUserRepository.GetByTransactionId(query.TransactionId);

                        var transactionCount = _transactionRepository.GetTransactionCountByEvent(liveOnlineDetailModel.EventId);
                        if (transactionCount == 1)
                        {
                            var eventHostUsersModel = _eventHostMappingRepository.GetAllByEventId(liveOnlineDetailModel.EventId);
                            var zoomHostUserModel   = _zoomUserRepository.GetByHostUserIds(eventHostUsersModel.Select(s => s.Id));
                            foreach (var currentZoomUser in zoomHostUserModel)
                            {
                                var currentHostUsersModel = new ZoomHostUserModel();
                                var currentEventHost      = eventHostUsersModel.Where(s => s.Id == currentZoomUser.EventHostUserId).FirstOrDefault();
                                currentHostUsersModel.altId = currentZoomUser.AltId;
                                currentHostUsersModel.email = currentEventHost.Email;
                                hostUsersModel.Add(currentHostUsersModel);
                            }
                        }
                    }
                }
                return(new OrderConfirmationQueryResult
                {
                    Transaction = orderConfirmation.Transaction,
                    TransactionPaymentDetail = orderConfirmation.TransactionPaymentDetail,
                    UserCardDetail = orderConfirmation.UserCardDetail,
                    CurrencyType = orderConfirmation.CurrencyType,
                    PaymentOption = orderConfirmation.PaymentOption,
                    cardTypes = orderConfirmation.cardTypes,
                    orderConfirmationSubContainer = orderConfirmation.orderConfirmationSubContainer,
                    TicketQuantity = orderConfirmation.TicketQuantity,
                    GoodsAndServiceTax = orderConfirmation.GoodsAndServiceTax,
                    IsASI = orderConfirmation.IsASI,
                    IsTiqets = tiqetsTransactions != null ? true : false,
                    liveOnlineDetailModel = liveOnlineDetailModel,
                    ZoomUser = zoomUserModel,
                    hostUsersModel = hostUsersModel
                });
            }
            else
            {
                return(new OrderConfirmationQueryResult
                {
                    Transaction = null,
                    TransactionPaymentDetail = null,
                    UserCardDetail = null,
                    CurrencyType = null,
                    PaymentOption = null,
                    cardTypes = null,
                    orderConfirmationSubContainer = null,
                    IsASI = false,
                    IsTiqets = false
                });
            }
        }