product engineering
Four roles, one feature

Every sale at a Bulgarian club's reception owes the customer a fiscal receipt, printed on a device registered with the NRA. Clubs on 1club were printing them by hand, on a separate device, after ringing the sale up in our Point of Sale. Since early October fiscalization has been my feature, and I've been doing it in four roles at once. Product owner, domain expert, architect, and the engineer writing the code, on the server and in a Kotlin app on the terminal.
Holding all four at the same time changed how the feature came out, and it changed how I worked.
What each role asked
As product owner the questions were about the desk. Which sales owe a receipt, what the person at reception sees when one can't print, what a club with two companies or a club outside Bulgaria needs, and what we can leave out of the first version.
As domain expert the questions were about the law and the devices. That meant reading Наредба Н-18 until I could say who owes a receipt and what has to be on it, and then the Datecs manuals until I could say what the printer does when the paper runs out.
The architect's questions were about where things live. Which entity in 1club owns a receipt, how a device with no cloud API is reached, where one vendor ends and the next one begins, and which decisions should get a record.
As engineer there was really only one question, whether any of it works on a real BlueCash on the bench.
The system design
The architect's largest piece was the layout of the system, and the first design set most of it. The fiscal devices have no cloud API, so something has to run at the desk, on a network 1club doesn't control. So there are three parts: 1club in the cloud, a small Payment Bridge app on the terminal or the reception computer, and the devices behind it.
The bridge only dials out. It keeps a long-poll open to 1club and picks up commands from a queue in Postgres, so a club opens no port, and the server (which runs as several Cloud Run instances) needs no sticky sessions.
The bridge keeps no record of sales of its own. 1club knows which commands are open, the terminal's log knows what happened to a card, and the printer's memory knows which receipt printed last. After a crash or a lost connection the bridge asks them instead of trusting a local copy.
The money and the receipt settle separately. A payment that went through is never undone because its receipt failed. The receipt gets retried, or a person records that it was issued by hand. An outcome the bridge can't prove is reported as unknown, not as failed. And a printer takes one receipt at a time, so a retry can check the printer's last sale number before it prints again.
The contract between 1club and the bridge names no vendor. Datecs is the first one behind it, as Impro is behind our access-control bridge, so a second device maker means a new driver and an entry in 1club, with the pairing, polling and receipt rules unchanged.
The roles feed each other
Most of the value, I think, was in handovers that never had to happen.
The law moved the model. The first design, in October, made the receipt a flag on a card charge, because the first device was a card terminal with a printer in it. Reading the law as the domain expert, the receipt is owed by the seller, whatever took the money. As architect that moved the receipt from the card charge to the company that made the sale. As product owner it meant cash and cards on other providers' readers got receipts too. One reading changed the work of three roles and there was no one to brief.
A legal answer deleted code. An open question from the first design was whether sending sale numbers to a fiscal device makes 1club regulated sales-management software. The answer we settled on was no, so the strict numbering rule that comes with that status doesn't apply. The engineer in me had already built a counter to satisfy it. The counter went away, and the sale number now comes from the payment id.
A product call reversed an architecture rule. The first design refused a card charge before touching the card if its receipt could not print. I liked that rule as an architect, because it kept the money and the receipt in step. As product owner I couldn't defend it. 1club can't see every club's fallback (a second device on the counter, or a paper book), and refusing a paying customer is the club's decision. The sale now always goes through, and the desk is told to issue the receipt by hand and why.
A screen caught a design mistake. For three days the Payment Bridge was an integration of its own in 1club, and on the architecture diagram that looked clean. Then it showed up on the Integrations page as a card with no name, no logo and no settings, and no customer could have switched it on or understood what it was. The fix was a second decision record. Datecs is one integration with three modules, and the bridge is how it reaches its devices.
The bench answered the product. On the real terminal a receipt was cut off when the paper ran out and stayed open, blocking the printer. The engineering fix was to prove every receipt closed before trusting it. The product question it raised, what the desk sees while the printer is stuck, already had an answer, because the same person had decided days earlier that the desk is always told.
Keeping the roles apart on paper
Four roles in one head blur, and then a decision gets made by whichever role happens to be thinking about it. I kept them apart by writing each one down in its own place.
The product decisions went into the feature's documentation and a release note, in the words a club would use. The domain went into a glossary shared by the code and the documentation, with the Bulgarian terms beside the English ones, so "Fiscal Device", "Till" and "Fiscal Regime" mean one thing in a ticket, a table name and a screen. The architecture went into decision records with a context, a decision and its consequences. I wrote three in four days, and one of them partly replaced another. The engineering findings went into the bridge's device notes, dated, with what the hardware did.
With that written down I could switch roles without losing the argument the previous one had made. When the architect wanted something the product owner had already ruled out, the reason was on the page.
What nobody challenged
The cost is that nobody challenges an assumption that all four roles share. The rule refusing a card without a receipt stood for a month, written and reviewed by the same person in every role.
The checks that worked came from outside my head. The law doesn't care how the model is drawn, and the hardware doesn't care what the manual says. Then there was the admin screen, seen the way a customer sees it, and code review on the pull request.
Where it stands
The 1club side is in review, the Kotlin app has printed receipts on a bench BlueCash-50MX, and nothing has reached a club yet. Refund receipts aren't built, so a payment with a fiscal receipt cannot be deleted. Bulgaria is the only country. The next question for the domain expert is which status the printer reports while its paper is out, so the engineer can stop a receipt before it's cut off instead of finding out at the close.


