/// <summary>
        ///
        /// </summary>
        /// <param name="sandbox"></param>
        /// <returns></returns>
        public static ApplicationCredentials ApplicationCredentials(bool?sandbox = null)
        {
            if (!sandbox.HasValue)
            {
                sandbox = Sandbox;
            }
            if (Configuration == null)
            {
                return(PagSeguroConfigSerializer.GetApplicationCredentials(LoadXmlConfig(), sandbox.Value));
            }

            return(sandbox.Value ?
                   new Domain.ApplicationCredentials(appId: Configuration.Credential.SandboxAppId.Value.ToString(), appKey: Configuration.Credential.SandboxAppKey.Value.ToString()) :
                   new Domain.ApplicationCredentials(appId: Configuration.Credential.AppId.Value.ToString(), appKey: Configuration.Credential.AppKey.Value.ToString()));
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        public static ApplicationCredentials GetApplicationCredentials(bool isSandbox, string appId = null, string appKey = null)
        {
            var appConfig = GetAppConfig(isSandbox, null, null, appId, appKey);

            if (appConfig == null)
            {
                return(PagSeguroConfigSerializer.GetApplicationCredentials(XmlConfiguration, isSandbox));
            }

            appId  = appConfig.GetCredentialAppId(isSandbox);
            appKey = appConfig.GetCredentialAppKey(isSandbox);
            if (string.IsNullOrWhiteSpace(appId) && string.IsNullOrWhiteSpace(appKey))
            {
                return(PagSeguroConfigSerializer.GetApplicationCredentials(XmlConfiguration, isSandbox));
            }

            return(new ApplicationCredentials(isSandbox, appId, appKey));
        }
 /// <summary>
 ///
 /// </summary>
 public static ApplicationCredentials ApplicationCredentials(bool sandbox)
 {
     return(PagSeguroConfigSerializer.GetApplicationCredentials(LoadXmlConfig(), sandbox));
 }