Phase 10: Supplier Portal & AFD
Duration: 3 days Goal: Implement Supplier self-service portal per DPR Section 3.7
Overview
Section titled βOverviewβSupplier Portal enabling:
- Self-registration and onboarding
- Product application submission
- Sample submission tracking
- AFD-I and AFD-II integration
- Document upload and status tracking
1. Supplier Self-Registration
Section titled β1. Supplier Self-Registrationβclass SupplierRegistration(BaseDocType): """Supplier self-registration request."""
# Company Info company_name: str = Field(max_length=200) company_type: str # Manufacturer, Marketer, Brand Owner
# Statutory gstin: str pan: str cin: str | None = None # Company Identification Number
# MSME (if applicable) msme_registered: bool = False udyam_number: str | None = None msme_category: str | None = None # Micro, Small, Medium
# Special Categories is_startup: bool = False dpiit_number: str | None = None is_women_owned: bool = False is_divyangjan_owned: bool = False is_ex_serviceman: bool = False
# Contact contact_person: str email: str phone: str address: str
# Documents gst_certificate: str | None = None # FK to File pan_card: str | None = None msme_certificate: str | None = None company_profile: str | None = None
# Verification gstin_verified: bool = False pan_verified: bool = False
# Status status: str = "Draft" # Draft, Submitted, Under Review, Approved, Rejected
# On Approval supplier_code: str | None = None
class Meta: table_name = "supplier_registration"1.1 Tasks
Section titled β1.1 Tasksβ- Create
SupplierRegistrationDocType - GSTIN verification API integration
- UDYAM portal verification
- Auto-create Supplier on approval
2. Product Submission (Supplier Side)
Section titled β2. Product Submission (Supplier Side)βclass SupplierProductSubmission(BaseDocType): """Product submission from Supplier portal."""
supplier: str # FK to Supplier
# Product Details product_name: str brand_name: str barcode: str hsn_code: str
# Pricing mrp: Decimal proposed_trade_price: Decimal discount_percent: Decimal
# Classification category: str # GS, LIF, AFD-I, AFD-II item_group: str
# For Liquor (LIF) is_liquor: bool = False bottle_in_origin: bool = False # BIO vs BII edp_pan_india: Decimal | None = None # Ex-Distillery Price
# Standards & Certifications fssai_license: str | None = None bis_certification: str | None = None agmark: str | None = None
# Documents tds_certificate: str | None = None product_images: list[str] = Field(default_factory=list) lab_report: str | None = None costing_sheet: str | None = None
# Sample sample_submitted: bool = False sample_submission_date: date | None = None sample_tracking_number: str | None = None
# Status status: str = "Draft"
# Link to internal application product_application: str | None = None # FK to ProductApplication
class Meta: table_name = "supplier_product_submission"2.1 Tasks
Section titled β2.1 Tasksβ- Create
SupplierProductSubmissionDocType - Smart Consumer App barcode validation
- Auto-create ProductApplication on submit
- Sample submission instructions
3. AFD Integration
Section titled β3. AFD Integrationβ3.1 AFD-I (High Value Items)
Section titled β3.1 AFD-I (High Value Items)βclass AFDOrderI(BaseDocType): """Against Firm Demand - Category I (4-wheelers, 2-wheelers, white goods)."""
# Beneficiary customer: str # Link to Outlet outlet: str # FK to Outlet
# Product item: str # FK to Item supplier: str # FK to Supplier
# Pricing (from AFD portal) mrp: Decimal legacy_erp_price: Decimal discount_amount: Decimal
# Order order_date: date delivery_date: date | None = None
# Payment payment_mode: str # Online, Cheque, RTGS payment_status: str = "Pending" payment_reference: str | None = None
# Delivery delivery_status: str = "Pending" # Pending, Dispatched, Delivered delivery_address: str
# Status status: str = "Draft"
class Meta: table_name = "afd_order_i"3.2 AFD-II (Other White Goods)
Section titled β3.2 AFD-II (Other White Goods)βclass AFDOrderII(BaseDocType): """Against Firm Demand - Category II (lower value white goods)."""
customer: str outlet: str customer_id: str depot: str # Fulfilled via Depot
item: str quantity: int = 1
mrp: Decimal legacy_erp_price: Decimal
status: str = "Draft"
class Meta: table_name = "afd_order_ii"3.3 Tasks
Section titled β3.3 Tasksβ- Create AFD DocTypes
- AFD portal sync (external)
- Member eligibility check
- Depot stock allocation for AFD-II
4. Sample Tracking
Section titled β4. Sample Trackingβclass SampleSubmission(BaseDocType): """Track physical sample submission from Supplier."""
supplier: str product_submission: str # FK to SupplierProductSubmission
# Sample Details sample_description: str quantity: int
# Shipping courier_name: str | None = None tracking_number: str | None = None shipped_date: date | None = None
# Receipt at Legacy ERP HO received_date: date | None = None received_by: str | None = None barcode_validated: bool = False
# Storage sample_location: str | None = None
# Return return_requested: bool = False return_date: date | None = None
status: str = "Pending" # Pending, In Transit, Received, Returned
class Meta: table_name = "sample_submission"4.1 Tasks
Section titled β4.1 Tasksβ- Create
SampleSubmissionDocType - Courier tracking integration (optional)
- Barcode scanner validation
- Sample return workflow
5. Supplier Dashboard
Section titled β5. Supplier Dashboardβ5.1 Dashboard Components
Section titled β5.1 Dashboard Componentsβ| Widget | Data |
|---|---|
| Active Products | Count of items in Legacy ERP catalogue |
| Pending Applications | Products under review |
| Orders This Month | AFD orders received |
| Payments Due | Outstanding payments from Legacy ERP |
| Sample Status | Track submitted samples |
5.2 Tasks
Section titled β5.2 Tasksβ- Refine.dev Supplier Dashboard
- Real-time application status
- Payment history view
- Document repository
6. Payment Gateway Integration
Section titled β6. Payment Gateway Integrationβclass SupplierPaymentGateway(BaseDocType): """Track registration/application fees paid by Supplier."""
supplier: str payment_type: str # Registration Fee, Stage-I Fee, Stage-II Fee
amount: Decimal
# Gateway gateway: str # Razorpay, PayU, etc. transaction_id: str payment_status: str # Pending, Success, Failed
# Receipt receipt_number: str | None = None payment_date: datetime | None = None
class Meta: table_name = "supplier_payment_gateway"6.1 Tasks
Section titled β6.1 Tasksβ- Create
SupplierPaymentGatewayDocType - Payment gateway integration
- Auto-receipt generation
- Fee calculation based on product count
7. API Endpoints (Supplier Portal)
Section titled β7. API Endpoints (Supplier Portal)β| Endpoint | Method | Description |
|---|---|---|
/api/supplier/register |
POST | Self-registration |
/api/supplier/verify-gstin |
POST | GSTIN verification |
/api/supplier/products |
GET, POST | Product submissions |
/api/supplier/products/{id}/submit-sample |
POST | Mark sample shipped |
/api/supplier/applications/{id}/status |
GET | Application status |
/api/supplier/payments |
GET | Payment history |
/api/supplier/afd/orders |
GET | AFD orders |
8. Frontend (Supplier Portal)
Section titled β8. Frontend (Supplier Portal)βSeparate Refine.dev app for Supplier self-service:
supplier-portal/βββ src/β βββ pages/β β βββ Dashboard.tsxβ β βββ Products/β β β βββ List.tsxβ β β βββ Create.tsxβ β β βββ Status.tsxβ β βββ Samples/β β β βββ Track.tsxβ β βββ AFD/β β β βββ Orders.tsxβ β βββ Payments/β β βββ History.tsxβ βββ components/β βββ ProductForm.tsxβ βββ DocumentUpload.tsxβ βββ StatusTimeline.tsx9. Verification Checklist
Section titled β9. Verification Checklistβ- Supplier self-registration working
- GSTIN/PAN verification
- Product submission creates internal application
- Sample tracking end-to-end
- AFD orders synced
- Payment gateway functional
- Supplier dashboard shows real-time data