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.
| Type | Name | URL |
|---|---|---|
| GET | getOrder | /orders/{orderId} |
| POST | createRefund | /refunds |
| GET | getRefund | /refunds/{refundId} |
| HANDLER | returnOrderFlow | — |
| DTO | Fields |
|---|---|
| Order | id, total, status |
| Refund | id, order_id, amount, status |
{
"orderId": 101,
"amount": 500
}{
"id": 9001,
"order_id": 101,
"amount": 500,
"status": "requested"
}| Case | Request parameters | Expected and actual result |
|---|---|---|
| Allowed return | orderId=101, amount=500 | 201 · refunds=1 · refund_requested |
| Amount exceeds total | orderId=101, amount=3500 | 409 · refunds=0 |
| Order not delivered | orderId=102, amount=500 | 409 · refunds=0 |
| Order missing | orderId=999, amount=500 | 404 · refunds=0 |
| Zero amount | orderId=101, amount=0 | 409 · refunds=0 |
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.