diff options
Diffstat (limited to 'src/IOL.VippsEcommerce/Models')
| -rw-r--r-- | src/IOL.VippsEcommerce/Models/VippsConfiguration.cs | 36 | ||||
| -rw-r--r-- | src/IOL.VippsEcommerce/Models/VippsConfigurationKeyNames.cs | 26 |
2 files changed, 31 insertions, 31 deletions
diff --git a/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs b/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs index 2fcc91a..584ff2b 100644 --- a/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs +++ b/src/IOL.VippsEcommerce/Models/VippsConfiguration.cs @@ -13,21 +13,21 @@ namespace IOL.VippsEcommerce.Models /// <example>https://api.vipps.no</example> /// <para>Corresponding environment variable name: VIPPS_API_URL</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_API_URL)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.API_URL)] public string ApiUrl { get; set; } /// <summary> /// Client ID for the merchant (the "username"). This property is required. /// <para>Corresponding environment variable name: VIPPS_CLIENT_ID</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_CLIENT_ID)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.CLIENT_ID)] public string ClientId { get; set; } /// <summary> /// Client Secret for the merchant (the "password"). This property is required. /// <para>Corresponding environment variable name: VIPPS_CLIENT_SECRET</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_CLIENT_SECRET)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.CLIENT_SECRET)] public string ClientSecret { get; set; } /// <summary> @@ -36,7 +36,7 @@ namespace IOL.VippsEcommerce.Models /// <para>Either primary subscription key or secondary subscription key is required.</para> /// <para>Corresponding environment variable name: VIPPS_SUBSCRIPTION_KEY_PRIMARY</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_SUBSCRIPTION_KEY_PRIMARY)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.SUBSCRIPTION_KEY_PRIMARY)] public string PrimarySubscriptionKey { get; set; } /// <summary> @@ -45,56 +45,56 @@ namespace IOL.VippsEcommerce.Models /// <para>Either primary subscription key or secondary subscription key is required.</para> /// <para>Corresponding environment variable name: VIPPS_SUBSCRIPTION_KEY_SECONDARY</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_SUBSCRIPTION_KEY_SECONDARY)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.SUBSCRIPTION_KEY_SECONDARY)] public string SecondarySubscriptionKey { get; set; } /// <summary> /// The Merchant Serial Number (MSN) is a unique id for the sale unit that this payment is made for. /// <para>Corresponding environment variable name: VIPPS_MSN</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_MSN)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.MSN)] public string MerchantSerialNumber { get; set; } /// <summary> /// The name of the ecommerce solution. One word in lowercase letters is good. /// <para>Corresponding environment variable name: VIPPS_SYSTEM_NAME</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_SYSTEM_NAME)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.SYSTEM_NAME)] public string SystemName { get; set; } /// <summary> /// The version number of the ecommerce solution. /// <para>Corresponding environment variable name: VIPPS_SYSTEM_VERSION</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_SYSTEM_VERSION)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.SYSTEM_VERSION)] public string SystemVersion { get; set; } /// <summary> /// The name of the ecommerce plugin (if applicable). One word in lowercase letters is good. /// <para>Corresponding environment variable name: VIPPS_SYSTEM_PLUGIN_NAME</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_SYSTEM_PLUGIN_NAME)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.SYSTEM_PLUGIN_NAME)] public string SystemPluginName { get; set; } /// <summary> /// The version number of the ecommerce plugin (if applicable). /// <para>Corresponding environment variable name: VIPPS_SYSTEM_PLUGIN_VERSION</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_SYSTEM_PLUGIN_VERSION)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.SYSTEM_PLUGIN_VERSION)] public string SystemPluginVersion { get; set; } /// <summary> /// Optional path to a writable directory wherein a credential cache file can be placed. /// <para>Corresponding environment variable name: VIPPS_CACHE_PATH</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_CACHE_PATH)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.CACHE_PATH)] public string CacheDirectoryPath { get; set; } /// <summary> /// Optional key for AES encryption of the credential cache file. /// <para>Corresponding environment variable name: VIPPS_CACHE_KEY</para> /// </summary> - [VippsConfigurationKeyName(VippsConfigurationKeyNames.VIPPS_CACHE_KEY)] + [VippsConfigurationKeyName(VippsConfigurationKeyNames.CACHE_KEY)] public string CacheEncryptionKey { get; set; } /// <summary> @@ -127,23 +127,23 @@ namespace IOL.VippsEcommerce.Models /// <exception cref="ArgumentNullException">Throws if a required value is null or whitespace.</exception> /// </summary> public void Verify() { - if (GetValue(VippsConfigurationKeyNames.VIPPS_API_URL).IsNullOrWhiteSpace()) { + if (GetValue(VippsConfigurationKeyNames.API_URL).IsNullOrWhiteSpace()) { throw new ArgumentNullException(nameof(ApiUrl), "VippsEcommerceService: ApiUrl is not provided in configuration."); } - if (GetValue(VippsConfigurationKeyNames.VIPPS_CLIENT_ID).IsNullOrWhiteSpace()) { + if (GetValue(VippsConfigurationKeyNames.CLIENT_ID).IsNullOrWhiteSpace()) { throw new ArgumentNullException(nameof(ClientId), "VippsEcommerceService: ClientId is not provided in configuration."); } - if (GetValue(VippsConfigurationKeyNames.VIPPS_CLIENT_SECRET).IsNullOrWhiteSpace()) { + if (GetValue(VippsConfigurationKeyNames.CLIENT_SECRET).IsNullOrWhiteSpace()) { throw new ArgumentNullException(nameof(ClientSecret), "VippsEcommerceService: ClientSecret is not provided in configuration."); } - if (GetValue(VippsConfigurationKeyNames.VIPPS_SUBSCRIPTION_KEY_PRIMARY).IsNullOrWhiteSpace() - && GetValue(VippsConfigurationKeyNames.VIPPS_SUBSCRIPTION_KEY_SECONDARY).IsNullOrWhiteSpace()) { + if (GetValue(VippsConfigurationKeyNames.SUBSCRIPTION_KEY_PRIMARY).IsNullOrWhiteSpace() + && GetValue(VippsConfigurationKeyNames.SUBSCRIPTION_KEY_SECONDARY).IsNullOrWhiteSpace()) { throw new ArgumentNullException(nameof(PrimarySubscriptionKey) + nameof(SecondarySubscriptionKey), "VippsEcommerceService: Neither PrimarySubscriptionKey nor SecondarySubscriptionKey was provided in configuration."); @@ -182,4 +182,4 @@ namespace IOL.VippsEcommerce.Models return default; } } -}
\ No newline at end of file +} diff --git a/src/IOL.VippsEcommerce/Models/VippsConfigurationKeyNames.cs b/src/IOL.VippsEcommerce/Models/VippsConfigurationKeyNames.cs index 4b25c7d..c966762 100644 --- a/src/IOL.VippsEcommerce/Models/VippsConfigurationKeyNames.cs +++ b/src/IOL.VippsEcommerce/Models/VippsConfigurationKeyNames.cs @@ -2,17 +2,17 @@ namespace IOL.VippsEcommerce.Models { public static class VippsConfigurationKeyNames { - public const string VIPPS_API_URL = "VIPPS_API_URL"; - public const string VIPPS_CLIENT_ID = "VIPPS_CLIENT_ID"; - public const string VIPPS_CLIENT_SECRET = "VIPPS_CLIENT_SECRET"; - public const string VIPPS_SUBSCRIPTION_KEY_PRIMARY = "VIPPS_SUBSCRIPTION_KEY_PRIMARY"; - public const string VIPPS_SUBSCRIPTION_KEY_SECONDARY = "VIPPS_SUBSCRIPTION_KEY_SECONDARY"; - public const string VIPPS_MSN = "VIPPS_MSN"; - public const string VIPPS_SYSTEM_NAME = "VIPPS_SYSTEM_NAME"; - public const string VIPPS_SYSTEM_VERSION = "VIPPS_SYSTEM_VERSION"; - public const string VIPPS_SYSTEM_PLUGIN_NAME = "VIPPS_SYSTEM_PLUGIN_NAME"; - public const string VIPPS_SYSTEM_PLUGIN_VERSION = "VIPPS_SYSTEM_PLUGIN_VERSION"; - public const string VIPPS_CACHE_PATH = "VIPPS_CACHE_PATH"; - public const string VIPPS_CACHE_KEY = "VIPPS_CACHE_KEY"; + public const string API_URL = "VIPPS_API_URL"; + public const string CLIENT_ID = "VIPPS_CLIENT_ID"; + public const string CLIENT_SECRET = "VIPPS_CLIENT_SECRET"; + public const string SUBSCRIPTION_KEY_PRIMARY = "VIPPS_SUBSCRIPTION_KEY_PRIMARY"; + public const string SUBSCRIPTION_KEY_SECONDARY = "VIPPS_SUBSCRIPTION_KEY_SECONDARY"; + public const string MSN = "VIPPS_MSN"; + public const string SYSTEM_NAME = "VIPPS_SYSTEM_NAME"; + public const string SYSTEM_VERSION = "VIPPS_SYSTEM_VERSION"; + public const string SYSTEM_PLUGIN_NAME = "VIPPS_SYSTEM_PLUGIN_NAME"; + public const string SYSTEM_PLUGIN_VERSION = "VIPPS_SYSTEM_PLUGIN_VERSION"; + public const string CACHE_PATH = "VIPPS_CACHE_PATH"; + public const string CACHE_KEY = "VIPPS_CACHE_KEY"; } -}
\ No newline at end of file +} |
