From ac88b66bd3f33e2b390525e3d20de2f5611ceb19 Mon Sep 17 00:00:00 2001 From: Konstantin Yakushev Date: Wed, 10 Oct 2018 13:37:03 +0200 Subject: [PATCH 1/2] Try and fix travis builds failing because of the ips. (bunq/sdk_csharp#92) --- BunqSdk.Tests/BunqSdkTestBase.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/BunqSdk.Tests/BunqSdkTestBase.cs b/BunqSdk.Tests/BunqSdkTestBase.cs index 06167b4..2003907 100644 --- a/BunqSdk.Tests/BunqSdkTestBase.cs +++ b/BunqSdk.Tests/BunqSdkTestBase.cs @@ -1,6 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Linq; +using System.Net; using System.Net.Http; using Bunq.Sdk.Context; using Bunq.Sdk.Exception; @@ -94,6 +96,7 @@ protected static ApiContext SetUpApiContext() else { var sandboxUser = GenerateNewSandboxUser(); + var allowedIps = GetAllowedIps(); apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, sandboxUser.ApiKey, DeviceDescription); } @@ -101,6 +104,23 @@ protected static ApiContext SetUpApiContext() return apiContext; } + + private static List GetAllowedIps() + { + var environmentVariables = Environment.GetEnvironmentVariables(); + if (environmentVariables.Contains("TRAVIS")) + { + return new List + { + "34.233.56.198", "34.234.4.53", "35.184.96.71", "35.184.226.236", "35.188.1.99", "35.188.73.34", + "35.192.85.2", "35.192.136.167", "35.192.187.174", "35.193.7.13", "35.202.145.110", + "35.224.112.202", "52.3.55.28", "52.45.185.117", "52.45.220.64", "52.54.31.11", "52.54.40.118", + "54.208.31.17", "104.154.113.151", "104.154.120.187", "147.75.192.163", "147.75.198.203", + "207.254.16.35", "207.254.16.36", "207.254.16.37", "207.254.16.38", "207.254.16.39" + }; + } + return null; + } private static SandboxUser GenerateNewSandboxUser() { From 68ae9676306d008b0e183c0443f4a1f57c361e3f Mon Sep 17 00:00:00 2001 From: Konstantin Yakushev Date: Thu, 11 Oct 2018 09:51:44 +0200 Subject: [PATCH 2/2] Fix previous commit to actually use ip list. (bunq/sdk_csharp#92) --- BunqSdk.Tests/BunqSdkTestBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BunqSdk.Tests/BunqSdkTestBase.cs b/BunqSdk.Tests/BunqSdkTestBase.cs index 2003907..366e92e 100644 --- a/BunqSdk.Tests/BunqSdkTestBase.cs +++ b/BunqSdk.Tests/BunqSdkTestBase.cs @@ -97,7 +97,8 @@ protected static ApiContext SetUpApiContext() { var sandboxUser = GenerateNewSandboxUser(); var allowedIps = GetAllowedIps(); - apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, sandboxUser.ApiKey, DeviceDescription); + apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, sandboxUser.ApiKey, DeviceDescription, + allowedIps); } BunqContext.LoadApiContext(apiContext);