Add exclusion for QB on non-windows.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import * as Winax from "winax";
|
||||
import log from "electron-log/main";
|
||||
|
||||
import { Request, Response } from "express";
|
||||
@@ -7,11 +6,25 @@ import errorTypeCheck from "../../util/errorTypeCheck";
|
||||
import _ from "lodash";
|
||||
import store from "../store/store";
|
||||
|
||||
let Winax: any; // Declare Winax as any to avoid TypeScript errors on non-Windows platforms
|
||||
|
||||
if (process.platform === "win32") {
|
||||
Winax = require("winax");
|
||||
}
|
||||
|
||||
export async function handleQuickBookRequest(
|
||||
req: Request,
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
//TODO: Add OS sysstem checking. This can only happen on windows machines.
|
||||
if (process.platform !== "win32") {
|
||||
res
|
||||
.status(500)
|
||||
.json({
|
||||
error: "QuickBooks Desktop integration is only available on Windows",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const QbFilePath: string = `C:\\Users\\PatrickFic\\Development\\FRODO COLLISION.QBW`;
|
||||
// ||
|
||||
// (store.get("settings.qbFilePath") as string) F
|
||||
@@ -81,6 +94,10 @@ export async function handleQuickBookRequest(
|
||||
|
||||
//This set of functions works.
|
||||
export function TestQB(): void {
|
||||
if (process.platform !== "win32") {
|
||||
log.warn("TestQB is only available on Windows");
|
||||
return;
|
||||
}
|
||||
let requestProcessor, ticket;
|
||||
try {
|
||||
requestProcessor = new Winax.Object("QBXMLRP.RequestProcessor.1");
|
||||
|
||||
Reference in New Issue
Block a user