internal void Validate()
        {
            if (BaseUri == null)
            {
                throw new ArgumentNullException(nameof(BaseUri));
            }
            if (!BaseUri.IsAbsoluteUri)
            {
                throw new ArgumentException($"{nameof(BaseUri)} should be absolute.");
            }

            if (PurchaseAttemptPath.IsEmpty())
            {
                throw new ArgumentNullException(nameof(PurchaseAttemptPath));
            }

            if (SubscriptionStatusPath.IsEmpty())
            {
                throw new ArgumentNullException(nameof(SubscriptionStatusPath));
            }

            if (CatalogPath.IsEmpty())
            {
                throw new ArgumentNullException(nameof(CatalogPath));
            }
        }
Esempio n. 2
0
        public BillingContextOptions()
        {
            var baseUrl = Config.Get("Billing.Base.Url", Config.Get("Api.Base.Url"));

            if (baseUrl.HasValue())
            {
                BaseUri = new Uri(baseUrl);
            }

            if (BaseUri == null)
            {
                throw new ArgumentNullException(nameof(BaseUri), "Add Billing.Base.Url or Api.Base.Url to your Config.xml");
            }

            if (!BaseUri.IsAbsoluteUri)
            {
                throw new ArgumentException($"{nameof(BaseUri)} should be absolute.");
            }

            if (PurchaseAttemptPath.IsEmpty())
            {
                throw new ArgumentNullException(nameof(PurchaseAttemptPath));
            }

            if (VoucherApplyPath.IsEmpty())
            {
                throw new ArgumentNullException(nameof(VoucherApplyPath));
            }

            if (SubscriptionStatusPath.IsEmpty())
            {
                throw new ArgumentNullException(nameof(SubscriptionStatusPath));
            }

            if (CatalogPath.IsEmpty())
            {
                throw new ArgumentNullException(nameof(CatalogPath));
            }
        }