- Initialize git repository - Add comprehensive .gitignore (protects .env and secrets) - Fix package.json (correct main entry, add metadata) - Expand .env.example with all required variables and comments - Add README.md with architecture, setup, and commands - Clean up empty scaffolding directories (logs removed, agents/models marked) - Backup previous .env file locally This establishes a safe foundation before further development.
88 lines
2.2 KiB
JavaScript
88 lines
2.2 KiB
JavaScript
const config = require('../config');
|
|
const { proxyRequest } = require('./websocket');
|
|
|
|
async function getStoreLocation(storeNumber) {
|
|
const authString = Buffer.from(
|
|
`${config.siw.username}:${config.siw.password}`
|
|
).toString('base64');
|
|
|
|
const requestConfig = {
|
|
method: 'GET',
|
|
url: `${config.siw.baseUrl}/StoreLocation/${storeNumber}`,
|
|
headers: {
|
|
'Authorization': `Basic ${authString}`
|
|
}
|
|
};
|
|
|
|
const result = await proxyRequest(requestConfig);
|
|
return result.data;
|
|
}
|
|
|
|
async function getStoreNetwork(storeNumber) {
|
|
const authString = Buffer.from(
|
|
`${config.siw.username}:${config.siw.password}`
|
|
).toString('base64');
|
|
|
|
const requestConfig = {
|
|
method: 'GET',
|
|
url: `${config.siw.baseUrl}/StoreNetwork/${storeNumber}`,
|
|
headers: {
|
|
'Authorization': `Basic ${authString}`
|
|
}
|
|
};
|
|
|
|
const result = await proxyRequest(requestConfig);
|
|
return result.data;
|
|
}
|
|
|
|
async function getStoreRegisters(storeNumber) {
|
|
const authString = Buffer.from(
|
|
`${config.siw.username}:${config.siw.password}`
|
|
).toString('base64');
|
|
|
|
const requestConfig = {
|
|
method: 'GET',
|
|
url: `${config.siw.baseUrl}/StoreRegister/${storeNumber}`,
|
|
headers: { 'Authorization': `Basic ${authString}` }
|
|
};
|
|
|
|
const result = await proxyRequest(requestConfig);
|
|
return result.data || [];
|
|
}
|
|
|
|
async function getStorePrinters(storeNumber) {
|
|
const authString = Buffer.from(
|
|
`${config.siw.username}:${config.siw.password}`
|
|
).toString('base64');
|
|
|
|
const requestConfig = {
|
|
method: 'GET',
|
|
url: `${config.siw.baseUrl}/StorePrinter/${storeNumber}`,
|
|
headers: { 'Authorization': `Basic ${authString}` }
|
|
};
|
|
|
|
const result = await proxyRequest(requestConfig);
|
|
return result.data || [];
|
|
}
|
|
|
|
async function getStorePaymentTerminals(storeNumber) {
|
|
const authString = Buffer.from(
|
|
`${config.siw.username}:${config.siw.password}`
|
|
).toString('base64');
|
|
|
|
const requestConfig = {
|
|
method: 'GET',
|
|
url: `${config.siw.baseUrl}/StorePayment/${storeNumber}`,
|
|
headers: { 'Authorization': `Basic ${authString}` }
|
|
};
|
|
|
|
const result = await proxyRequest(requestConfig);
|
|
return result.data || [];
|
|
}
|
|
|
|
module.exports = {
|
|
getStoreLocation,
|
|
getStoreRegisters,
|
|
getStorePrinters,
|
|
getStorePaymentTerminals // ← new
|
|
};
|