Supplier Onboarding Workflow

Step-by-step walkthrough of onboarding a supplier — from creation to purchase with status tracking.

Step 1: Create Supplier

Shell
curl -X POST http://localhost:8080/api/suppliers \
-H "Content-Type: application/json" \
-H "X-User-Id: 1" -H "X-API-Key: dev-key" \
-d '{ "name": "Greenthread Mills", "country": "IN", "category": "TEXTILES", "reach_compliant": true }'

Step 2: Register Products

Shell
curl -X POST http://localhost:8080/api/supplier-products \
-H "Content-Type: application/json" \
-H "X-User-Id: 1" -H "X-API-Key: dev-key" \
-d '{
"name": "Organic Cotton Knit 180gsm",
"sku": "GT-KNT-180-ORG",
"supplier_id": 42,
"unit_of_measure": "METERS",
"product_origin_country": "IN",
"raw_material_origin_country": "IN",
"quantity_available": 3000.0,
"lead_time_days": 45,
"certifications": ["GOTS", "OCS"]
}'

Step 3: Record First Purchase

Shell
curl -X POST http://localhost:8080/api/purchase-records \
-H "Content-Type: application/json" \
-H "X-User-Id: 1" -H "X-API-Key: dev-key" \
-d '{
"supplier_id": 42,
"supplier_product_id": 17,
"purchase_date": "2025-10-01T09:00:00",
"quantity_kg": 1000.0,
"transport_mode": "SEA",
"distance_km": 7200,
"weight_kg": 450,
"purchase_order_number": "PO-2025-010",
"batch_number": "BATCH-Q4-2025-A"
}'

Step 4: Update Status to IN_TRANSIT

Shell
curl -X PATCH http://localhost:8080/api/purchase-records/201 \
-H "Content-Type: application/json" \
-H "X-User-Id: 1" -H "X-API-Key: dev-key" \
-d '{
"purchase_status": "IN_TRANSIT",
"expected_delivery_date": "2025-11-10T09:00:00"
}'

Step 5: Mark as Delivered

Shell
curl -X PATCH http://localhost:8080/api/purchase-records/201 \
-H "Content-Type: application/json" \
-H "X-User-Id: 1" -H "X-API-Key: dev-key" \
-d '{
"purchase_status": "DELIVERED",
"delivery_date": "2025-11-08T14:30:00",
"delivery_notes": "All 450kg received in good condition."
}'

Each status transition is automatically logged in PurchaseStatusChangeLog with the operator ID and timestamp.