Represents configuration parameters required to perform SHOPIFY OAUTH 2.0 authorization for a shop.
Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShopifyOAuth"/> class.
        /// <para>Use this constructor in case you do not wish this library to fetch API and Secret Key from configuration file.</para>
        /// </summary>
        /// <param name="configuration">Instance of OAUTH settings.</param>
        /// <exception cref="ArgumentNullException">Throws argument null exception if input parameters are null or empty.</exception>
        public ShopifyOAuth(OAuthConfiguration configuration)
        {
            if (null == configuration)
            {
                throw new ArgumentNullException("configuration");
            }

            this.Configuration = configuration;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ShopifyOAuth"/> class.
        /// <para>Use this constructor in case you do not wish this library to fetch API and Secret Key from configuration file.</para>
        /// </summary>
        /// <param name="configuration">Instance of OAUTH settings.</param>
        /// <exception cref="ArgumentNullException">Throws argument null exception if input parameters are null or empty.</exception>
        public ShopifyOAuth(OAuthConfiguration configuration)
        {
            if (null == configuration)
            {
                throw new ArgumentNullException("configuration");
            }

            this.Configuration = configuration;
        }
        private static void LoadShopifySecretKeySetting(OAuthConfiguration configuration)
        {
            if (!string.IsNullOrEmpty(configuration.SecretKey))
            {
                return;
            }

            var secretKeyConfigurationValue = ConfigurationManager.AppSettings[AppResources.KeyShopifyAppSecret];

            if (!string.IsNullOrEmpty(secretKeyConfigurationValue))
            {
                configuration.SecretKey = secretKeyConfigurationValue;
            }
            else
            {
                throw new ArgumentException(AppResources.SecretKeyNotFoundException);
            }
        }