From 79dea17612f2e29965cff91eb6a75336c66a6cc5 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 10 Dec 2021 15:09:22 -0800 Subject: [PATCH] Release of v24. --- BodyshopUploader/Releases/RELEASES | 4 ++- BodyshopUploader/Utils/AppMetaData.cs | 2 ++ BodyshopUploader/Utils/Auth.cs | 2 ++ BodyshopUploader/Utils/GraphQL.cs | 26 ++++++++++++++++++++ BodyshopUploader/ViewModels/MainViewModel.cs | 1 + 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/BodyshopUploader/Releases/RELEASES b/BodyshopUploader/Releases/RELEASES index 0832538..d42ff9a 100644 --- a/BodyshopUploader/Releases/RELEASES +++ b/BodyshopUploader/Releases/RELEASES @@ -42,4 +42,6 @@ D62C10039629E09EC5343B530503D1E2DC1EEBD4 ImEXOnlinePartner-1.0.18-full.nupkg 515 B80473EA2E60AFE03F0E22E2C78995A2360D9DB7 ImEXOnlinePartner-1.0.22-delta.nupkg 26086 C15C0B6EE335E383F2CEF0EFA32027B7210AA312 ImEXOnlinePartner-1.0.22-full.nupkg 5189952 05DE59E77109F985B45F4F7111B170A5BB79568F ImEXOnlinePartner-1.0.23-delta.nupkg 338352 -9FC3D7604BD9356F5ED8302FA9F256B43EDF4491 ImEXOnlinePartner-1.0.23-full.nupkg 5309975 \ No newline at end of file +9FC3D7604BD9356F5ED8302FA9F256B43EDF4491 ImEXOnlinePartner-1.0.23-full.nupkg 5309975 +4ACCFC490941BDDE71896FE47E5E4B8ACA293CD8 ImEXOnlinePartner-1.0.24-delta.nupkg 31450 +187BA94ACAE7FBF770D1D2894FF3A2F13831E7B3 ImEXOnlinePartner-1.0.24-full.nupkg 5303976 \ No newline at end of file diff --git a/BodyshopUploader/Utils/AppMetaData.cs b/BodyshopUploader/Utils/AppMetaData.cs index b560558..2e8fcd3 100644 --- a/BodyshopUploader/Utils/AppMetaData.cs +++ b/BodyshopUploader/Utils/AppMetaData.cs @@ -11,6 +11,8 @@ namespace BodyshopPartner.Utils { //TODO: Change firebase API Key to be dependent on what environment monitor has been set for. public static string ActiveShopId = Properties.Settings.Default.LastSelectedShop; + public static string ActiveShopName = ""; + public static string user = ""; public static string ShopRegion = ""; public static dynamic CiecaOpCodes; private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); diff --git a/BodyshopUploader/Utils/Auth.cs b/BodyshopUploader/Utils/Auth.cs index 8d3d684..f1b0714 100644 --- a/BodyshopUploader/Utils/Auth.cs +++ b/BodyshopUploader/Utils/Auth.cs @@ -37,6 +37,7 @@ namespace BodyshopPartner.Utils logger.Trace("Refresh timer interval set to {0}ms", (authlink.ExpiresIn - 600) * 1000); tokenTimer.Elapsed += TokenTimer_Tick; tokenTimer.Start(); + AppMetaData.user = Properties.Settings.Default.Username; return (true, null); } catch (FirebaseAuthException Ex) @@ -87,6 +88,7 @@ namespace BodyshopPartner.Utils tokenTimer.Elapsed += TokenTimer_Tick; tokenTimer.Start(); + AppMetaData.user = Username; return (true, null); } catch (FirebaseAuthException Ex) diff --git a/BodyshopUploader/Utils/GraphQL.cs b/BodyshopUploader/Utils/GraphQL.cs index 52bd3cc..8287d74 100644 --- a/BodyshopUploader/Utils/GraphQL.cs +++ b/BodyshopUploader/Utils/GraphQL.cs @@ -7,6 +7,9 @@ using System.Text; using System.Threading.Tasks; using GraphQL.Client.Http; using GraphQL.Client.Serializer.Newtonsoft; +using System.Net.Http; +using Newtonsoft; +using Newtonsoft.Json.Linq; namespace BodyshopPartner.Utils { @@ -28,7 +31,30 @@ namespace BodyshopPartner.Utils { logger.Trace("Firing a GQL Query!"); logger.Trace("Firing GQL Query: {0} {1}", r.Query.ToString(), r.Variables); + + //var content = new content("grant_type=password&username=username&password=password"); + //content.Headers.Add("Content-Type", "application/json"); + dynamic postData = new JObject(); + postData.imexshopid = AppMetaData.ActiveShopName; + postData.operationName = r.Query.ToString(); + postData.dbevent = true; + postData.user = AppMetaData.user; + postData.source = "Partner"; + var httpClient = new HttpClient(); + var content = new StringContent(postData.ToString(), Encoding.UTF8, "application/json"); + + try + { + httpClient.PostAsync("https://api.imex.online/ioevent", content); + + } + catch (Exception ex) + { + logger.Error(ex,"Unable to post to IOEVENT."); + } + var graphQLResponse = await g.SendQueryAsync(r); + if (graphQLResponse.Errors == null) { diff --git a/BodyshopUploader/ViewModels/MainViewModel.cs b/BodyshopUploader/ViewModels/MainViewModel.cs index 4493a48..493e8f6 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.cs @@ -304,6 +304,7 @@ namespace BodyshopPartner.ViewModels ActiveShop = ShopData.Where(_ => _.AssociationActive == true).FirstOrDefault(); Utils.AppMetaData.ActiveShopId = ActiveShop?.Id; + Utils.AppMetaData.ActiveShopName = ActiveShop?.ShopName; Utils.AppMetaData.ShopRegion = ActiveShop?.RegionConfig; Properties.Settings.Default.LastSelectedShop = ActiveShop.Id ?? null; Properties.Settings.Default.Save();