Added QB dependencies + simple http server.
This commit is contained in:
@@ -28,7 +28,7 @@ namespace BodyshopPartner.Utils
|
||||
var graphQLResponse = await g.PostAsync(r);
|
||||
if (graphQLResponse.Errors == null)
|
||||
{
|
||||
logger.Trace("GQL Response: {0}", graphQLResponse.Data);
|
||||
//logger.Trace("GQL Response: {0}", graphQLResponse.Data);
|
||||
return graphQLResponse.Data;
|
||||
}
|
||||
else
|
||||
|
||||
38
BodyshopUploader/Utils/HTTPServer.cs
Normal file
38
BodyshopUploader/Utils/HTTPServer.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SimpleHttp;
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
public static class HTTPServer
|
||||
{
|
||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static void InitHttpServer()
|
||||
{
|
||||
Route.Add("/qb/receivables", (req, res, props) =>
|
||||
{
|
||||
res.WithCORS();
|
||||
//res.AddHeader("Access-Control-Allow-Origin", "http://localhost:3000 https://localhost:3000 http://localhost:5000 https://localhost:5000 https://*.imex.online,imex.online");
|
||||
res.Close() ;
|
||||
}, "OPTIONS");
|
||||
|
||||
Route.Add("/qb/receivables", (req, res, props) =>
|
||||
{
|
||||
Console.WriteLine("Got a hit.");
|
||||
//res.WithCORS();
|
||||
Utils.QuickBooksInterop.connectToQuickBooks();
|
||||
|
||||
res.WithCORS().AsText("Hello.");
|
||||
}, "POST");
|
||||
|
||||
logger.Trace("Starting HTTP server...");
|
||||
|
||||
//TODO As a part of the installer, add netsh http add urlacl url=http://+:1337/ user="Everyone
|
||||
HttpServer.ListenAsync(1337, System.Threading.CancellationToken.None, Route.OnHttpRequestAsync).Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
BodyshopUploader/Utils/QuickBooksInterop.cs
Normal file
31
BodyshopUploader/Utils/QuickBooksInterop.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Interop.QBFC13;
|
||||
using Interop.QBXMLRP2;
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
public static class QuickBooksInterop
|
||||
{
|
||||
private static string ticket;
|
||||
private static RequestProcessor2 rp;
|
||||
private static string maxVersion;
|
||||
private static string companyFile = "";
|
||||
private static QBFileMode mode = QBFileMode.qbFileOpenDoNotCare;
|
||||
private static string appID = "IDN123";
|
||||
private static string appName = "BodyshopPartner";
|
||||
|
||||
public static void connectToQuickBooks()
|
||||
{
|
||||
|
||||
rp = new RequestProcessor2Class();
|
||||
rp.OpenConnection(appID, appName);
|
||||
ticket = rp.BeginSession(companyFile, mode);
|
||||
string[] versions = rp.get_QBXMLVersionsForSession(ticket);
|
||||
maxVersion = versions[versions.Length - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user