Ejemplo n.º 1
0
        public EditEventScheduleQueryResult Handle(EditEventScheduleQuery query)
        {
            var eventDetailDataModel  = _eventDetailRepository.GetByEvent(query.EventId);
            var deliveryTypeDetails   = _eventDeliveryTypeDetailRepository.GetAllActivatedByEventDetailIds(eventDetailDataModel.Select(s => s.Id));
            var matchAttributes       = _matchAttributeRepository.GetByEventDetailIds(eventDetailDataModel.Select(s => s.Id));
            var eventTicketDetails    = _eventTicketDetailRepository.GetByEventDetailIds(eventDetailDataModel.Select(s => s.Id));
            var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Select(s => s.Id));
            var ticketFeeDetails      = _ticketFeeDetailRepository.GetAllEnabledByEventTicketAttributeIds(eventTicketAttributes.Select(s => s.Id));

            var eventDetailsModel          = AutoMapper.Mapper.Map <List <Contracts.Models.EventDetail> >(eventDetailDataModel);
            var deliveryTypeDetailsModel   = AutoMapper.Mapper.Map <List <Contracts.Models.EventDeliveryTypeDetail> >(deliveryTypeDetails);
            var matchAttributesModel       = AutoMapper.Mapper.Map <List <Contracts.Models.MatchAttribute> >(matchAttributes);
            var eventTicketDetailsModel    = AutoMapper.Mapper.Map <List <Contracts.Models.EventTicketDetail> >(eventTicketDetails);
            var eventTicketAttributesModel = AutoMapper.Mapper.Map <List <Contracts.Models.EventTicketAttribute> >(eventTicketAttributes);
            var ticketFeeDetailsModel      = AutoMapper.Mapper.Map <List <Contracts.Models.TicketFeeDetail> >(ticketFeeDetails);

            return(new EditEventScheduleQueryResult
            {
                SubEvents = eventDetailsModel,
                DeliveryTypeDetails = deliveryTypeDetailsModel,
                MatchAttributes = matchAttributesModel,
                EventTicketDetails = eventTicketDetailsModel,
                EventTicketAttributes = eventTicketAttributesModel,
                TicketFeeDetails = ticketFeeDetailsModel
            });
        }
Ejemplo n.º 2
0
        public BarcodeLookupQueryResult Handle(BarcodeLookupQuery query)
        {
            try
            {
                var eventTicketDetails = _eventTicketDetailRepository.GetRASVRideEventTicketDetails()
                                         .ToDictionary(k => k.Id);
                var matchSeatTicketDetails = _matchSeatTicketDetailRepository.GetByTransactionIdAndTicketDetailIds(query.TransactionId, eventTicketDetails.Keys)
                                             .ToList();
                if (matchSeatTicketDetails.Any())
                {
                    var transaction       = _transactionRepository.Get((long)matchSeatTicketDetails.First().TransactionId);
                    var currency          = _currencyTypeRepository.GetById(transaction.CurrencyId);
                    var userAltId         = transaction.CreatedBy;
                    var userId            = _userRepository.GetByAltId(userAltId).Id;
                    var userAddressDetail = _userAddressDetailRepository.GetByUser(userId);
                    var zipcodeId         = userAddressDetail != null ? userAddressDetail.Zipcode : 9;
                    var postalcode        = _zipcodeRepository.Get(zipcodeId).Postalcode;
                    // var ticketCategories = _ticketCategoryRepository.GetByEventDetailIds(eventTicketDetails.Keys).ToDictionary(k =>k.Id);
                    var ticketCategories      = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.Value.TicketCategoryId)).ToDictionary(k => k.Id);
                    var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Keys).ToDictionary(k => k.EventTicketDetailId);

                    var barcodedetails = matchSeatTicketDetails.Select(mst =>
                    {
                        var eventTicketDetail = eventTicketDetails[mst.EventTicketDetailId];
                        var attributes        = eventTicketAttributes[eventTicketDetail.Id];
                        var value             = JsonConvert.DeserializeObject <TicketValue>(attributes.AdditionalInfo).value;

                        return(new BarcodeDetailsContainer
                        {
                            AltId = (System.Guid)mst.AltId,
                            BarcodeNumber = mst.BarcodeNumber,
                            CurrencyCode = currency.Code,
                            TicketCategoryId = eventTicketDetail.TicketCategoryId,
                            TicketCategory = ticketCategories[(int)eventTicketDetail.TicketCategoryId].Name,
                            Value = value,
                            Postalcode = postalcode,
                            IsConsumed = mst.IsConsumed,
                            ConsumedDateTime = mst.ConsumedDateTime,
                            TransactionUTC = transaction.CreatedUtc,
                        });
                    });

                    return(new BarcodeLookupQueryResult
                    {
                        BarcodeDetailsContainer = barcodedetails.ToList(),
                        IsValid = true
                    });
                }
            }
            catch (Exception ex)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, ex);
            }

            return(new BarcodeLookupQueryResult
            {
                BarcodeDetailsContainer = null,
                IsValid = false
            });
        }
Ejemplo n.º 3
0
 protected override async Task <ICommandResult> Handle(CreateTicketCommand command)
 {
     try
     {
         List <FIL.Contracts.Models.CreateEventV1.TicketModel> ticketModelList = new List <FIL.Contracts.Models.CreateEventV1.TicketModel>();
         var eventDetail = _eventDetailRepository.GetByEventId(command.EventId);
         var etdTicketCategoryMapping = _eventTicketDetailTicketCategoryTypeMappingRepository.GetByEventTicketDetails(command.Tickets.Select(s => s.ETDId).ToList());
         var eventTicketDetails       = _eventTicketDetailRepository.GetByEventDetailId(eventDetail.Id).ToList();
         var eventTicketAttributes    = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Select(s => s.Id).ToList()).ToList();
         var currency = _currencyTypeRepository.Get(command.Tickets.FirstOrDefault().CurrencyId);
         foreach (var currentEta in eventTicketAttributes)
         {
             currentEta.CurrencyId = currency.Id;
             _eventTicketAttributeRepository.Save(currentEta);
         }
         eventTicketDetails    = eventTicketDetails.Where(s => command.Tickets.Any(p => p.ETDId == s.Id)).ToList();
         eventTicketAttributes = eventTicketAttributes.Where(s => command.Tickets.Any(p => p.ETDId == s.EventTicketDetailId)).ToList();
         foreach (var ticketModel in command.Tickets)
         {
             ticketModel.CurrencyCode     = currency.Code;
             ticketModel.TicketCategoryId = SaveTicketCategory(command, ticketModel).Id;
             var etd = SaveEventTicketDetails(command, ticketModel, eventDetail, eventTicketDetails);
             ticketModel.ETDId       = etd.Id;
             ticketModel.TicketAltId = etd.AltId;
             var currentEventTicketAttribute = SaveEventTicketAttribute(command, ticketModel, eventTicketAttributes);
             SaveEventticketDetailTicketCategoryTypeMappings(command, ticketModel);
             SaveTicketDiscount(command, currentEventTicketAttribute.Id, eventDetail.Name);
             ticketModelList.Add(ticketModel);
         }
         SaveEventStripeMappings(command.EventId, command.Tickets.FirstOrDefault().CurrencyId);
         SaveDonationDetail(command);
         var eventStepDetail = _stepProvider.SaveEventStepDetails(command.EventId, command.CurrentStep, true, command.ModifiedBy);
         return(new CreateTicketCommandResult
         {
             Tickets = ticketModelList,
             CompletedStep = eventStepDetail.CompletedStep,
             CurrentStep = eventStepDetail.CurrentStep,
             Success = true
         });
     }
     catch (Exception e)
     {
         _logger.Log(LogCategory.Error, e);
         return(new CreateTicketCommandResult {
         });
     }
 }
