diff --git a/AyaNovaQBI/Timestamp.cs b/AyaNovaQBI/Timestamp.cs
index 553e9d9..34a6ea0 100644
--- a/AyaNovaQBI/Timestamp.cs
+++ b/AyaNovaQBI/Timestamp.cs
@@ -22,7 +22,7 @@ namespace AyaNovaQBI
///
/// Do not modify the definition of BuildAt as your changes will be discarded.
///
- public static DateTime BuildAt { get { return new DateTime(637914996753521669); } } //--**
+ public static DateTime BuildAt { get { return new DateTime(637915141619134341); } } //--**
///
/// The program that time stamped it.
///
diff --git a/AyaNovaQBI/auth.cs b/AyaNovaQBI/auth.cs
index fb9eead..c98337a 100644
--- a/AyaNovaQBI/auth.cs
+++ b/AyaNovaQBI/auth.cs
@@ -1,11 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace AyaNovaQBI
@@ -21,8 +14,8 @@ namespace AyaNovaQBI
{
edServerUrl.Text = Properties.Settings.Default.serverurl;
#if (DEBUG)
- edUserName.Text = "qbi";
- edPassword.Text = "qbi";
+ edUserName.Text = "Accounting";
+ edPassword.Text = "Accounting";
#endif
}
diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs
index 6a217d7..05c1deb 100644
--- a/AyaNovaQBI/util.cs
+++ b/AyaNovaQBI/util.cs
@@ -13,6 +13,10 @@ namespace AyaNovaQBI
internal class util
{
#region API stuff
+ public static Guid QBI_INTEGRATION_ID
+ {
+ get { return new Guid("{82CD3609-4601-4C1A-9633-7836F92D2D06}"); }
+ }
public const string TEST_ROUTE = "notify/hello";
public const string API_BASE_ROUTE = "api/v8/";
private const int MAX_TRIES = 3;//max times to retry an api call before giving up
@@ -33,6 +37,8 @@ namespace AyaNovaQBI
internal static AyaNovaLicense ALicense { get; set; } = null;
+ internal static Integration QBIntegration { get; set; } = null;
+
@@ -539,8 +545,44 @@ namespace AyaNovaQBI
{
//Check for integration object at server, if not there then create one if have sufficient rights
//check if inactive
- await Task.CompletedTask;
- return true;
+ ApiResponse r = null;
+ try
+ {
+ r = await GetAsync($"integration/exists/{QBI_INTEGRATION_ID}");
+
+ if (r.ObjectResponse["data"].Value() == false)
+ {
+ //doesn't exist, need to create it now
+ QBIntegration = new Integration();
+ QBIntegration.IntegrationAppId = QBI_INTEGRATION_ID;
+ QBIntegration.Active = true;
+ QBIntegration.Name = "QBI - QuickBooks Desktop integration";
+ r = await PostAsync("integration", Newtonsoft.Json.JsonConvert.SerializeObject(QBIntegration));
+ var id = IdFromResponse(r);
+
+ }
+ else
+ {
+ //Exists, fetch it and we're done here
+ r = await GetAsync($"integration/{QBI_INTEGRATION_ID}");
+ QBIntegration = r.ObjectResponse["data"].ToObject();
+ }
+
+ //
+
+ //
+
+
+
+ return true;
+ }catch(Exception ex)
+ {
+ initErrors.AppendLine("Error fetching QBI Integration object");
+ initErrors.AppendLine(ex.Message);
+ initErrors.AppendLine(r.CompactResponse);
+ return false;
+
+ }
}
#endregion