This commit is contained in:
@@ -22,7 +22,7 @@ namespace AyaNovaQBI
|
||||
/// <remarks>
|
||||
/// Do not modify the definition of BuildAt as your changes will be discarded.
|
||||
/// </remarks>
|
||||
public static DateTime BuildAt { get { return new DateTime(637914996753521669); } } //--**
|
||||
public static DateTime BuildAt { get { return new DateTime(637915141619134341); } } //--**
|
||||
/// <summary>
|
||||
/// The program that time stamped it.
|
||||
/// </summary>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
ApiResponse r = null;
|
||||
try
|
||||
{
|
||||
r = await GetAsync($"integration/exists/{QBI_INTEGRATION_ID}");
|
||||
|
||||
if (r.ObjectResponse["data"].Value<bool>() == 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<Integration>();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}catch(Exception ex)
|
||||
{
|
||||
initErrors.AppendLine("Error fetching QBI Integration object");
|
||||
initErrors.AppendLine(ex.Message);
|
||||
initErrors.AppendLine(r.CompactResponse);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user