diff --git a/MangoPay.SDK/Core/APIs/ApiOAuth.cs b/MangoPay.SDK/Core/APIs/ApiOAuth.cs index 39082fe..4751834 100644 --- a/MangoPay.SDK/Core/APIs/ApiOAuth.cs +++ b/MangoPay.SDK/Core/APIs/ApiOAuth.cs @@ -27,6 +27,10 @@ public async Task CreateTokenAsync(CreateOAuthTokenPostDTO entity restTool.AddRequestHttpHeader(Constants.AUTHORIZATION, $"{Constants.BASIC} {authHelper.GetHttpHeaderBasicKey()}"); restTool.AddRequestHttpHeader(Constants.CONTENT_TYPE, Constants.APPLICATION_X_WWW_FORM_URLENCODED); + if (Root.Config.UKHeaderFlag) + { + restTool.AddRequestHttpHeader(Constants.TENANT_ID, "uk"); + } return await restTool.RequestAsync(endPoint, null, entity); } diff --git a/MangoPay.SDK/Core/Configuration.cs b/MangoPay.SDK/Core/Configuration.cs index 7138690..35e911c 100644 --- a/MangoPay.SDK/Core/Configuration.cs +++ b/MangoPay.SDK/Core/Configuration.cs @@ -20,6 +20,9 @@ public class Configuration /// Timeout in miliseconds to use for API calls, set to zero to use the default .NET timeout of 100 seconds public int Timeout = 0; + /// Set to true for uk traffic + public bool UKHeaderFlag = false; + /// API version (added in dashboard's SDK only in order to handle both old and new address fields). public string ApiVersion = "v2.01"; diff --git a/MangoPay.SDK/Core/Constants.cs b/MangoPay.SDK/Core/Constants.cs index cc7f2ff..f68e00c 100644 --- a/MangoPay.SDK/Core/Constants.cs +++ b/MangoPay.SDK/Core/Constants.cs @@ -129,5 +129,8 @@ public static class Constants /// Resolves to "WalletId" string. public const string WALLET_ID = "WalletId"; + + /// Tenant header + public const string TENANT_ID = "x-tenant-id"; } } diff --git a/MangoPay.SDK/Core/RestTool.cs b/MangoPay.SDK/Core/RestTool.cs index a1826b9..975016e 100644 --- a/MangoPay.SDK/Core/RestTool.cs +++ b/MangoPay.SDK/Core/RestTool.cs @@ -552,6 +552,11 @@ private async Task> GetHttpHeadersAsync(string restUr { Constants.USER_AGENT, $"MangoPay V2 SDK .NET {_root.GetVersion()}" } }; + if (_root.Config.UKHeaderFlag) + { + httpHeaders.Add(Constants.TENANT_ID, "uk"); + } + // AuthenticationHelper http header if (!this._authRequired) return httpHeaders;