Azure Functions
The Azure Functions build the Excel files the Logic Apps send - purchase order files for SmartPO and the tax exemption reports. Two Function Apps are current; the other two are leftovers from earlier attempts.
Index
| Function App | Purpose | Status |
|---|---|---|
SmartToolsHub-Excel-Utilities | The live purchase order and tax exemption report builders | Running, in use |
SmartToolsHub-Excel-Utilities-Staging | Staging and local development version of the above | Running, in use |
smart-tools-utility-functions | Believed to be a precursor to the current functions | Running, believed unused |
monthly-tax-exempt-automation-functions | Believed to be an earlier work-in-progress toward the current functions | Running, believed unused |
All four show as Running in Azure, which only means the Function App itself is up - it says nothing about whether anything is actually calling them.
SmartToolsHub-Excel-Utilities
The current Function Apps, and the ones everything in production depends on. There are two:
SmartToolsHub-Excel-Utilities and SmartToolsHub-Excel-Utilities-Staging.
Both are built from the tba-daily-excel repo, and the code for both is updated at the same time. That repo has a wiki documenting how to use the functions, which is rare across our projects and is the place to start before reading any code.
The staging app is effectively the dev version. It runs when something is staged for the client to look at, and it is what local development points to. The only real difference between the two is that staging uses the dev database.
The Two Functions
Each app contains the same two functions, and both return Excel files:
| Function | Purpose | Takes | Called by |
|---|---|---|---|
| Purchase order builder | Builds an order's purchase order file in the format the destination vendor expects | An order ID | Submit PO |
| Tax exemption reports | Builds the daily and monthly tax exemption reports | A date range, a store number, and a flag for whether the report is monthly | The tax exemption report generators |
Both are deliberately general - they take parameters and return a built file rather than encoding any one caller's assumptions, which is what makes them reusable across the daily and monthly flows.
Calling Them From Postman
Because these are Azure Functions, they can be called directly from Postman, which is the quickest way to test a change or reproduce a report. The URL to hit comes from Azure, and the wiki covers what each function accepts.
One thing that trips people up: the response comes back as a file, not as readable output. Save the
response to a file and give it an .xlsx extension, and it will open as the purchase order or tax
exemption report it built.
Legacy Function Apps
Two older Function Apps are still sitting in Azure and are believed to be unused:
smart-tools-utility-functions- believed to be a precursor to the functions we landed onmonthly-tax-exempt-automation-functions- believed to be an earlier work in progress, effectively a dev version, and a stepping stone toward the final implementation
Neither has been confirmed dead. Before removing either, check in Azure when each last ran and whether anything still calls them - the expectation is that nothing does.
On the naming: these were named by developers using a scheme that doesn't make their purpose obvious, and while tags were added to them, the tags don't describe what they are for either. Don't assume a name tells you what one of these does.