示例#1
0
        /// <summary>
        /// Calculate subscription payment based on subscription level and term
        /// </summary>
        /// <param name="subscriptionPlan">customer's subscription plan</param>
        /// <returns>subscription payment customer should pay</returns>
        public double CalculatePayment(SubscriptionPlan subscriptionPlan)
        {
            IPaymentStrategy paymentStrategy = _paymentStrategyFactory.GetPaymentStratgey(subscriptionPlan.Level.ToString());

            if (paymentStrategy == null)
            {
                return(-1d);
            }

            return(paymentStrategy.CalculatePayment(subscriptionPlan));
        }