Ejemplo n.º 4
0
        public ItineraryTicketQueryResult Handle(ItineraryTicketQuery query)
        {
            ItineraryTicketQueryResult itineraryTicketQueryResult = new ItineraryTicketQueryResult();

            foreach (Int64 eventId in query.eventIds)
            {
                ItineraryTicketDetails itineraryTicketDetails = new ItineraryTicketDetails();

                itineraryTicketDetails.eventId = eventId;

                List <Contracts.DataModels.EventDetail> eventDetail = _eventDetailRepository.GetAllByEventId(eventId).Where(u => u.IsEnabled == true).Distinct().ToList();

                List <Contracts.DataModels.EventTicketDetail> eventTicketDetail = _eventTicketDetailRepository.GetAllByEventDetailIds(eventDetail.Select(u => u.Id).Distinct().ToList()).Where(u => u.IsEnabled == true).Distinct().ToList();

                List <Contracts.DataModels.EventTicketAttribute> eventTicketAttribute = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetail.Select(u => u.Id).ToList()).Distinct().ToList();

                List <Contracts.DataModels.TicketCategory> ticketCategory = _ticketCategoryRepository.GetByEventDetailIds(eventTicketDetail.Select(u => u.TicketCategoryId).ToList()).Distinct().ToList();

                itineraryTicketDetails.eventDetails          = AutoMapper.Mapper.Map <List <Contracts.Models.EventDetails> >(eventDetail);
                itineraryTicketDetails.eventTicketDetails    = AutoMapper.Mapper.Map <List <Contracts.Models.EventTicketDetail> >(eventTicketDetail);
                itineraryTicketDetails.eventTicketAttributes = AutoMapper.Mapper.Map <List <Contracts.Models.EventTicketAttribute> >(eventTicketAttribute);
                itineraryTicketDetails.ticketCategories      = AutoMapper.Mapper.Map <List <Contracts.Models.TicketCategory> >(ticketCategory);

                itineraryTicketQueryResult.itineraryTicketDetails.Add(itineraryTicketDetails);
            }

            return(itineraryTicketQueryResult);
        }
