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 the compiled binary from the build stage
COPY --from=build /app/server ./server 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 Prisma artifacts needed at runtime
COPY --from=build /app/generated/ ./generated/ COPY --from=build /app/generated/ ./generated/
COPY --from=build /app/prisma/ ./prisma/ COPY --from=build /app/prisma/ ./prisma/
+18 -9
View File
@@ -1,4 +1,5 @@
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { join } from "path";
export interface SalesTaxAddressInput { export interface SalesTaxAddressInput {
line1?: string | null; line1?: string | null;
@@ -25,18 +26,26 @@ interface StateTaxRecord {
local_jurisdictions?: LocalJurisdiction[]; 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[] => { const parseTaxData = (): StateTaxRecord[] => {
try { for (const source of TAX_DATA_CANDIDATE_PATHS) {
const raw = readFileSync(taxDataPath, "utf-8"); try {
const parsed = JSON.parse(raw) as StateTaxRecord[]; const raw = readFileSync(source, "utf-8");
const parsed = JSON.parse(raw) as StateTaxRecord[];
if (!Array.isArray(parsed)) return []; if (Array.isArray(parsed)) return parsed;
return parsed; } catch {
} catch { continue;
return []; }
} }
return [];
}; };
const SALES_TAX_DATA = parseTaxData(); const SALES_TAX_DATA = parseTaxData();
+2 -2
View File
@@ -333,7 +333,7 @@ describe("transitionToInternalReview", () => {
// ═══════════════════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════════════════
describe("handleReviewDecision", () => { describe("handleReviewDecision", () => {
test("approve → PendingSent", async () => { test("approve → ReadyToSend", async () => {
const opp = makeOpportunity({ const opp = makeOpportunity({
statusCwId: OpportunityStatus.InternalReview, statusCwId: OpportunityStatus.InternalReview,
}); });
@@ -342,7 +342,7 @@ describe("handleReviewDecision", () => {
note: "Looks good", note: "Looks good",
}); });
expect(result.success).toBe(true); expect(result.success).toBe(true);
expect(result.newStatusId).toBe(OpportunityStatus.PendingSent); expect(result.newStatusId).toBe(OpportunityStatus.ReadyToSend);
}); });
test("reject → PendingRevision", async () => { test("reject → PendingRevision", async () => {