Compare commits

...

3 Commits

3 changed files with 26 additions and 11 deletions
+6
View File
@@ -43,6 +43,12 @@ RUN apt-get update && \
# Copy the compiled binary from the build stage
COPY --from=build /app/server ./server
# Quote PDF branding asset loaded at runtime by pdf generation
COPY logo.png ./logo.png
# Sales tax lookup data loaded by expectedSalesTax at runtime
COPY --from=build /app/src/modules/sales-utils/salesTaxRates.json ./salesTaxRates.json
# Copy Prisma artifacts needed at runtime
COPY --from=build /app/generated/ ./generated/
COPY --from=build /app/prisma/ ./prisma/
+18 -9
View File
@@ -1,4 +1,5 @@
import { readFileSync } from "fs";
import { join } from "path";
export interface SalesTaxAddressInput {
line1?: string | null;
@@ -25,18 +26,26 @@ interface StateTaxRecord {
local_jurisdictions?: LocalJurisdiction[];
}
const taxDataPath = new URL("./salesTaxRates.json", import.meta.url);
const TAX_DATA_FALLBACK_URL = new URL("./salesTaxRates.json", import.meta.url);
const TAX_DATA_CANDIDATE_PATHS: Array<string | URL> = [
process.env.SALES_TAX_RATES_PATH ?? "",
join(process.cwd(), "salesTaxRates.json"),
TAX_DATA_FALLBACK_URL,
].filter(Boolean);
const parseTaxData = (): StateTaxRecord[] => {
try {
const raw = readFileSync(taxDataPath, "utf-8");
const parsed = JSON.parse(raw) as StateTaxRecord[];
if (!Array.isArray(parsed)) return [];
return parsed;
} catch {
return [];
for (const source of TAX_DATA_CANDIDATE_PATHS) {
try {
const raw = readFileSync(source, "utf-8");
const parsed = JSON.parse(raw) as StateTaxRecord[];
if (Array.isArray(parsed)) return parsed;
} catch {
continue;
}
}
return [];
};
const SALES_TAX_DATA = parseTaxData();
+2 -2
View File
@@ -333,7 +333,7 @@ describe("transitionToInternalReview", () => {
// ═══════════════════════════════════════════════════════════════════════════
describe("handleReviewDecision", () => {
test("approve → PendingSent", async () => {
test("approve → ReadyToSend", async () => {
const opp = makeOpportunity({
statusCwId: OpportunityStatus.InternalReview,
});
@@ -342,7 +342,7 @@ describe("handleReviewDecision", () => {
note: "Looks good",
});
expect(result.success).toBe(true);
expect(result.newStatusId).toBe(OpportunityStatus.PendingSent);
expect(result.newStatusId).toBe(OpportunityStatus.ReadyToSend);
});
test("reject → PendingRevision", async () => {