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(); } }
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); }
public PaymentCacheItem(ESubscriptionPaymentGatewayType gateWay, EPaymentPeriodType paymentPeriodType, string paymentId) { GateWay = gateWay; PaymentId = paymentId; PaymentPeriodType = paymentPeriodType; }