feat(ti imports): saving the post to xml as a reference

This commit is contained in:
2025-09-25 09:49:36 -05:00
parent 874947af52
commit 458232d337
3 changed files with 59 additions and 2 deletions

View File

@@ -1,11 +1,14 @@
import axios from "axios";
import querystring from "querystring";
import { createLog } from "../../../../logger/logger.js";
import { saveXml } from "../../../utils/saveXml.js";
//tiCreds
const userid = process.env.USERID || "";
const password = process.env.PASSWORD || "";
export const postToTi = async (data: string) => {
export const postToTi = async (data: string, fileName: string) => {
// 🔹 Save the XML before posting
saveXml(data, fileName);
const formBody = querystring.stringify({
userid,
password,

View File

@@ -272,7 +272,14 @@ export const tiImport = async () => {
//console.log("payload", payload);
const { data: tiPost, error: tiError } = await tryCatch(postToTi(payload));
const { data: tiPost, error: tiError } = await tryCatch(
postToTi(
payload,
`${orderData[0].addressAlias.replaceAll(" ", "")}-${
header[0].releaseNumber
}`
)
);
if (tiError) {
return {