Ejemplo n.º 1
0
 /// <summary>
 /// Constructs the Endpoint object based on the SdkConfig params
 /// <seealso cref="SdkConfig"/>
 /// </summary>
 /// <param name="config"></param>
 public Endpoint(SdkConfig config)
 {
     if (String.IsNullOrWhiteSpace(config.EndpointUrl))
     {
         Url = Environment.GetEnvironmentVariable(EndpointUrlEnvName);
     }
     else
     {
         Url = config.EndpointUrl;
     }
 }
Ejemplo n.º 2
0
 public new async Task <SynchronousResponse> Execute(
     Content contentBlock,
     bool transaction              = false,
     string requestControlId       = null,
     bool uniqueFunctionControlIds = false,
     SdkConfig config              = null
     )
 {
     if (config == null)
     {
         config = new SdkConfig();
     }
     return(await base.Execute(contentBlock, transaction, requestControlId, uniqueFunctionControlIds, config));
 }
Ejemplo n.º 3
0
        protected async Task <AsynchronousResponse> ExecuteAsync(
            Content contentBlock,
            string asyncPolicyId,
            bool transaction,
            string requestControlId,
            bool uniqueFunctionControlIds,
            SdkConfig config
            )
        {
            SdkConfig sessionConfig = SessionConfig();

            if (String.IsNullOrWhiteSpace(config.PolicyId))
            {
                config.PolicyId = asyncPolicyId;
            }

            if (!String.IsNullOrWhiteSpace(sessionConfig.SenderId))
            {
                config.SenderId = sessionConfig.SenderId;
            }

            if (!String.IsNullOrWhiteSpace(sessionConfig.SenderPassword))
            {
                config.SenderPassword = sessionConfig.SenderPassword;
            }

            if (!String.IsNullOrWhiteSpace(sessionConfig.EndpointUrl))
            {
                config.EndpointUrl = sessionConfig.EndpointUrl;
            }

            if (!String.IsNullOrWhiteSpace(sessionConfig.SessionId))
            {
                config.SessionId = sessionConfig.SessionId;
            }

            config.Logger       = config.Logger != null ? config.Logger : sessionConfig.Logger;
            config.LogFormatter = config.LogFormatter != null ? config.LogFormatter : sessionConfig.LogFormatter;
            config.LogLevel     = config.LogLevel != null ? config.LogLevel : sessionConfig.LogLevel;

            config.Transaction = transaction;
            config.ControlId   = requestControlId;
            config.UniqueId    = uniqueFunctionControlIds;

            RequestHandler requestHandler = new RequestHandler(config);

            AsynchronousResponse response = await requestHandler.ExecuteAsynchronous(config, contentBlock);

            return(response);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructs an SdkConfig object based on the environment/config/runtime params
        /// </summary>
        /// <returns></returns>
        private SdkConfig SessionConfig()
        {
            SdkConfig config = new SdkConfig()
            {
                SenderId       = sessionCreds.SenderCreds.SenderId,
                SenderPassword = sessionCreds.SenderCreds.Password,
                EndpointUrl    = sessionCreds.Endpoint.Url,
                SessionId      = sessionCreds.SessionId,
                Logger         = sessionCreds.Logger,
                LogFormatter   = sessionCreds.LogMessageFormat,
                LogLevel       = sessionCreds.LogLevel,
            };

            return(config);
        }
Ejemplo n.º 5
0
        private async Task InitializeAsync(SdkConfig config)
        {
            if (String.IsNullOrWhiteSpace(config.ProfileName))
            {
                config.ProfileName = Environment.GetEnvironmentVariable(ProfileEnvName);
            }

            SessionProvider provider = new SessionProvider();

            SenderCredentials senderCreds = new SenderCredentials(config);

            if (!String.IsNullOrWhiteSpace(config.SessionId))
            {
                SessionCredentials session = new SessionCredentials(config, senderCreds);

                sessionCreds = await provider.FromSessionCredentials(session);
            }
            else
            {
                LoginCredentials login = new LoginCredentials(config, senderCreds);

                sessionCreds = await provider.FromLoginCredentials(login);
            }
        }
Ejemplo n.º 6
0
 public IntacctClient(SdkConfig config) : base(config)
 {
 }
Ejemplo n.º 7
0
 public AbstractClient(SdkConfig config)
 {
     InitializeAsync(config).Wait();
 }