-
Notifications
You must be signed in to change notification settings - Fork 12
Transaction Model
One of the primary objectives of PM-POS project is building a simplified financial / inventory transaction model. Here are some technical details of the PM-POS Transaction Model.
We're using Cards to store data. A Card may store properties of a business entity, asset or financial transaction. Cards may have a tree like structure to allow building document type (like invoices or restaurant tickets) transactions. Cards that have no parent are called as Root Cards. Cards we create under root cards are called as Sub Cards.
All root cards must have a specific card type. Cards types are useful to group cards. For example Cards we crate to record our customers may have Customers Card Type.
Tags are useful to set values of a Card. Tagging is the only way to change data stored inside a Card. You can read Assets & Liabilities document for more info.
Actions are used create cards or tag them. We basically have 3 actions to mutate Cards.
- Create Card: This action creates root cards or sub cards.
- Set Card Tag: This action updates a tag value of a card.
- Close Card: This action closes a card. That means no further updates are expected for this card.
PM-POS basically stores only the history of actions.
All actions executed during a single operation are grouped under a Commit. For example if two actions executed under a single operation both actions stored under a single commit. This means we'll submit both actions or nothing. Splitting these actions is not possible. All commits relates with a single Root Card. What we basically share between terminals are commits. When a terminal receives a new commit it adds the commit to the card's commit history and replays all commits from start to rebuild the card.
Rules are useful to build custom operations based on executed actions. PM-POS monitors all action executions and trigger related rules to apply customizations. For example we may want to execute actions to add discount when a specific customer is selected for a ticket.