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/v1/suppliers \
-H "Content-Type: application/json" \
-d '{
"name": "Greenthread Mills",
"category": "TEXTILES",
"country": "IN",
"city": "Mumbai",
"contact_name": "Raj Patel",
"contact_email": "raj@greenthread.in",
"reach_compliant": true
}'

Step 2: Add a Certification

Shell
curl -X POST "http://localhost:8080/api/v1/supplier-certifications?supplierId=42" \
-H "Content-Type: application/json" \
-d '{
"certification_type": "GOTS",
"certificate_number": "GOTS-2025-IN-00456",
"certificate_expiry": "2027-03-31"
}'

Step 3: Register Products

Shell
curl -X POST "http://localhost:8080/api/v1/supplier/products?userId=1" \
-H "Content-Type: application/json" \
-d '{
"name": "Organic Cotton Knit 180gsm",
"code": "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,
"gots_certified": true
}'

Step 4: Record First Purchase

Shell
curl -X POST "http://localhost:8080/api/v1/purchases?userId=1" \
-H "Content-Type: application/json" \
-d '{
"supplier_id": 42,
"supplier_product_id": 17,
"purchase_date": "2025-10-01T09:00:00",
"quantity_kg": 1000.0,
"transport_method": "SEA",
"distance_km": 7200,
"purchase_order_number": "PO-2025-010",
"batch_number": "BATCH-Q4-2025-A"
}'

Step 5: Update Status to IN_TRANSIT

Shell
curl -X PATCH "http://localhost:8080/api/v1/purchases/201?userId=1" \
-H "Content-Type: application/json" \
-d '{
"purchase_status": "IN_TRANSIT",
"expected_delivery_date": "2025-11-10T09:00:00"
}'

Step 6: Mark as Delivered

Shell
curl -X PATCH "http://localhost:8080/api/v1/purchases/201?userId=1" \
-H "Content-Type: application/json" \
-d '{
"purchase_status": "DELIVERED",
"delivery_date": "2025-11-08T14:30:00",
"delivery_notes": "All goods received in good condition."
}'

Step 7: Check Audit Trail

Shell
curl http://localhost:8080/api/v1/purchases/201/status-changes

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