A
A
AigizK2014-12-14 20:04:16
Payment systems
AigizK, 2014-12-14 20:04:16

How to implement the history of the movement of the money supply?

I have my own vision of how to implement it. But I wanted to hear your comments and if anyone has come across this, then share your experience.
Imagine that there is a store where you can buy services of various kinds. Some analogue of the AppStore.
There are 3 types of users:
1. the client
2. the company that provides the service
3. the performer or employee of this company
The client buys a service from the company, and the company breaks the service into different works that performers do.
It turns out that there are several types of money supply movements:
1. replenishment of the account by the client
2. payment for services
3. full / partial refund of money to the client
4. payment for the work of the employee
5. withdrawal of money by the client / employee
The main task: to track what the client / employee withdraws for money.
The idea was the following:
1. we fix any movement in a certain database, to which you can only add
2. we introduce operations to unite and divide. Let's say the client topped up the balance by 100, and then by 200 rubles, and bought the service for 250. Accordingly, we do the operation of disconnecting 100 by 50 and 50. Then the operation of combining 50 and 200. And paying with this amount for services.
3. any union/disjunction has parents, i.e. refers to someone. this should be kept.
4. during the operation of payment, there is a change in the owner of this money
Continuing the logic like this, I get the following result. If the user decides to withdraw money, then in the database we look at all the lines that have this user as the owner. We summarize and show how much he can withdraw.
After he indicated a certain amount, the manager who is responsible for cashing out looks at the entire chain, makes sure that the money is real, and not someone got it out of thin air. Gives good. And the owner of this money is removed, i.e. they disappear from the system.
With this approach, it is also possible to programmatically check whether virtual money has appeared as a result of some site/database hacking.
Actually the question was raised at the very beginning.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Spetros, 2014-12-14
@Spetros

TK looks like a course book on the database.
If this is really necessary for business, then most likely someone has already implemented such a bike - for sure, some 1c has a suitable solution.

A
AigizK, 2014-12-14
@AigizK

Well no. I programmed in 1C in my student years. So I know how the accounting program works. There is no way to track where exactly this amount came from. There, roughly speaking, they throw the money that came into the system into the black box and randomly pull out the required amount from there.
To some extent, I need to implement what Bitcoin has. Namely, by taking any line from the money supply, he could get all the related previous operations and thus could find out whether the money was normal or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question