Beispiel #1
0
        public void Handle(CancelSeatReservation command)
        {
            var availability = repository.Get(command.ConferenceId);

            availability.CancelReservation(command.ReservationId);
            repository.Save(availability, command.Id.ToString());
        }
        public void Handle(MarkSeatsAsReserved command)
        {
            var order = repository.Get(command.OrderId);

            order.MarkAsReserved(this.pricingService, command.Expiration, command.Seats);
            repository.Save(order, command.Id.ToString());
        }
Beispiel #3
0
        public void Handle(AssignSeat command)
        {
            var assignments = assignmentsRepo.Get(command.SeatAssignmentsId);

            assignments.AssignSeat(command.Position, command.Attendee);
            assignmentsRepo.Save(assignments, command.Id.ToString());
        }
Beispiel #4
0
        public void Handle(AddOrUpdateUserTaxiHailNetworkSettings command)
        {
            var account = _repository.Get(command.AccountId);

            account.AddOrUpdateTaxiHailNetworkSettings(command.IsEnabled, command.DisabledFleets);
            _repository.Save(account, command.Id.ToString());
        }
        public void Handle(AssignRegistrantDetails command)
        {
            var order = repository.Get(command.OrderId);

            order.AssignRegistrant(command.FirstName, command.LastName, command.Email);
            repository.Save(order, command.Id.ToString());
        }
        public async Task Consume(ConsumeContext <MarkSeatsAsReserved> commandContext)
        {
            var order = await repository.Get(commandContext.Message.OrderId);

            order.MarkAsReserved(this.pricingService, commandContext.Message.Expiration, commandContext.Message.Seats);
            await repository.Save(order, commandContext.Message.Id.ToString());
        }
Beispiel #7
0
        public void Handle(CaptureCreditCardPayment command)
        {
            var payment = _repository.Get(command.PaymentId);

            payment.Capture(command.Provider, command.TotalAmount, command.MeterAmount, command.TipAmount,
                            command.TaxAmount, command.TollAmount, command.SurchargeAmount, command.AuthorizationCode, command.TransactionId,
                            command.PromotionUsed, command.AmountSavedByPromotion, command.NewCardToken,
                            command.AccountId, command.IsSettlingOverduePayment, command.IsForPrepaidOrder, command.FeeType, command.BookingFees);
            _repository.Save(payment, command.Id.ToString());
        }
        public void Handle(InitiateIbsOrderSwitch command)
        {
            var order = _repository.Get(command.NewOrderCommand.OrderId);

            order.InitiateIbsOrderSwitch(command.NewIbsAccountId, command.NewOrderCommand);
            _repository.Save(order, command.Id.ToString());
        }
Beispiel #9
0
        public void Handle(OrderConfirmed @event)
        {
            var order       = ordersRepo.Get(@event.SourceId);
            var assignments = order.CreateSeatAssignments();

            assignmentsRepo.Save(assignments, null);
        }
Beispiel #10
0
        public void Handle(UpdatePromotion command)
        {
            var promotion = _repository.Get(command.PromoId);

            promotion.Update(command.Name, command.Description, command.StartDate, command.EndDate, command.StartTime, command.EndTime,
                             command.DaysOfWeek, command.AppliesToCurrentBooking, command.AppliesToFutureBooking, command.DiscountValue, command.DiscountType,
                             command.MaxUsagePerUser, command.MaxUsage, command.Code, command.PublishedStartDate, command.PublishedEndDate, command.TriggerSettings);

            _repository.Save(promotion, command.Id.ToString());
        }
Beispiel #11
0
        public void Handle(UserCreated @event)
        {
            var user = _repository.Get <User>(@event.SourceId);

            using (var context = _contextFactory.CreateDataContext()) {
                context.Save(user);
                context.Commit();
            }

            Console.ResetColor();
            Console.WriteLine("Synchorize to Query db");
        }
Beispiel #12
0
 public void Handle(AddOrUpdateNotificationSettings command)
 {
     if (command.AccountId.HasValue)
     {
         var account = _accountRepository.Get(command.AccountId.Value);
         account.AddOrUpdateNotificationSettings(command.NotificationSettings);
         _accountRepository.Save(account, command.Id.ToString());
     }
     else
     {
         var company = _repository.Get(command.CompanyId);
         company.AddOrUpdateNotificationSettings(command.NotificationSettings);
         _repository.Save(company, command.Id.ToString());
     }
 }
Beispiel #13
0
        private Guid?ValidatePromotion(string companyKey, string promoCode, int?chargeTypeId, Guid accountId, DateTime pickupDate, bool isFutureBooking, string clientLanguageCode, CreateReportOrder createReportOrder)
        {
            if (!promoCode.HasValue())
            {
                // No promo code entered
                return(null);
            }

            var usingPaymentInApp = chargeTypeId == ChargeTypes.CardOnFile.Id || chargeTypeId == ChargeTypes.PayPal.Id;

            if (!usingPaymentInApp)
            {
                var payPalIsEnabled     = _serverSettings.GetPaymentSettings(companyKey).PayPalClientSettings.IsEnabled;
                var cardOnFileIsEnabled = _serverSettings.GetPaymentSettings(companyKey).IsPayInTaxiEnabled;

                var promotionErrorResourceKey = "CannotCreateOrder_PromotionMustUseCardOnFile";
                if (payPalIsEnabled && cardOnFileIsEnabled)
                {
                    promotionErrorResourceKey = "CannotCreateOrder_PromotionMustUseCardOnFileOrPayPal";
                }
                else if (payPalIsEnabled)
                {
                    promotionErrorResourceKey = "CannotCreateOrder_PromotionMustUsePayPal";
                }

                // Should never happen since we will check client-side if there's a promocode and not paying with CoF/PayPal
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable, _resources.Get(promotionErrorResourceKey, clientLanguageCode));
            }

            var promo = _promotionDao.FindByPromoCode(promoCode);

            if (promo == null)
            {
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable, _resources.Get("CannotCreateOrder_PromotionDoesNotExist", clientLanguageCode));
            }

            var    promoDomainObject = _promoRepository.Get(promo.Id);
            string errorMessage;

            if (!promoDomainObject.CanApply(accountId, pickupDate, isFutureBooking, out errorMessage))
            {
                ThrowAndLogException(createReportOrder, ErrorCode.CreateOrder_RuleDisable, _resources.Get(errorMessage, clientLanguageCode));
            }

            return(promo.Id);
        }
Beispiel #14
0
        public IEnumerable <PromotionDetail> GetUnlockedPromotionsForUser(Guid accountId)
        {
            var now = GetCurrentOffsetedTime();

            var activePublishedPromotions = GetAllCurrentlyActiveAndPublished();

            // Add all published promotions
            foreach (var activePublishedPromotion in activePublishedPromotions)
            {
                string errorMessage;
                var    promoDomainObject = _promoRepository.Get(activePublishedPromotion.Id);

                if (promoDomainObject.CanApply(accountId, now, false, out errorMessage))
                {
                    yield return(activePublishedPromotion);
                }
            }
        }
Beispiel #15
0
 public async Task <TAggregate> Get(string id)
 {
     return(await innerRepository.Get(id));
 }
Beispiel #16
0
        public void Handle(ActivateRule command)
        {
            var company = _repository.Get(command.CompanyId);

            company.ActivateRule(command.RuleId);
            _repository.Save(company, command.Id.ToString());
        }