Exemple #1
0
        public void UpdateSubscriptionDateForPayment(EPaymentPeriodType paymentPeriodType, EEditionPaymentType editionPaymentType)
        {
            switch (editionPaymentType)
            {
            case EEditionPaymentType.NewRegistration:
            case EEditionPaymentType.BuyNow:
            {
                SubscriptionEndDateUtc = Clock.Now.ToUniversalTime().AddDays((int)paymentPeriodType);
                break;
            }

            case EEditionPaymentType.Extend:
                ExtendSubscriptionDate(paymentPeriodType);
                break;

            case EEditionPaymentType.Upgrade:
                if (HasUnlimitedTimeSubscription())
                {
                    SubscriptionEndDateUtc = Clock.Now.ToUniversalTime().AddDays((int)paymentPeriodType);
                }
                break;

            default:
                throw new ArgumentException();
            }
        }
Exemple #2
0
        private void ExtendSubscriptionDate(EPaymentPeriodType paymentPeriodType)
        {
            if (SubscriptionEndDateUtc == null)
            {
                throw new InvalidOperationException("Can not extend subscription date while it's null!");
            }

            if (IsSubscriptionEnded())
            {
                SubscriptionEndDateUtc = Clock.Now.ToUniversalTime();
            }

            SubscriptionEndDateUtc = SubscriptionEndDateUtc.Value.AddDays((int)paymentPeriodType);
        }
Exemple #3
0
 public PaymentCacheItem(ESubscriptionPaymentGatewayType gateWay, EPaymentPeriodType paymentPeriodType, string paymentId)
 {
     GateWay           = gateWay;
     PaymentId         = paymentId;
     PaymentPeriodType = paymentPeriodType;
 }