コード例 #1
0
        public void Handle(RedeemPromotion command)
        {
            var promotion = _repository.Get(command.PromoId);

            promotion.Redeem(command.OrderId, command.TaxedMeterAmount, command.TipAmount);

            _repository.Save(promotion, command.Id.ToString());
        }
コード例 #2
0
        public void Handle(CreditCardPaymentCaptured_V2 @event)
        {
            // Migration
            @event.MigrateFees();

            if (@event.FeeType != FeeTypes.None)
            {
                // Don't message driver
                return;
            }

            var taxedMeterAmount = @event.Meter + @event.Tax;

            if (_serverSettings.ServerData.SendDetailedPaymentInfoToDriver &&
                [email protected])    // Don't send notification to driver when user settles overdue payment
            {
                // To prevent driver confusion we will not send the discounted total amount for the fare.
                // We will also not send booking fee since it could be from a market company and the driver would not know where it's coming from.
                var totalAmountBeforePromotionAndBookingFees = @event.Amount + @event.AmountSavedByPromotion - @event.BookingFees;
                SendPaymentConfirmationToDriver(@event.OrderId, totalAmountBeforePromotionAndBookingFees, taxedMeterAmount, @event.Tip, @event.Provider.ToString(), @event.AuthorizationCode);
            }

            if (@event.PromotionUsed.HasValue)
            {
                var redeemPromotion = new RedeemPromotion
                {
                    OrderId          = @event.OrderId,
                    PromoId          = @event.PromotionUsed.Value,
                    TaxedMeterAmount = taxedMeterAmount, // MK: Booking fees don't count towards promo rebate (2015/05/25)
                    TipAmount        = @event.Tip
                };

                var envelope = (Envelope <ICommand>)redeemPromotion;

                _commandBus.Send(envelope);
            }
        }