Ejemplo n.º 5
0
        protected override async Task <ICommandResult> Handle(ZoomValidateUserCommand command)
        {
            ZoomValidateUserCommandResult zoomValidateUserCommandResult = new ZoomValidateUserCommandResult();

            try
            {
                var zoomUserModel = _zoomUserRepository.GetByAltId(command.AltId);
                var getTimeStamp  = GetTimeStamp(zoomUserModel);
                zoomValidateUserCommandResult.timeStamp = getTimeStamp;
                //var checkTimeStamp = CheckValidTimeStamp(zoomUserModel);
                //if (!checkTimeStamp.IsValid)
                //{
                //    zoomValidateUserCommandResult.message = checkTimeStamp.Message;
                //    zoomValidateUserCommandResult.success = false;
                //    return zoomValidateUserCommandResult;
                //}
                if (zoomUserModel == null)
                {
                    if (zoomUserModel == null)
                    {
                        zoomValidateUserCommandResult.message = Constant.Zoom.Message.Invalid;
                    }
                    else
                    {
                        zoomValidateUserCommandResult.message = Constant.Zoom.Message.Active;
                    }
                    zoomValidateUserCommandResult.success = false;
                    return(zoomValidateUserCommandResult);
                }
                else
                {
                    string apikey    = _settings.GetConfigSetting <string>(SettingKeys.Integration.Zoom.API_Key);
                    string apiSecret = _settings.GetConfigSetting <string>(SettingKeys.Integration.Zoom.Secret_key);

                    var zoomMeetingModel = _zoomMeetingRepository.GetByEventId(zoomUserModel.EventId);

                    //Interactivity levels available
                    zoomValidateUserCommandResult.isAudioAvailable = true;
                    zoomValidateUserCommandResult.isVideoAvailable = true;
                    zoomValidateUserCommandResult.isChatAvailable  = true;

                    bool isHost         = false;
                    var  access         = Access.None;
                    var  eventHostModel = new EventHostMapping();
                    if (zoomUserModel.RoleId != 21 && zoomUserModel.RoleId != 26) // If the user is attendee
                    {
                        var userModel = _userRepository.Get(zoomUserModel.UserId);
                        zoomValidateUserCommandResult.email     = userModel.Email;
                        zoomValidateUserCommandResult.userName  = userModel.FirstName + " " + userModel.LastName;
                        zoomValidateUserCommandResult.UserAltId = userModel.AltId;
                        var transactionDetailsModel = _transactionRepository.GetFeelOnlineDetails(zoomUserModel.TransactionId).Where(s => s.TransactionType == Contracts.Enums.TransactionType.LiveOnline).FirstOrDefault();
                        if (transactionDetailsModel == null)
                        {
                            return(zoomValidateUserCommandResult);
                        }
                        //interactivity levels available based on ticket cat.
                        if (transactionDetailsModel.TicketCategoryId == 1360)
                        {
                            access = Access.GA;
                            zoomValidateUserCommandResult.isAudioAvailable = false;
                            zoomValidateUserCommandResult.isVideoAvailable = false;
                            zoomValidateUserCommandResult.isChatAvailable  = false;
                        }
                        if (transactionDetailsModel.TicketCategoryId == 606)
                        {
                            access = Access.VIP;
                            zoomValidateUserCommandResult.isAudioAvailable = false;
                            zoomValidateUserCommandResult.isVideoAvailable = false;
                        }
                        if (transactionDetailsModel.TicketCategoryId == 12080 || transactionDetailsModel.TicketCategoryId == 19352)
                        {
                            zoomValidateUserCommandResult.isVideoAvailable = false;
                        }
                    }
                    else // Host user
                    {
                        eventHostModel = _eventHostMappingRepository.Get(zoomUserModel.EventHostUserId);
                        zoomValidateUserCommandResult.email    = eventHostModel.Email;
                        zoomValidateUserCommandResult.userName = eventHostModel.FirstName + " " + eventHostModel.LastName;
                        isHost = true;
                    }

                    zoomValidateUserCommandResult.meetingNumber = zoomMeetingModel.MeetingNumber.ToString();
                    zoomValidateUserCommandResult.apikey        = apikey;
                    zoomValidateUserCommandResult.secretkey     = apiSecret;
                    zoomValidateUserCommandResult.success       = true;
                    zoomValidateUserCommandResult.roleId        = (zoomUserModel.RoleId == 21 || zoomUserModel.RoleId == 26) ? "1" : "0";

                    if (!zoomUserModel.IsActive && command.IsZoomLandingPage)
                    {
                        zoomUserModel.UniqueId = command.UniqueId;
                        zoomUserModel.IsActive = true;
                        _zoomUserRepository.Save(zoomUserModel);
                    }
                    var eventDetail = _eventDetailRepository.GetAllByEventId(zoomUserModel.EventId).FirstOrDefault();
                    zoomValidateUserCommandResult.eventName = eventDetail.Name;
                    if (!command.IsZoomLandingPage)
                    {
                        zoomValidateUserCommandResult.EventAttribute    = _eventAttributeRepository.GetByEventDetailId(eventDetail.Id);
                        zoomValidateUserCommandResult.EventHostMappings = _eventHostMappingRepository.GetAllByEventId(eventDetail.EventId).OrderBy(s => s.StartDateTime).ToList();
                        foreach (var currentEHM in zoomValidateUserCommandResult.EventHostMappings)
                        {
                            currentEHM.StartDateTime = currentEHM.StartDateTime != null?_localTimeZoneConvertProvider.ConvertToLocal((DateTime)currentEHM.StartDateTime, zoomValidateUserCommandResult.EventAttribute.TimeZone) : currentEHM.StartDateTime;

                            currentEHM.EndDateTime = currentEHM.EndDateTime != null?_localTimeZoneConvertProvider.ConvertToLocal((DateTime)currentEHM.EndDateTime, zoomValidateUserCommandResult.EventAttribute.TimeZone) : currentEHM.EndDateTime;
                        }
                        zoomValidateUserCommandResult.EventDetail     = _eventDetailRepository.Get(eventDetail.Id);
                        zoomValidateUserCommandResult.LiveEventDetail = _liveEventDetailRepository.GetByEventId(eventDetail.EventId);
                        if (isHost && eventHostModel.StartDateTime != null && zoomValidateUserCommandResult.LiveEventDetail != null)
                        {
                            zoomValidateUserCommandResult.LiveEventDetail.EventStartDateTime = eventHostModel.StartDateTime;
                        }
                        zoomValidateUserCommandResult.Event = _eventRepository.Get(eventDetail.EventId);
                        var eventTicketDetails    = _eventTicketDetailRepository.GetByEventDetailId(eventDetail.Id).Where(s => s.IsEnabled).ToList();
                        var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Select(s => s.Id)).Where(s => s.IsEnabled).ToList();
                        if (eventTicketDetails.Select(s => s.TicketCategoryId).Contains(19452) || eventTicketDetails.Select(s => s.TicketCategoryId).Contains(12259)) // if donate
                        {
                            zoomValidateUserCommandResult.IsDonate = true;
                        }
                        if ((access == Access.GA || access == Access.VIP) && eventTicketDetails.Select(s => s.TicketCategoryId).Contains(19350) || eventTicketDetails.Select(s => s.TicketCategoryId).Contains(12079)) // if BSP Exists
                        {
                            var price       = getBSPPrice(eventTicketDetails, eventTicketAttributes) - (access == Access.GA ? getGAPrice(eventTicketDetails, eventTicketAttributes) : getVIP(eventTicketDetails, eventTicketAttributes));
                            var transacions = _transactionRepository.GetAllSuccessfulTransactionByReferralId(zoomUserModel.TransactionId.ToString());
                            if (price >= 0 && !transacions.Any())
                            {
                                zoomValidateUserCommandResult.IsUpgradeToBSP = true;
                                zoomValidateUserCommandResult.Price          = price;
                            }
                        }
                        if (zoomUserModel.RoleId != 21 && zoomUserModel.RoleId != 26) // If the user is attendee
                        {
                            var transactionDetail = _transactionDetailRepository.GetByTransactionId(zoomUserModel.TransactionId);
                            var eta = _eventTicketAttributeRepository.Get(transactionDetail.Count() > 1 ? transactionDetail.Where(s => s.TransactionType == Contracts.Enums.TransactionType.LiveOnline).FirstOrDefault().EventTicketAttributeId : transactionDetail.FirstOrDefault().EventTicketAttributeId);
                            zoomValidateUserCommandResult.ImportantInformation = eta.TicketCategoryNotes;
                            /* If Recurring then update Event Start & Interactivity start time */
                            if (eventDetail.EventFrequencyType == Contracts.Enums.EventFrequencyType.Recurring)
                            {
                                UpdateEventSchedule(zoomValidateUserCommandResult, transactionDetail.ToList());
                            }
                        }
                        else
                        {
                            zoomValidateUserCommandResult.ImportantInformation = zoomValidateUserCommandResult.EventHostMappings.Where(s => s.Id == zoomUserModel.EventHostUserId).FirstOrDefault().ImportantInformation;
                        }
                    }
                }
                zoomValidateUserCommandResult.success       = true;
                zoomValidateUserCommandResult.TransactionId = zoomUserModel.TransactionId;
                return(zoomValidateUserCommandResult);
            }
            catch (Exception e)
            {
                _logger.Log(LogCategory.Error, new Exception("Failed to validate zoom details " + e.Message, e));
                return(zoomValidateUserCommandResult);
            }
        }
