Add exclusion for QB on non-windows.

This commit is contained in:
Patrick Fic
2025-03-27 12:43:27 -07:00
parent 7d59796f49
commit ecab1e8f05
2 changed files with 23 additions and 4 deletions

View File

@@ -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");