Flowdrom
RUSign in
Process example

Order returns from business requirements to a local test

Order lookup, return conditions, a database record and the result. Contracts, DTOs, two tables, rejection branches and a downloadable SDD package.

3 APIs and a handler2 DTOPostgreSQLConditions and failure branches

Business requirements and boundaries

A customer requests a return for a delivered order. The amount must be positive and no greater than the order total. Rejection must not create a refunds record. A successful request moves the order to refund_requested. This learning process registers a refund request; it does not transfer money through a payment provider.

Participants and call order

The Returns service's returnOrderFlow handler calls the Orders service's getOrder. If the order exists and meets the condition, createRefund inserts refunds and updates orders; getRefund then reads the result. A missing order returns 404; an invalid return returns 409. Neither createRefund nor getRefund runs in those branches.

Action editor and data

В редакторе сначала задаётся вызов getOrder с orderId в параметрах. Далее идут проверка наличия заказа и условие И: status = delivered, amount > 0, amount ≤ total. В успешной ветви обработчик передаёт исходные orderId и amount в createRefund и читает сохранённую запись. Выходные данные предыдущего вызова используются явно; входящие параметры шаблоном не подменяются.

Reproducing and checking the result

Create a Scenario with Business Requirements, DTOs and a local database from the SQL file. Define contracts and actions from the SDD package; select caller data and logic-based responses. Reset the database before every case because success changes the order status. Refund ID 9001 is fixed for reproducibility. Real systems need generated IDs, authorization, idempotency and transaction guarantees.

Example contracts
TypeNameURL
GETgetOrder/orders/{orderId}
POSTcreateRefund/refunds
GETgetRefund/refunds/{refundId}
HANDLERreturnOrderFlow—
Data structures
DTOFields
Orderid, total, status
Refundid, order_id, amount, status
Incoming handler request
{
  "orderId": 101,
  "amount": 500
}
Successful branch response
{
  "id": 9001,
  "order_id": 101,
  "amount": 500,
  "status": "requested"
}
Verified cases
CaseRequest parametersExpected and actual result
Allowed returnorderId=101, amount=500201 · refunds=1 · refund_requested
Amount exceeds totalorderId=101, amount=3500409 · refunds=0
Order not deliveredorderId=102, amount=500409 · refunds=0
Order missingorderId=999, amount=500404 · refunds=0
Zero amountorderId=101, amount=0409 · refunds=0
Verified with the standard interpreter

Each case runs against a fresh isolated in-memory database. Checks cover response status, row count, final state and branch selection. The local-run.json file contains actual results. This is a local model test, not a real server call.

Download the model and documents

Files are produced by Flowdrom generators. SQL reproduces the initial state; SDD includes specifications and actions. These are learning and reproduction materials; the interface does not offer one-click import of the entire package.

All data is synthetic. Example documents are in Russian.

Flowdrom

Try it on your board

Features depend on the plan. See pricing for current terms.

Sign inView pricing