Ejemplo n.º 6
0
        public SearchVenueQueryResult Handle(SearchVenueQuery query)
        {
            List <FIL.Contracts.DataModels.SearchVenue> VenueResult = new List <Contracts.DataModels.SearchVenue>();

            try
            {
                var citiesArray = query.CityName != null?query.CityName.Split(",") : null;

                var eventCategoriesRepositoryData = _eventCategoryRepository.GetAll().Where(s => s.IsFeel == true);
                var categories = query.Categories != null?query.Categories.Split(",") : null;

                List <long> categoryList = new List <long>();
                if (categories != null && categories.Count() > 0 && query.PlaceId == 0)
                {
                    foreach (var item in categories)
                    {
                        try
                        {
                            var categoryInfo = eventCategoriesRepositoryData.FirstOrDefault(x => x.DisplayName == item).Id;
                            categoryList.Add(categoryInfo);
                        }
                        catch (Exception ex)
                        {
                            _logger.Log(Logging.Enums.LogCategory.Error, ex);
                        }
                    }
                }
                else if (categories != null && categories.Count() == 0 && query.PlaceId == 0)
                {
                    var categoryInfo = eventCategoriesRepositoryData.FirstOrDefault(x => x.DisplayName == query.Categories).Id;
                    categoryList.Add(categoryInfo);
                }
                var cityLists = query.CityIds != null?_cityRepository.GetByCityIds(query.CityIds) : null;

                var itineraryPlaces = query.PlaceId == 0 ? _eventRepository.GetAllItineraryPlaces(cityLists.Select(s => s.Id).ToList(), categoryList).GroupBy(x => x.Id, (key, group) => group.First()) :
                                      _eventRepository.GetItinerarySearchPlaces(query.PlaceId).GroupBy(x => x.Id, (key, group) => group.First());
                var placeWeekOpenDayList              = _placeWeekOpenDaysRepository.GetByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList());
                var dayTimeMappingLists               = _dayTimeMappingsRepository.GetAllByPlaceWeekOpenDays(placeWeekOpenDayList.Select(s => (long)s.Id).Distinct().ToList());
                var placeHolidayDatesRepositoryLists  = _placeHolidayDatesRepository.GetAllByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList());
                var placeVisitDurationRepositoryLists = _PlaceVisitDurationRepository.GetByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList());
                var eventDetails          = _eventDetailRepository.GetByEventIds(itineraryPlaces.Select(s => (long)s.Id).Distinct().ToList()).Where(s => s.IsEnabled == true);
                var eventTicketDetails    = _eventTicketDetailRepository.GetByEventDetailIds(eventDetails.Select(s => (long)s.Id).Distinct().ToList()).Where(s => s.IsEnabled == true);
                var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Select(s => (long)s.Id).Distinct().ToList()).Where(s => s.IsEnabled == true);
                var ticketCategories      = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => (long)s.TicketCategoryId).Distinct().ToList());
                var Days = _daysRepository.GetAll();
                foreach (var currentPlace in itineraryPlaces)
                {
                    var         PlaceVisitDuration = placeVisitDurationRepositoryLists.FirstOrDefault(x => x.EventId == currentPlace.Id);
                    var         placeWeekOpenDays  = placeWeekOpenDayList.Where(x => x.EventId == currentPlace.Id);
                    var         dayTimeMappings    = dayTimeMappingLists.Where(s => placeWeekOpenDays.Any(p => p.Id == s.PlaceWeekOpenDayId));
                    SearchVenue searchVenue        = new SearchVenue();
                    searchVenue.CategoryName          = currentPlace.Category;
                    searchVenue.EventId               = currentPlace.Id;
                    searchVenue.CityId                = currentPlace.CityId;
                    searchVenue.EventSource           = currentPlace.EventSource;
                    searchVenue.CityName              = currentPlace.CityName;
                    searchVenue.CountryName           = currentPlace.CountryName;
                    searchVenue.Currency              = currentPlace.Currency;
                    searchVenue.EventName             = currentPlace.Name;
                    searchVenue.EventAltId            = currentPlace.AltId;
                    searchVenue.EventSlug             = currentPlace.Slug;
                    searchVenue.Address               = (currentPlace.AddressLineOne == null ? string.Empty : currentPlace.AddressLineOne) + "," + (currentPlace.AddressLineTwo == null ? string.Empty : currentPlace.AddressLineTwo);
                    searchVenue.Id                    = currentPlace.Id;
                    searchVenue.PlaceWeekOpenDays     = placeWeekOpenDays.ToList();
                    searchVenue.DayTimeMappings       = dayTimeMappings.ToList();
                    searchVenue.PlaceHolidaysList     = placeHolidayDatesRepositoryLists.Where(x => x.EventId == currentPlace.Id).ToList();
                    searchVenue.EventDescription      = currentPlace.EventDescription;
                    searchVenue.EventDetails          = eventDetails.Where(x => x.EventId == currentPlace.Id).ToList();
                    searchVenue.EventTicketDetails    = eventTicketDetails.Where(x => searchVenue.EventDetails.Any(s => s.Id == x.EventDetailId)).ToList();
                    searchVenue.EventTicketAttributes = eventTicketAttributes.Where(x => searchVenue.EventTicketDetails.Any(s => s.Id == x.EventTicketDetailId)).ToList();
                    searchVenue.ticketCategories      = ticketCategories.Where(x => searchVenue.EventTicketDetails.Any(s => s.TicketCategoryId == x.Id)).ToList();

                    if (currentPlace.Latitude != null)
                    {
                        var latArr  = currentPlace.Latitude.Split("E");
                        var longArr = currentPlace.Longitude.Split("E");
                        searchVenue.Latitude  = latArr[0];
                        searchVenue.Longitude = longArr[0];
                    }
                    else
                    {
                        searchVenue.Latitude  = null;
                        searchVenue.Longitude = null;
                    }
                    VenueResult.Add(searchVenue);
                }
                return(new SearchVenueQueryResult()
                {
                    Venues = VenueResult.Distinct().ToList(), Days = Days.ToList()
                });
            }
            catch (Exception e)
            {
                return(new SearchVenueQueryResult()
                {
                    Venues = VenueResult.Distinct().ToList()
                });
            }
        }
