Transaction Design - NFSandbox/sh_trade_backend GitHub Wiki
This article will introduce the concept of Transaction in this system.
Start A Transaction
User should only start a transaction if he is almost sure that he will buy the item.
For an item, a transaction could only be started if:
- This item is not with state hidden or sold, more specific, it should be in state vaild.
- This item don't have any other processing transaction.
For a buyer, it could start a transaction if:
- This user is valid.
- This user should have at least one contact info added.
- One user should not be allowed to start too many transactions at a same time.
One item could only have one processing transaction at the same time. This is promised by the second point in the Item Limitation.
- This item don't have any other processing transaction.
Transaction State
Cancel Transaction
After a transaction been started, both seller and buyer could cancel the transaction at any time if it's not finished.
Transaction Comment
Seller and buyer could both leave comment on this transaction once the transaction leave processing state (For example, being cancelled or fulfilled).
Final States
Once a transaction has been marked finished, the relavant item should be marked sold.
- For a transaction, cancelled and finished should be the final state.
- For an item, sold should be final state.
If an entity that already with a final state, then it's state should not be changed anymore.