Ejemplo n.º 1
0
        public void AddPlan(string planName, string externalKey, int amountInCents, Currency currency, BillingInterval interval)
        {
            var existingPlanForProduct = _plans.Where(o => o.ExternalKey == externalKey)
                                         .SingleOrDefault();

            if (existingPlanForProduct == null)
            {
                var plan = new Plan(planName, externalKey);
                plan.SetPricing(amountInCents, currency, interval);
                _plans.Add(plan);
            }
        }
Ejemplo n.º 2
0
 internal void SetPricing(int amountInCents, Currency currency, BillingInterval interval)
 {
     AmountInCents = (amountInCents >= 0) ? amountInCents : throw new ArgumentException("Invalid amount in cents");
     Currency      = currency ?? throw new ArgumentNullException(nameof(currency));
     Interval      = interval ?? throw new ArgumentNullException(nameof(interval));
 }