Ejemplo n.º 7
0
        public TicketQueryResult Handle(TicketQuery query)
        {
            try
            {
                List <FIL.Contracts.Models.CreateEventV1.TicketModel> ticketModelList = new List <FIL.Contracts.Models.CreateEventV1.TicketModel>();
                var currentEvent = _eventRepository.Get(query.EventId);
                if (currentEvent == null)
                {
                    return(new TicketQueryResult {
                        Success = true
                    });
                }
                var eventDetail = _eventDetailRepository.GetByEventId(query.EventId);
                if (eventDetail == null)
                {
                    return(new TicketQueryResult
                    {
                        Success = true,
                        IsDraft = true,
                        IsValidLink = true,
                        Tickets = ticketModelList
                    });
                }
                var eventTicketDetails = _eventTicketDetailRepository.GetByEventDetailId(eventDetail.Id);
                var eventTicketDetailTicketCategoryMappingData = _eventTicketDetailTicketCategoryTypeMappingRepository.GetByEventTicketDetails(eventTicketDetails.Select(s => s.Id).ToList()).ToList();
                if (query.TicketCategoryTypeId == 2)
                {
                    eventTicketDetailTicketCategoryMappingData = eventTicketDetailTicketCategoryMappingData.Where(s => s.TicketCategoryTypeId == 2).ToList();
                    eventTicketDetails = eventTicketDetails.Where(p => eventTicketDetailTicketCategoryMappingData.Any(p2 => p2.EventTicketDetailId == p.Id) || (p.TicketCategoryId == 19452 || p.TicketCategoryId == 12259));
                    if (!eventTicketDetails.Any())
                    {
                        return(new TicketQueryResult
                        {
                            EventDetailId = eventDetail.Id,
                            EventId = currentEvent.Id,
                            Success = true,
                            IsValidLink = true,
                            Tickets = ticketModelList
                        });
                    }
                }
                else
                {
                    eventTicketDetailTicketCategoryMappingData = eventTicketDetailTicketCategoryMappingData.Where(s => s.TicketCategoryTypeId != 2).ToList();
                    eventTicketDetails = eventTicketDetails.Where(p => eventTicketDetailTicketCategoryMappingData.Any(p2 => p2.EventTicketDetailId == p.Id));
                }
                var ticketCategories      = _ticketCategoryRepository.GetByTicketCategoryIds(eventTicketDetails.Select(s => s.TicketCategoryId));
                var eventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(eventTicketDetails.Select(s => s.Id));
                var currency = _currencyTypeRepository.GetByCurrencyIds(eventTicketAttributes.Select(s => s.CurrencyId).ToList());
                var eventTicketDiscountDetails = _eventTicketDiscountDetailRepository.GetAllByEventTicketAttributeIds(eventTicketAttributes.Select(s => s.Id).ToList());
                var discounts          = _discountRepository.GetAllDiscountsByIds(eventTicketDiscountDetails.Select(s => (long)s.DiscountId).ToList());
                var discountPromoCodes = _discountPromoCodeRepository.GetAllDiscountIds(discounts.Select(s => (long)s.Id).ToList());
                foreach (var currentEventTicketDetail in eventTicketDetails)
                {
                    FIL.Contracts.Models.CreateEventV1.TicketModel newTicketModel = new FIL.Contracts.Models.CreateEventV1.TicketModel();
                    var currentTicketCat            = ticketCategories.Where(s => s.Id == currentEventTicketDetail.TicketCategoryId).FirstOrDefault();
                    var currentEventTicketAttribute = eventTicketAttributes.Where(s => s.EventTicketDetailId == currentEventTicketDetail.Id).FirstOrDefault();
                    var currentEventTicketDetailTicketCategoryMappingData = eventTicketDetailTicketCategoryMappingData.Where(s => s.EventTicketDetailId == currentEventTicketDetail.Id).FirstOrDefault();
                    var currentEventTicketDiscountDetails = eventTicketDiscountDetails.Where(s => s.EventTicketAttributeId == currentEventTicketAttribute.Id).FirstOrDefault();
                    var currentDiscount = currentEventTicketDiscountDetails != null?discounts.Where(s => s.Id == currentEventTicketDiscountDetails.DiscountId).FirstOrDefault() : null;

                    var currentDiscountPromoCodes = currentDiscount != null?discountPromoCodes.Where(s => s.DiscountId == currentDiscount.Id).FirstOrDefault() : null;

                    var donationDetail = new FIL.Contracts.DataModels.DonationDetail();
                    if (currentEventTicketDetail.TicketCategoryId == 19452 || currentEventTicketDetail.TicketCategoryId == 12259)
                    {
                        donationDetail = _donationDetailRepository.GetByEventId(query.EventId);
                    }
                    newTicketModel.TicketAltId          = currentEventTicketDetail.AltId;
                    newTicketModel.ETDId                = currentEventTicketDetail.Id;
                    newTicketModel.TicketCategoryId     = currentTicketCat.Id;
                    newTicketModel.Name                 = currentTicketCat.Name;
                    newTicketModel.Price                = currentEventTicketAttribute.Price;
                    newTicketModel.Quantity             = currentEventTicketAttribute.AvailableTicketForSale;
                    newTicketModel.Description          = currentEventTicketAttribute.TicketCategoryDescription;
                    newTicketModel.CurrencyId           = currentEventTicketAttribute.CurrencyId;
                    newTicketModel.TicketCategoryTypeId = currentEventTicketDetailTicketCategoryMappingData == null ? 1 : (currentEventTicketDetailTicketCategoryMappingData != null && currentEventTicketDetailTicketCategoryMappingData.TicketCategoryTypeId == 1) ? 1 : 2;
                    newTicketModel.isEnabled            = currentEventTicketDetail.IsEnabled;
                    newTicketModel.CurrencyCode         = currency.Where(s => s.Id == currentEventTicketAttribute.CurrencyId).FirstOrDefault().Code;
                    newTicketModel.TotalQuantity        = currentEventTicketAttribute.AvailableTicketForSale;
                    newTicketModel.RemainingQuantity    = currentEventTicketAttribute.RemainingTicketForSale;
                    newTicketModel.DiscountAmount       = currentDiscount != null && currentDiscount.DiscountValueTypeId == Contracts.Enums.DiscountValueType.Flat ? currentDiscount.DiscountValue : 0;
                    newTicketModel.IsDiscountEnable     = currentEventTicketDiscountDetails != null ? currentEventTicketDiscountDetails.IsEnabled : false;
                    newTicketModel.DiscountPercentage   = currentDiscount != null && currentDiscount.DiscountValueTypeId == Contracts.Enums.DiscountValueType.Percentage ? currentDiscount.DiscountValue : 0;
                    newTicketModel.PromoCode            = currentDiscountPromoCodes != null ? currentDiscountPromoCodes.PromoCode : null;
                    newTicketModel.DiscountValueType    = currentDiscount != null ? currentDiscount.DiscountValueTypeId : Contracts.Enums.DiscountValueType.Flat;
                    newTicketModel.DonationAmount1      = donationDetail != null ? donationDetail.DonationAmount1 : 0;
                    newTicketModel.DonationAmount2      = donationDetail != null ? donationDetail.DonationAmount2 : 0;
                    newTicketModel.DonationAmount3      = donationDetail != null ? donationDetail.DonationAmount3 : 0;
                    ticketModelList.Add(newTicketModel);
                }
                return(new TicketQueryResult
                {
                    EventDetailId = eventDetail.Id,
                    EventId = currentEvent.Id,
                    Success = true,
                    IsValidLink = true,
                    Tickets = ticketModelList
                });
            }
            catch (Exception e)
            {
                return(new TicketQueryResult {
                });
            }
        }
