NodeFox

Lesson 25 · Intermediate

Check a purchase order before release

Build the 20-valve, $60-discrepancy example with explicit review.

2:06 video guide + written guide

Source-based instructional visualization · synthetic examples · AI narration. This explains configuration and behavior; it is not a recording of a verified live run.

Jump to a chapter

Before you start

A signed-in NodeFox workspace. Use synthetic data and prepare outputs before enabling external writes.

  1. 01Receive and interpret

    Use a synthetic purchase order for 20 valves at $95 each. Reader supplies the document and Conversation extracts quantity and unit price. Preserve the order ID and source line. Use a mock price-book response of $98 per valve.

  2. 02Check the arithmetic

    Validate the extracted and reference values. In Code, calculate 20 × (9800 − 9500) = 6000 cents. Keep requested total 190000 cents and contract total 196000 cents distinct. Download the tested fixture to reproduce this calculation.

  3. 03Request a decision

    Route the discrepancy and both source values into Decision Options. Ask the authorized order desk to approve use of the contract price or hold the order. A nonzero difference must not automatically authorize changing the customer’s order.

  4. 04Prepare the next record

    After the selected decision, use Writer to prepare a local order proposal with the decision attached. Check the total and record identifier. Enabling an ERP write requires separate verified API access, authority and duplicate prevention.

Example configuration or input

{"quantity":20,"orderUnitCents":9500,"contractUnitCents":9800}

Expected result

Difference $60. Contract-priced proposal $1,960 for the 20 valves; no automatic ERP posting.

If the result is wrong

Do not mix this single-line workshop with the website film’s additional 80-filter line. That two-line example totals $5,320 after review.

Reproduce the exact checks

Save both .mjs files and the two Code-node .js files in the same folder and run node --test checks.test.mjs. These test the calculation independently; they do not execute the NodeFox runtime.