public static ApiEnvironmentType DetermineEnvironmentType(string[] args) { new OptionSet { { OptionProduction, v => _environmentType = ApiEnvironmentType.PRODUCTION } }.Parse(args); return(_environmentType); }
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; }
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)); }
public BunqLib(ApiEnvironmentType environmentType) { EnvironmentType = environmentType; SetupContext(); }
public BunqLib(ApiEnvironmentType environmentType) { EnvironmentType = environmentType; SetupContext(); RequestSpendingMoneyIfNeeded(); }
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))); }
private static ApiContext CreateApiContextByOauthToken(OauthAccessToken token, ApiEnvironmentType environmentType) { return(ApiContext.Create( environmentType, token.Token, API_DEVICE_DESCRIPTION )); }