Ejemplo n.º 8
0
        public CheckoutCommandResult SaveTransaction(CheckoutCommand checkoutCommand, IEnumerable <Contracts.Models.EventTicketAttribute> eventTicketAttributeModel, FIL.Contracts.DataModels.User user)
        {
            try
            {
                var isPaymentBypass = false;
                var StripeAccount   = FIL.Contracts.Enums.StripeAccount.None;
                List <TransactionDetail> transactionDetailList             = new List <TransactionDetail>();
                List <FIL.Contracts.Models.CartItemModel> lstEventDetailId = new List <FIL.Contracts.Models.CartItemModel>();
                FIL.Contracts.DataModels.Transaction      transaction      = new FIL.Contracts.DataModels.Transaction();

                decimal grossTicketAmount = 0;
                long    eventDetailId = 0, ticketCategoryId = 0;
                decimal netTicketAmount     = 0;
                decimal totalDiscountAmount = 0;

                if (checkoutCommand.IsASI == null)
                {
                    checkoutCommand.IsASI = false;
                }

                var allETD = _eventTicketDetailRepository.GetByEventTicketDetailsIds(eventTicketAttributeModel.Select(s => s.EventTicketDetailId).Distinct()).Distinct();
                var allED  = _eventDetailRepository.GetByIds(allETD.Select(s => s.EventDetailId).Distinct()).Distinct();
                foreach (Contracts.Commands.Transaction.EventTicketAttribute ticketAttributes in checkoutCommand.EventTicketAttributeList)
                {
                    var     currentTA = ticketAttributes;
                    var     transactionType = checkoutCommand.IsQrTransaction ? TransactionType.QRCode : checkoutCommand.TransactionType == TransactionType.Itinerary ? TransactionType.Itinerary : ticketAttributes.TicketType == TicketType.SeasonPackage ? TransactionType.Season : ticketAttributes.TransactionType == TransactionType.LiveOnline ? TransactionType.LiveOnline : ticketAttributes.TransactionType == TransactionType.AddOns ? TransactionType.AddOns : TransactionType.Regular;
                    decimal discountAmount = 0, donationAmount = 0;
                    if (ticketAttributes.DiscountedPrice > 0)
                    {
                        discountAmount = ticketAttributes.DiscountedPrice;
                    }
                    if (ticketAttributes.DonationAmount != null && ticketAttributes.DonationAmount > 0)
                    {
                        donationAmount = (decimal)ticketAttributes.DonationAmount;
                    }
                    Contracts.Models.EventTicketAttribute checkoutCommandEventTicketAttribute = eventTicketAttributeModel.Where(w => w.Id == ticketAttributes.Id).FirstOrDefault();
                    decimal           pricePerTicket    = checkoutCommandEventTicketAttribute.Price;
                    EventTicketDetail eventTicketDetail = allETD.Where(s => s.Id == checkoutCommandEventTicketAttribute.EventTicketDetailId && s.IsEnabled).FirstOrDefault();
                    if (eventTicketDetail != null)
                    {
                        EventDetail eventDetail = allED.Where(s => s.Id == eventTicketDetail.EventDetailId && s.IsEnabled).FirstOrDefault();
                        if (eventDetail != null)
                        {
                            var visitStartDate = ticketAttributes.VisitDate;
                            var visitEndDate   = ticketAttributes.VisitDate;
                            if (checkoutCommand.TransactionType == TransactionType.Itinerary)
                            {
                                visitStartDate = ticketAttributes.VisitStartTime.Split(":").Count() > 1 ? new DateTime(visitStartDate.Year, visitStartDate.Month, visitStartDate.Day, Convert.ToInt32(ticketAttributes.VisitStartTime.Split(":")[0]), Convert.ToInt32(ticketAttributes.VisitStartTime.Split(":")[1]), 0) : visitStartDate;
                                visitEndDate   = ticketAttributes.VisitEndTime.Split(":").Count() > 1 ? new DateTime(visitEndDate.Year, visitEndDate.Month, visitEndDate.Day, Convert.ToInt32(ticketAttributes.VisitEndTime.Split(":")[0]), Convert.ToInt32(ticketAttributes.VisitEndTime.Split(":")[1]), 0) : visitEndDate;
                            }
                            visitStartDate = visitStartDate < new DateTime(1753, 1, 1) ? DateTime.UtcNow : visitStartDate;
                            visitEndDate   = visitEndDate < new DateTime(1753, 1, 1) ? DateTime.UtcNow : visitEndDate;
                            if ((bool)checkoutCommand.IsASI)
                            {
                                pricePerTicket = ticketAttributes.TicketType == TicketType.Child ? 0 : checkoutCommandEventTicketAttribute.Price;
                            }
                            if (ticketAttributes.OverridedAmount != null && checkoutCommand.IsBSPUpgrade && ticketAttributes.OverridedAmount != 0)
                            {
                                pricePerTicket = (decimal)ticketAttributes.OverridedAmount;
                            }
                            if (ticketAttributes.TicketType == TicketType.SeasonPackage)
                            {
                                eventDetailId = eventTicketDetail.EventDetailId;
                                lstEventDetailId.Add(new FIL.Contracts.Models.CartItemModel {
                                    EventDetailId = eventDetailId
                                });
                                ticketCategoryId = eventTicketDetail.TicketCategoryId;
                                IEnumerable <EventDetail>       seasonEventDetails       = _eventDetailRepository.GetSeasonEventDetails(eventDetail.EventId, eventDetail.VenueId).Where(s => s.IsEnabled == true);
                                IEnumerable <EventTicketDetail> seasonEventTicketDetails = _eventTicketDetailRepository.GetByEventDetailIds(seasonEventDetails.Select(s => s.Id).Distinct()).Where(w => w.TicketCategoryId == eventTicketDetail.TicketCategoryId);
                                List <Contracts.DataModels.EventTicketAttribute> seasonEventTicketAttributes = _eventTicketAttributeRepository.GetByEventTicketDetailIds(seasonEventTicketDetails.Select(s => s.Id).Distinct()).Where(W => W.IsEnabled == true && W.SeasonPackage == true).ToList();
                                var seasonPrice = seasonEventTicketAttributes[0].SeasonPackagePrice;
                                pricePerTicket = seasonPrice / seasonEventTicketAttributes.Count;
                            }
                            else
                            {
                                eventDetailId = eventDetail.Id;
                                lstEventDetailId.Add(new FIL.Contracts.Models.CartItemModel {
                                    EventDetailId = eventTicketDetail.EventDetailId
                                });
                                ticketCategoryId = eventTicketDetail.TicketCategoryId;
                            }

                            if (Convert.ToInt16(ticketAttributes.TotalTickets) <= checkoutCommandEventTicketAttribute.RemainingTicketForSale)
                            {
                                TransactionDetail transactionDetail = new TransactionDetail();
                                transactionDetail.EventTicketAttributeId = ticketAttributes.Id;
                                transactionDetail.TotalTickets           = Convert.ToInt16(ticketAttributes.TotalTickets);
                                transactionDetail.PricePerTicket         = checkoutCommand.TransactionType == TransactionType.Itinerary ? ticketAttributes.Price : pricePerTicket;
                                transactionDetail.DiscountAmount         = discountAmount;
                                transactionDetail.VisitDate       = visitStartDate;
                                transactionDetail.VisitEndDate    = visitEndDate;
                                transactionDetail.TransactionType = transactionType;
                                transactionDetail.TicketTypeId    = checkoutCommand.TransactionType == TransactionType.Itinerary ? (short)(ticketAttributes.IsAdult ? 10 : 2) : (short)(TicketType)ticketAttributes.TicketType;
                                if (checkoutCommand.ReferralId != null)
                                {
                                    var referral = _referralProvider.GetReferral(checkoutCommand.ReferralId, eventDetail.EventId, checkoutCommand.ModifiedBy);
                                    if (referral != null && referral.Id != 0)
                                    {
                                        transactionDetail.ReferralId = referral.Id;
                                    }
                                }
                                if (checkoutCommand.ChannelId == Channels.Feel && checkoutCommand.TransactionType != TransactionType.Itinerary)
                                {
                                    _geoCurrency.UpdateTransactionUpdates(transactionDetail, checkoutCommand.TargetCurrencyCode, checkoutCommandEventTicketAttribute.CurrencyId);
                                }
                                if (donationAmount > 0) // Donation doesn't need the local currency as the amount itself in the local currency
                                {
                                    transactionDetail.PricePerTicket = transactionDetail.PricePerTicket + donationAmount;
                                }
                                netTicketAmount               += ((ticketAttributes.TotalTickets * (decimal)transactionDetail.PricePerTicket) - ((decimal)transactionDetail.DiscountAmount));
                                grossTicketAmount             += ((ticketAttributes.TotalTickets * transactionDetail.PricePerTicket));
                                totalDiscountAmount           += (decimal)transactionDetail.DiscountAmount;
                                transactionDetail.MembershipId = ticketAttributes.MembershipId;
                                transactionDetailList.Add(transactionDetail);
                            }
                            else
                            {
                                EventDetail eventDetails = _eventDetailRepository.Get(eventDetailId);
                                Contracts.DataModels.TicketCategory ticketCategory = _ticketCategoryRepository.Get((int)ticketCategoryId);
                                return(new CheckoutCommandResult
                                {
                                    Id = 0,
                                    Success = false,
                                    EventName = eventDetails.Name,
                                    TicketCategoryName = ticketAttributes.TicketType == TicketType.SeasonPackage ? "Season - " + ticketCategory.Name : ticketCategory.Name,
                                    IsTransactionLimitExceed = false,
                                    IsTicketCategorySoldOut = true
                                });
                            }
                        }
                        else
                        {
                            EventDetail eventDetails = _eventDetailRepository.Get(eventDetailId);
                            Contracts.DataModels.TicketCategory ticketCategory = _ticketCategoryRepository.Get((int)ticketCategoryId);
                            return(new CheckoutCommandResult
                            {
                                Id = 0,
                                Success = false,
                                EventName = eventDetails.Name,
                                TicketCategoryName = ticketAttributes.TicketType == TicketType.SeasonPackage ? "Season - " + ticketCategory.Name : ticketCategory.Name,
                                IsTransactionLimitExceed = false,
                                IsTicketCategorySoldOut = true
                            });
                        }
                    }
                    else
                    {
                        EventDetail eventDetails = _eventDetailRepository.Get(eventDetailId);
                        Contracts.DataModels.TicketCategory ticketCategory = _ticketCategoryRepository.Get((int)ticketCategoryId);
                        return(new CheckoutCommandResult
                        {
                            Id = 0,
                            Success = false,
                            EventName = eventDetails.Name,
                            TicketCategoryName = ticketAttributes.TicketType == TicketType.SeasonPackage ? "Season - " + ticketCategory.Name : ticketCategory.Name,
                            IsTransactionLimitExceed = false,
                            IsTicketCategorySoldOut = true
                        });
                    }
                }
                var intialCurrencyId = eventTicketAttributeModel.Select(s => s.CurrencyId).FirstOrDefault();
                var currencyId       = eventTicketAttributeModel.Select(s => s.CurrencyId).FirstOrDefault();
                if (checkoutCommand.ChannelId == Channels.Feel) // Update the currencyId
                {
                    if (checkoutCommand.TransactionType == TransactionType.Itinerary)
                    {
                        currencyId = _geoCurrency.GetCurrencyID(checkoutCommand.TransactionCurrency).Id;
                    }
                    else
                    {
                        currencyId = _geoCurrency.GetCurrencyID(checkoutCommand.TargetCurrencyCode).Id;
                    }
                }

                /*if (checkoutCommand.ISRasv) // NAB test bed
                 * {
                 * var splitprice = netTicketAmount.ToString("0.00").Split(".");
                 *  var price = splitprice[0] + ".00";
                 * netTicketAmount = Convert.ToDecimal(netTicketAmount);
                 * }*/

                transaction.ChannelId           = checkoutCommand.ChannelId;
                transaction.CurrencyId          = currencyId;
                transaction.TotalTickets        = Convert.ToInt16(checkoutCommand.EventTicketAttributeList.Sum(s => s.TotalTickets));
                transaction.GrossTicketAmount   = grossTicketAmount;
                transaction.NetTicketAmount     = netTicketAmount;
                transaction.DiscountAmount      = totalDiscountAmount;
                transaction.TransactionStatusId = TransactionStatus.UnderPayment;
                transaction.FirstName           = user.FirstName;
                transaction.LastName            = user.LastName;
                transaction.PhoneCode           = user.PhoneCode;
                transaction.PhoneNumber         = user.Email == "*****@*****.**" ? checkoutCommand.GuestUser.PhoneNumber : user.PhoneNumber;
                transaction.EmailId             = user.Email == "*****@*****.**" ? checkoutCommand.GuestUser.PhoneNumber : user.Email;
                transaction.CountryName         = !string.IsNullOrWhiteSpace(user.PhoneCode) ? _countryRepository.GetByPhoneCode(user.PhoneCode).Name : "India";
                transaction.CreatedBy           = user.AltId;
                transaction.CreatedUtc          = DateTime.UtcNow;

                try
                {
                    var ipDetail = _saveIPProvider.SaveIp(checkoutCommand.Ip);
                    if (ipDetail != null && ipDetail.Id > 0)
                    {
                        transaction.IPDetailId = ipDetail.Id;
                    }
                }
                catch (Exception e)
                {
                    _logger.Log(Logging.Enums.LogCategory.Error, e);
                    transaction.IPDetailId = 1;
                }

                transaction.ModifiedBy = user.AltId;
                transaction.AltId      = Guid.NewGuid();
                if (transaction.CurrencyId != 7)
                {
                    transaction.OTP = checkoutCommand.OTPCode;
                }
                if (checkoutCommand.DonationAmount != null && checkoutCommand.DonationAmount != 0)
                {
                    transaction.DonationAmount = checkoutCommand.DonationAmount;
                }

                FIL.Contracts.DataModels.Transaction transactionResult = _transactionRepository.Save(transaction);
                foreach (TransactionDetail transactionDetail in transactionDetailList)
                {
                    transactionDetail.TransactionId = transactionResult.Id;
                    var currentTransactionDetail = _transactionDetailRepository.Save(transactionDetail);
                    FIL.Contracts.DataModels.EventTicketAttribute eventTicketAttribute = AutoMapper.Mapper.Map <FIL.Contracts.DataModels.EventTicketAttribute>(_eventTicketAttributeRepository.Get(transactionDetail.EventTicketAttributeId));
                    FIL.Contracts.DataModels.EventTicketDetail    eventTicketDetail    = AutoMapper.Mapper.Map <FIL.Contracts.DataModels.EventTicketDetail>(_eventTicketDetailRepository.Get(eventTicketAttribute.EventTicketDetailId));
                    if (Convert.ToInt16(transactionDetail.TotalTickets) <= eventTicketAttribute.RemainingTicketForSale)
                    {
                        eventTicketAttribute.RemainingTicketForSale -= transactionDetail.TotalTickets;
                        _eventTicketAttributeRepository.Save(eventTicketAttribute);
                        if (checkoutCommand.ChannelId == Channels.Website)
                        {
                            if (eventTicketDetail.InventoryTypeId == InventoryType.Seated || eventTicketDetail.InventoryTypeId == InventoryType.SeatedWithSeatSelection || eventTicketDetail.InventoryTypeId == InventoryType.NoneSeated)
                            {
                                List <Contracts.Models.TMS.SeatDetail> seatDetail = new List <Contracts.Models.TMS.SeatDetail>();
                                if (checkoutCommand.SeatDetails != null)
                                {
                                    seatDetail = AutoMapper.Mapper.Map <List <Contracts.Models.TMS.SeatDetail> >(checkoutCommand.SeatDetails.Where(w => w.EventTicketDetailId == eventTicketDetail.Id));
                                }
                                else
                                {
                                    seatDetail = null;
                                }
                                var seatBlock = _seatBlockingProvider.BlockSeat(seatDetail, transactionDetail, eventTicketAttribute, eventTicketDetail, user.AltId, Channels.Website);
                                if (!seatBlock.Success && seatBlock.IsSeatSoldOut)
                                {
                                    return(new CheckoutCommandResult
                                    {
                                        Success = false,
                                        Id = 0,
                                        TransactionAltId = Guid.NewGuid(),
                                        IsTransactionLimitExceed = false,
                                        IsTicketCategorySoldOut = false,
                                        IsSeatSoldOut = true
                                    });
                                }
                            }
                        }
                    }
                    else
                    {
                        EventDetail eventDetails = _eventDetailRepository.Get(eventDetailId);
                        Contracts.DataModels.TicketCategory ticketCategory = _ticketCategoryRepository.Get((int)ticketCategoryId);
                        return(new CheckoutCommandResult
                        {
                            Id = 0,
                            Success = false,
                            EventName = eventDetails.Name,
                            TicketCategoryName = transactionDetail.TicketTypeId == (short)TicketType.SeasonPackage ? "Season - " + ticketCategory.Name : ticketCategory.Name,
                            IsTransactionLimitExceed = false,
                            IsTicketCategorySoldOut = true
                        });
                    }
                    /* Save Transaction Schedule Detail */
                    var currentTicket = checkoutCommand.EventTicketAttributeList.Where(s => s.Id == currentTransactionDetail.EventTicketAttributeId).FirstOrDefault();
                    if (currentTicket.ScheduleDetailId != null && currentTicket.ScheduleDetailId != 0)
                    {
                        _saveTransactionScheduleDetailProvider.SaveTransactionScheduleDetail(currentTransactionDetail.Id, (long)currentTicket.ScheduleDetailId);
                    }
                }

                try
                {
                    if (checkoutCommand.ChannelId == Channels.Feel || checkoutCommand.ChannelId == Channels.Website) // If Live Online Transaction with 0.00 price
                    {
                        var @event = _eventRepository.Get(allED.FirstOrDefault().EventId);
                        if (@event != null)
                        {
                            if (@event.MasterEventTypeId == Contracts.Enums.MasterEventType.Online && transaction.NetTicketAmount == 0)
                            {
                                _zoomMeetingProvider.CreateMeeting(transaction, true);
                                isPaymentBypass = true;
                            }
                            else if (@event.MasterEventTypeId == Contracts.Enums.MasterEventType.Online)
                            {
                                StripeAccount = _eventStripeConnectAccountProvider.GetEventStripeAccount(allED.FirstOrDefault().EventId, checkoutCommand.ChannelId);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    _logger.Log(Logging.Enums.LogCategory.Error, e);
                }
                try
                {
                    /*Check if referred transactionId already upgraded to BSP or successfull transaction, if yes then don't allow another transaction using same referral/ transaction id*/
                    if (checkoutCommand.IsBSPUpgrade && checkoutCommand.ReferralId != null)
                    {
                        var transactions = _transactionRepository.GetAllSuccessfulTransactionByReferralId(checkoutCommand.ReferralId);
                        if (transactions.Any())
                        {
                            return(new CheckoutCommandResult
                            {
                                Id = 0,
                                Success = false,
                                IsBSPUpgraded = true
                            });
                        }
                    }
                }
                catch (Exception e)
                {
                    _logger.Log(Logging.Enums.LogCategory.Error, e);
                }

                return(new CheckoutCommandResult
                {
                    Id = transactionResult.Id,
                    CartBookingModel = lstEventDetailId,
                    Transaction = transactionResult,
                    IsPaymentByPass = isPaymentBypass,
                    Success = true,
                    StripeAccount = StripeAccount,
                });
            }
            catch (Exception e)
            {
                _logger.Log(Logging.Enums.LogCategory.Error, e);
                return(new CheckoutCommandResult
                {
                });
            }
        }