Example #1
0
        public static ApiEnvironmentType DetermineEnvironmentType(string[] args)
        {
            new OptionSet
            {
                { OptionProduction, v => _environmentType = ApiEnvironmentType.PRODUCTION }
            }.Parse(args);

            return(_environmentType);
        }
Example #2
0
        public Bunq(string ApiKey, bool SandBox, PHue.Hue hueCommands)
        {
            ApiEnvironmentType EnvType = ApiEnvironmentType.PRODUCTION;

            if (SandBox)
            {
                EnvType = ApiEnvironmentType.SANDBOX;
            }

            _bunqApi = ApiContext.Create(EnvType, ApiKey, "BunqHue");
            BunqContext.LoadApiContext(_bunqApi);
            //Every minut
            _bunqUpdateTimer = new System.Timers.Timer(10000);
            _hueCommands     = hueCommands;
        }
Example #3
0
        protected virtual string GetApiEndPoint(ApiEnvironmentType apiEnvironment, ApiCredentialType apiCredentialType, ApiProtocol apiProtocol)
        {
            if (apiEnvironment != ApiEnvironmentType.Sandbox && apiEnvironment != ApiEnvironmentType.Production)
            {
                throw new Exception(string.Format("Invalid value of apiEnvironment: {0}", apiEnvironment));
            }

            if (apiCredentialType != ApiCredentialType.Signature && apiCredentialType != ApiCredentialType.Certificate)
            {
                throw new Exception(string.Format("Invalid value of apiCredentialType: {0}", apiCredentialType));
            }

            if (apiProtocol != ApiProtocol.NVP && apiProtocol != ApiProtocol.SOAP)
            {
                throw new Exception(string.Format("Invalid value of apiProtocol: {0}", apiProtocol));
            }

            return(string.Format(SignatureApiUrl,
                                 apiEnvironment == ApiEnvironmentType.Sandbox ? Sandbox : Production,
                                 apiCredentialType == ApiCredentialType.Signature ? Signature : Certificate,
                                 apiProtocol == ApiProtocol.NVP ? NVP : SOAP));
        }
Example #4
0
 public BunqLib(ApiEnvironmentType environmentType)
 {
     EnvironmentType = environmentType;
     SetupContext();
 }
Example #5
0
 public BunqLib(ApiEnvironmentType environmentType)
 {
     EnvironmentType = environmentType;
     SetupContext();
     RequestSpendingMoneyIfNeeded();
 }
Example #6
0
 protected virtual string GetExpressCheckoutRedirectUrl(ApiEnvironmentType apiEnvironment, string token)
 {
     return(string.Format(RedirectToUrl,
                          apiEnvironment == ApiEnvironmentType.Sandbox ? Sandbox : Production,
                          string.Format("cmd=_express-checkout&token={0}", token)));
 }
Example #7
0
 private static ApiContext CreateApiContextByOauthToken(OauthAccessToken token, ApiEnvironmentType environmentType)
 {
     return(ApiContext.Create(
                environmentType,
                token.Token,
                API_DEVICE_DESCRIPTION
                ));
 }