Skip to content

Noodkassa — System Flow

Visual overview of the emergency POS system: how the in-store POS client (zwerfkei_intern) communicates with zwerfkei.nl and Navision, including offline operation and deferred sync.

Legacy

This reflects the current (legacy) implementation. See Noodkassa for full documentation.


End-to-end flow

Two applications are involved:

Application Role
zwerfkei_intern POS client running on the store server — browser interface, local storage, sync
zwerfkei.nl API server — receives transactions, creates orders, forwards to NAV
sequenceDiagram
    actor Medewerker
    participant Kassa as zwerfkei_intern (browser)
    participant LocalDB as Local DB (store server)
    participant API as zwerfkei.nl API
    participant PayNL as Pay.nl
    participant NAV as Microsoft Dynamics NAV

    Note over Kassa,LocalDB: Daily sync (or on startup)
    Kassa->>API: GET /api/webpostransaction?type=variant_lookup
    API-->>Kassa: Product data (batches of 10,000)
    Kassa->>LocalDB: Store in variant_lookup + barcodes

    Note over Medewerker,LocalDB: Sale (online or offline)
    Medewerker->>Kassa: Scan barcode
    Kassa->>LocalDB: Look up product in variant_lookup
    LocalDB-->>Kassa: Product data
    Medewerker->>Kassa: Choose payment method

    alt QR payment (requires internet)
        Kassa->>API: GET /api/qr?type=payment_qr
        API->>PayNL: Create payment session
        PayNL-->>API: QR code URL
        API-->>Kassa: QR code
        Medewerker->>PayNL: Customer scans QR
        Kassa->>API: GET /api/qr?type=is_paid (polling)
        API-->>Kassa: is_paid = true
    end

    Kassa->>LocalDB: Save transaction (pos_transactions, synced=NULL)
    Kassa->>Kassa: Print receipt (print queue)

    Note over Kassa,NAV: Background sync (when online)
    Kassa->>API: POST /api/webpostransaction (unsynced transactions)
    API->>API: Create order (system customer, afhalen)
    API->>NAV: Submit order
    NAV-->>API: Confirmation
    API-->>Kassa: { ordernr: "..." }
    Kassa->>LocalDB: Mark transaction synced = time()

Local data model

erDiagram
    pos_articles {
        varchar pos_id
        varchar itemBarcode
        varchar itemNo
        varchar variantCode
        decimal price
        int discount
        int amount
        decimal total
    }

    pos_transactions {
        int id
        int paymentType
        decimal total
        int created
        int changed
        int synced
        int ordernr
        varchar temp_reference
    }

    pos_transaction_lines {
        int id
        int transactionId
        varchar itemBarcode
        varchar itemNo
        varchar variantCode
        varchar description
        varchar colour
        varchar size
        decimal price
        int discountPrice
        decimal vatPerc
        int amount
    }

    variant_lookup {
        int id
        varchar gtin
        varchar search
        varchar itemNo
        varchar itemCode
        varchar brand
        varchar name
        varchar color
        varchar size
        decimal price
        decimal actionPrice
        decimal vatValue
        varchar status
        int changed
    }

    barcodes {
        int id
        varchar barcode
        int variant_lookup_id
    }

    pos_transactions ||--o{ pos_transaction_lines : "has"
    variant_lookup ||--o{ barcodes : "has"

Noodkassa — Full Documentation ERP Sync Architecture