Order statuses

  • NEW
  • COMPLETED
  • VERIFIED
  • DELIVER
  • DELIVERED
  • CLOSED
  • ABANDONED
  • CANCELED
  • LOCKED
graph LR; NEW -->|payments equals total| COMPLETED COMPLETED -->| auto when conditions met ie fiscalization | VERIFIED VERIFIED -->| all lines have final state | DELIVER DELIVER -->| manual action or auto | DELIVERED DELIVERED -->| auto | CLOSED NEW -->| manual action or timeout | ABANDONED COMPLETED -->| no activity timeout | ABANDONED2 VERIFIED -->| no activity timeout | ABANDONED2 DELIVER -->| no activity timeout | ABANDONED2 DELIVERED -->| no activity timeout | ABANDONED2 COMPLETED -->| manual action | CANCELLED VERIFIED -->| manual action | CANCELLED DELIVER -->| manual action | CANCELLED DELIVERED -->| manual action | CANCELLED

IF {order is not closed} AND {order is not completed} AND {order has changeable lines, i.e. with status NEW) AND {order has payments >= order total} THEN {mark all still changeable lines as CONFIRMED}

IF {order is not closed} AND {order is not completed} AND ( {orderType is not delivery} OR {delivery address is provided} ) AND {all lines are non-changeble, i.e. do not have NEW status} AND {order has payments >= order total} THEN {mark order as COMPLETED}

IF {order is not closed} AND {order is completed} AND {order is not verified} AND {tanantProperties.autoVerification:true == true} AND ( {tenantProperties.checkFiscal:false == false} OR {order has total == 0} OR {order does not have payments that need immediate fiscalization} OR {order has fiscalization records} ) THEN {mark order as verified}

IF {order is not closed} AND {order is completed} AND {order is verified} AND {orderType is delivered} AND ( {orderType is not queued} OR {every bucket has queue number assigned} ) AND {order status is not DELIVER or DELIVERED} AND {order status is COMPLETED or VERIFIED} AND {order does not have lines with non-final status, i.e. PROCESSED, WASTE, VOID, TECHNICAL} AND ( {tenantProperties.autoDeliverReady:true == true} OR {tenantProperties.autoDeliverReady.[orderType]:true == true} ) THEN {mark order as ready for delivery}

IF {order is not closed} AND {order is completed} AND ( {orderType is not delivered} OR {order is delivered - status DELIVERED, or deliveredTime is set} ) AND {order does not have lines with non-final status, i.e. PROCESSED, WASTE, VOID, TECHNICAL} AND {order has payments >= order total} AND ( {tenantProperties.checkFiscal:false == false} OR {order has total == 0} OR {order has fiscalization records} ) THEN {mark order as closed}

IF {order is not closed} AND {event is LinesExtraAlterCommand} AND {tenantProperties.processStageDone:false == true} THEN {for each line} IF {line status is PROCESSING} AND {line.extra contains KDS_FILTER} AND {line.extra contains “x-[filter]” == “done” for each KDS_FILTER.split(“,”) roles} THEN {change line status to PROCESSED} {end for each line}

KIOSK/POS order processing

This is process for all business cases with required fiscalization instantly after payment. It applies to KIOSK and POS orders (not for online orders with e-payment).

sequenceDiagram participant KIOSK participant Ordering_API participant POS_Integrator KIOSK->>Ordering_API: create an order activate Ordering_API Ordering_API-->>KIOSK: updated order deactivate Ordering_API KIOSK->>Ordering_API: Post payment activate Ordering_API Note right of Ordering_API: order status:
COMPLETED Ordering_API-->>KIOSK: updated order Ordering_API-->>POS_Integrator: updated order deactivate Ordering_API activate POS_Integrator Note right of POS_Integrator: insert order into POS,
it should stay opened
on POS deactivate POS_Integrator alt success: order added to POS activate POS_Integrator Note right of POS_Integrator: extra['x-pos-id']
is updated with
POS order id POS_Integrator->>Ordering_API: update extra['x-pos-id] deactivate POS_Integrator Ordering_API-->>KIOSK: updated order activate KIOSK Note right of KIOSK: fiscalization KIOSK->>Ordering_API: /fiscalize deactivate KIOSK activate Ordering_API Note right of Ordering_API: order status:
VERIFIED Ordering_API-->>KIOSK: updated order activate KIOSK Note right of KIOSK: display: success deactivate KIOSK Ordering_API-->>POS_Integrator: updated order deactivate Ordering_API activate POS_Integrator Note right of POS_Integrator: add payment to
POS order and confirm it deactivate POS_Integrator else error: failed adding order to POS activate POS_Integrator POS_Integrator->>Ordering_API: /cancel (order) deactivate POS_Integrator activate Ordering_API Note right of Ordering_API: order status:
CANCELED Note right of Ordering_API: payment /refund Ordering_API-->>KIOSK: updated order deactivate Ordering_API activate KIOSK Note right of KIOSK: display: failure deactivate KIOSK end

Online orders processing

In this type of orders with e-payments fiscalization is usually done on the POS system.

sequenceDiagram participant ORDER_APP participant Ordering_API participant POS_Integrator participant Payment_API ORDER_APP->>Ordering_API: create an order activate Ordering_API Ordering_API-->>ORDER_APP: updated order deactivate Ordering_API ORDER_APP->>+Payment_API: Request payment with gateway Payment_API->>-Ordering_API: Post payment activate Ordering_API Note right of Ordering_API: order status:
COMPLETED Ordering_API-->>POS_Integrator: updated order deactivate Ordering_API activate POS_Integrator Note right of POS_Integrator: insert order into POS,
it should stay opened
on POS deactivate POS_Integrator alt success: order added to POS activate POS_Integrator Note right of POS_Integrator: extra['x-pos-id']
is updated with
POS order id POS_Integrator->>Ordering_API: update extra['x-pos-id] deactivate POS_Integrator activate Ordering_API Note right of Ordering_API: order status:
VERIFIED Ordering_API-->>ORDER_APP: updated order activate ORDER_APP Note right of ORDER_APP: display: success deactivate ORDER_APP Ordering_API-->>POS_Integrator: updated order deactivate Ordering_API activate POS_Integrator Note right of POS_Integrator: add payment to
POS order and confirm it deactivate POS_Integrator else error: order not added to POS activate POS_Integrator POS_Integrator->>Ordering_API: /cancel (order) deactivate POS_Integrator activate Ordering_API Note right of Ordering_API: order status:
CANCELED Ordering_API->>Payment_API: payment /refund activate Payment_API deactivate Payment_API Ordering_API-->>+ORDER_APP: updated order deactivate Ordering_API activate ORDER_APP Note right of ORDER_APP: display: failure deactivate ORDER_APP end