diff --git a/dotnet/Global/Services/ChromieTalkie.cs b/dotnet/Global/Libraries/ChromieTalkie.cs similarity index 98% rename from dotnet/Global/Services/ChromieTalkie.cs rename to dotnet/Global/Libraries/ChromieTalkie.cs index 2331a836..655302f1 100644 --- a/dotnet/Global/Services/ChromieTalkie.cs +++ b/dotnet/Global/Libraries/ChromieTalkie.cs @@ -8,7 +8,7 @@ using Newtonsoft.Json; using PuppeteerSharp; -namespace Branch.Global.Services +namespace Branch.Global.Libraries { public class ChromieTalkie : IDisposable { diff --git a/dotnet/Global/Contracts/CacheInfo.cs b/dotnet/Global/Models/Domain/CacheInfo.cs similarity index 98% rename from dotnet/Global/Contracts/CacheInfo.cs rename to dotnet/Global/Models/Domain/CacheInfo.cs index ea107052..b47d9a8d 100644 --- a/dotnet/Global/Contracts/CacheInfo.cs +++ b/dotnet/Global/Models/Domain/CacheInfo.cs @@ -1,6 +1,6 @@ using System; -namespace Branch.Global.Contracts +namespace Branch.Global.Models.Domain { public class CacheInfo : ICacheInfo { diff --git a/dotnet/Global/Contracts/IBranchResponse.cs b/dotnet/Global/Models/Domain/IBranchResponse.cs similarity index 81% rename from dotnet/Global/Contracts/IBranchResponse.cs rename to dotnet/Global/Models/Domain/IBranchResponse.cs index 60ffbd7f..4c2dc3fa 100644 --- a/dotnet/Global/Contracts/IBranchResponse.cs +++ b/dotnet/Global/Models/Domain/IBranchResponse.cs @@ -1,4 +1,4 @@ -namespace Branch.Global.Contracts +namespace Branch.Global.Models.Domain { public interface IBranchResponse { diff --git a/dotnet/Global/Contracts/ICacheInfo.cs b/dotnet/Global/Models/Domain/ICacheInfo.cs similarity index 82% rename from dotnet/Global/Contracts/ICacheInfo.cs rename to dotnet/Global/Models/Domain/ICacheInfo.cs index f9deff8d..4011045c 100644 --- a/dotnet/Global/Contracts/ICacheInfo.cs +++ b/dotnet/Global/Models/Domain/ICacheInfo.cs @@ -1,6 +1,6 @@ using System; -namespace Branch.Global.Contracts +namespace Branch.Global.Models.Domain { public interface ICacheInfo { diff --git a/dotnet/Global/Contracts/ServiceConfig.cs b/dotnet/Global/Models/Domain/ServiceConfig.cs similarity index 73% rename from dotnet/Global/Contracts/ServiceConfig.cs rename to dotnet/Global/Models/Domain/ServiceConfig.cs index b6256bcf..3447853a 100644 --- a/dotnet/Global/Contracts/ServiceConfig.cs +++ b/dotnet/Global/Models/Domain/ServiceConfig.cs @@ -1,4 +1,4 @@ -namespace Branch.Global.Contracts +namespace Branch.Global.Models.Domain { public class ServiceConfig { diff --git a/dotnet/Services/Identity/Libraries/XblIdentityCache.cs b/dotnet/Services/Identity/Libraries/XblIdentityCache.cs index bd61a55e..848efa73 100644 --- a/dotnet/Services/Identity/Libraries/XblIdentityCache.cs +++ b/dotnet/Services/Identity/Libraries/XblIdentityCache.cs @@ -2,11 +2,12 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Branch.Global.Contracts; using Branch.Global.Extensions; using Branch.Global.Libraries; +using Branch.Global.Models.Domain; using Branch.Global.Models.XboxLive; using Branch.Services.Token; +using Crpc.Exceptions; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using ServiceStack.Redis; @@ -85,12 +86,29 @@ private async Task GetIdentity(LookupType type, string value, options.Headers.Add("X-XBL-Contract-Version", "2"); query.Add("settings", "gamertag"); - var response = await _client.Do("GET", path, query, options); - var user = response.ProfileUsers[0]; - var xuid = user.ID.ToString(); - var gamertag = user.Settings.First(s => s.ID == "Gamertag").Value; + try + { + var response = await _client.Do("GET", path, query, options); + var user = response.ProfileUsers[0]; + var xuid = user.ID.ToString(); + var gamertag = user.Settings.First(s => s.ID == "Gamertag").Value; + + return (gamertag, xuid); + } + catch (CrpcException ex) + { + switch(ex.Message) + { + case "2": // XUIDInvalid + throw new CrpcException("invalid_xuid"); + + case "8": // ProfileNotFound + throw new CrpcException("profile_not_found"); - return (gamertag, xuid); + default: + throw new CrpcException("resolve_identity_failed", null, ex); + } + } } private string GenerateRedisKey(LookupType type, string value) diff --git a/dotnet/Services/Identity/Models/Config.cs b/dotnet/Services/Identity/Models/Config.cs index 5f1d4ee9..398063f5 100644 --- a/dotnet/Services/Identity/Models/Config.cs +++ b/dotnet/Services/Identity/Models/Config.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Branch.Global.Contracts; +using Branch.Global.Models.Domain; using Branch.Global.Libraries; namespace Branch.Services.Identity.Models diff --git a/dotnet/Services/Identity/Service.cs b/dotnet/Services/Identity/Service.cs index 6f125f70..6d517cfa 100644 --- a/dotnet/Services/Identity/Service.cs +++ b/dotnet/Services/Identity/Service.cs @@ -1,5 +1,5 @@ using System.Threading.Tasks; -using Branch.Global.Contracts; +using Branch.Global.Models.Domain; using Microsoft.AspNetCore.Http; namespace Branch.Services.Identity diff --git a/dotnet/Services/Identity/Startup.cs b/dotnet/Services/Identity/Startup.cs index 777fc78c..b5fc0948 100644 --- a/dotnet/Services/Identity/Startup.cs +++ b/dotnet/Services/Identity/Startup.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; using Branch.Global.Attributes; -using Branch.Global.Contracts; +using Branch.Global.Models.Domain; using Branch.Services.Identity.App; using Branch.Services.Identity.Libraries; using Branch.Services.Identity.Models; diff --git a/dotnet/Services/Token/App/Application.cs b/dotnet/Services/Token/App/Application.cs index ecf6ff31..b4ac958a 100644 --- a/dotnet/Services/Token/App/Application.cs +++ b/dotnet/Services/Token/App/Application.cs @@ -1,6 +1,5 @@ using System; using Branch.Global.Libraries; -using Branch.Global.Services; using Branch.Services.Token.Models; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/dotnet/Services/Token/App/GetXblToken.cs b/dotnet/Services/Token/App/GetXblToken.cs index 85bcc6e2..589eb1f5 100644 --- a/dotnet/Services/Token/App/GetXblToken.cs +++ b/dotnet/Services/Token/App/GetXblToken.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; using System.Web; -using Branch.Global.Contracts; +using Branch.Global.Models.Domain; using Branch.Global.Extensions; using Branch.Global.Libraries; using Crpc.Exceptions; diff --git a/dotnet/Services/Token/Client.cs b/dotnet/Services/Token/Client.cs index 1bd36d3f..71509fe5 100644 --- a/dotnet/Services/Token/Client.cs +++ b/dotnet/Services/Token/Client.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using Branch.Global.Contracts; +using Branch.Global.Models.Domain; using Branch.Global.Libraries; using Microsoft.AspNetCore.Http; diff --git a/dotnet/Services/Token/Models/Config.cs b/dotnet/Services/Token/Models/Config.cs index cfcbfd0b..26824c7e 100644 --- a/dotnet/Services/Token/Models/Config.cs +++ b/dotnet/Services/Token/Models/Config.cs @@ -1,5 +1,4 @@ using Branch.Global.Libraries; -using Branch.Global.Services; namespace Branch.Services.Token.Models { diff --git a/dotnet/Services/Token/Service.cs b/dotnet/Services/Token/Service.cs index 4d963f0f..9943b8e9 100644 --- a/dotnet/Services/Token/Service.cs +++ b/dotnet/Services/Token/Service.cs @@ -1,5 +1,5 @@ using System.Threading.Tasks; -using Branch.Global.Contracts; +using Branch.Global.Models.Domain; using Microsoft.AspNetCore.Http; namespace Branch.Services.Token diff --git a/dotnet/Services/Token/Startup.cs b/dotnet/Services/Token/Startup.cs index e0518ce4..c500c05f 100644 --- a/dotnet/Services/Token/Startup.cs +++ b/dotnet/Services/Token/Startup.cs @@ -1,7 +1,6 @@ -using System; using System.Threading.Tasks; using Branch.Global.Attributes; -using Branch.Global.Services; +using Branch.Global.Libraries; using Branch.Services.Token.App; using Branch.Services.Token.Models; using Branch.Services.Token.Server;