flowchart TD
A0([User Logs into PureFlow])
A0 --> A1{User Type}
A1 -->|Importer| I0
A1 -->|Shipper Enterprise| S0
subgraph IMPORTER_FLOW [" 📦 Importer Detailed Flow "]
I0[Open Dashboard]
I0 --> I1[Upload Invoice PDF/JPG]
I1 --> I2[System Stores File]
I2 --> I3[OCR Processing - Google Document AI]
I3 --> I4[Extract Line Items]
I4 --> I5[Sort Items as per Invoice Pages]
I5 --> I6[Group Items by Tracking Code]
I6 --> I7[Check Existing Tariff DB]
I7 -->|Match Found| I8[Assign Tariff from DB]
I7 -->|No Match| I9[Send to AI Tariff Engine]
I9 --> I10[AI Returns Tariff Code + Description + Confidence]
I10 --> I11{Confidence >= 85%?}
I11 -->|Yes| I12[Auto Assign Tariff]
I11 -->|No| I13[User Manual Selection]
I12 --> I14[Display Items to Importer]
I13 --> I14
I14 --> I15[Importer Reviews and Edits Items]
I15 --> I16[Remove Unwanted Items]
I16 --> I17[Finalize Invoice Groups]
I17 --> I18{Send to Shipper?}
I18 -->|Yes| I19[Send Groups to Shipper]
I18 -->|No| I20[Continue Without Shipper]
I19 --> I21[Wait for BoL Upload]
I21 --> I22[BoL Received from Shipper]
I20 --> I23[Importer Uploads BoL]
I22 --> I24[Map BoL to Tracking Groups]
I23 --> I24
I24 --> I25{Multiple BoLs?}
I25 -->|Yes| I26[Create Multiple BCDs]
I25 -->|No| I27[Create Single BCD]
I26 --> I28[Create Draft BCD]
I27 --> I28
I28 --> I29[Charges and Taxes Wizard]
I29 --> I30[Calculate Duty + Wharfage + Fees]
I30 --> I31[Validate R26 Fields]
I31 --> I32[Generate BCD Summary]
I32 --> I33[Show Customs Charges + PureFlow Fee]
I33 --> I34[Proceed to Payment]
end
subgraph IMPORTER_PAYMENT [" 💳 Importer Payment "]
I34 --> P1[Display Split Payment: PureFlow Fee + Customs Duty]
P1 --> P2[User Pays PureFlow Fee]
P2 --> P3{Payment Method}
P3 -->|Credit Card| P4[Live.Net Card Payment]
P3 -->|Bank Transfer| P5[Manual Transfer]
P4 --> P6[Payment Success]
P5 --> P6
P6 --> P7[Generate Customs Payment Instructions]
P7 --> P8[Show Govt Bank Details + Amount + CAPS Trader ID + BCD Ref]
P8 --> P9[User Pays Customs via Bank]
P9 --> P10[User Declares Payment]
P10 --> P11[Enter Date + Amount + References]
P11 --> P12[Checkbox: Subject to Customs Verification]
P12 --> P13[Status: Payment Declared]
P13 --> C0
end
subgraph CAPS_FLOW [" 🏛 CAPS Processing "]
C0[Submit BCD ASCII to FTP Input Folder]
C0 --> C1[CAPS System Reads File]
C1 --> C2{Syntax Valid?}
C2 -->|No| C3[Error File Generated in Output Folder]
C3 --> C4[Importer Views Errors in PureFlow]
C4 --> C5[Fix Data]
C5 --> C0
C2 -->|Yes| C6[No Immediate Response - Sandbox]
C6 --> C7[Officer Review Begins]
C7 --> C8{Officer Query Raised?}
C8 -->|Yes| C9[Importer Receives Query Form]
C9 --> C10[Upload Response + Docs]
C10 --> C11[Officer Updates CAPS]
C11 --> C7
C8 -->|No| C12[Customs Matches Bank Payment]
C12 --> C13{Payment Found?}
C13 -->|No| C14[Pending - Awaiting Reconciliation]
C13 -->|Yes| C15[Release Approved]
C15 --> C16[Release Note Sent via Email]
end
subgraph RELEASE_FLOW [" ✅ Completion "]
C16 --> R1[Importer Uploads Release Note]
R1 --> R2[System Marks BCD Completed]
R2 --> R3[Shipper Receives Notification]
R3 --> R4[Archive After 15 Days]
end
subgraph SHIPPER_FLOW [" 🚢 Enterprise Shipper Flow "]
S0[Shipper Dashboard]
S0 --> S1[Upload / Create Multiple BCDs]
S1 --> S2[System Calculates Duty + Tariff Codes per BCD]
S2 --> S3[Group into Batch]
S3 --> S4[Generate Batch Reference ID]
S4 --> S5[Display Batch Summary: BCD List + Total Amount]
S5 --> S6[Shipper Pays Customs via Bank Transfer]
S6 --> S7[Declare Batch Payment]
S7 --> S8[Enter Date + Amount + Batch Ref + CAPS ID]
S8 --> S9[Status: Payment Declared]
S9 --> C0
end
subgraph BILLING_FLOW [" 🧾 PureFlow Billing "]
B0[Monthly Billing Cycle]
B0 --> B1[Calculate Per BCD Fee + Per Tariff Code Fee]
B1 --> B2[Generate Invoice]
B2 --> B3[Send to Shipper]
B3 --> B4[Shipper Pays PureFlow]
B4 --> B5[Invoice Closed]
end
classDef importerNode fill:#0c2a3e,stroke:#0ea5e9,stroke-width:1.5px,color:#bae6fd
classDef payNode fill:#2d1f04,stroke:#f59e0b,stroke-width:1.5px,color:#fde68a
classDef capsNode fill:#2d0a0a,stroke:#ef4444,stroke-width:1.5px,color:#fecaca
classDef releaseNode fill:#062010,stroke:#10b981,stroke-width:1.5px,color:#a7f3d0
classDef shipperNode fill:#1e0a40,stroke:#8b5cf6,stroke-width:1.5px,color:#ddd6fe
classDef billingNode fill:#2d0a1e,stroke:#ec4899,stroke-width:1.5px,color:#fbcfe8
classDef entryNode fill:#1e293b,stroke:#94a3b8,stroke-width:2px,color:#f1f5f9
class I0,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15,I16,I17,I18,I19,I20,I21,I22,I23,I24,I25,I26,I27,I28,I29,I30,I31,I32,I33,I34 importerNode
class P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13 payNode
class C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 capsNode
class R1,R2,R3,R4 releaseNode
class S0,S1,S2,S3,S4,S5,S6,S7,S8,S9 shipperNode
class B0,B1,B2,B3,B4,B5 billingNode
class A0,A1 entryNode