public void Handle(CustomerPreferredWarningTimeoutEvent message)
        {
            if (message.Type != "first") //Offer only at first timeout warning
            {
                MarkAsComplete();
                return;
            }

            if (Data.UserId != Guid.Empty)
            {
                return;
            }


            Data.UserId      = message.UserId;
            Data.DaysOfBonus = 14;
            SetupExtensionBonusOfferTimeout(GetTimeoutTime(message));
        }
        public void Timeout(PreferredCustomerSagaTimeoutMessage state)
        {
            if (state.TimeoutId == this.Data.TimeoutGroupId)
            {
                switch (state.TimeoutType)
                {
                case FIRST_WARNING:
                    var first = new CustomerPreferredWarningTimeoutEvent
                    {
                        CorrelationId = Guid.NewGuid(),
                        UserId        = this.Data.UserId,
                        EndsAt        = this.Data.EndsAt,
                        Type          = "first"
                    };
                    Bus.Publish(first);
                    break;

                case SECOND_WARNING:
                    var second = new CustomerPreferredWarningTimeoutEvent
                    {
                        CorrelationId = Guid.NewGuid(),
                        UserId        = this.Data.UserId,
                        EndsAt        = this.Data.EndsAt,
                        Type          = "second"
                    };
                    Bus.Publish(second);
                    break;

                case TIMEOUT:
                    var evnt = new CustomerPreferredTimeoutEvent
                    {
                        CorrelationId = Guid.NewGuid(),
                        UserId        = this.Data.UserId,
                        TimedOutAt    = DateTime.Now,
                        EndedAt       = this.Data.EndsAt
                    };
                    Bus.Publish(evnt);
                    MarkAsComplete();
                    break;
                }
            }
        }
 private static DateTime GetTimeoutTime(CustomerPreferredWarningTimeoutEvent message)
 {
     return(DateTime.Now.AddDays(1));
 }