oroalej's avatar

Need help on creating Transaction Tracker System.

Hi,

I'm currently doing a transaction tracker system. I have a wallets table where your current fund amount is and transactions table.

The question is, do you always deduct the amount of the transactions in your wallets or do you just save the transaction and do subtraction on runtime? Will you allow the transactions to be able to edit?

Really appreciate your feedback

Regards, Alex

0 likes
4 replies
Tray2's avatar

If the wallet table contains the amount of money and it's just one type of money then I would store the amount in the table and update it according to any transactions. If it contains different types of monetary records like credit, mortages, stocks and so on I would most likely not do that. The transactions table is just a tracker imho to keep track of where the money is transfered or received from.

When working with money I suggest you use Database Transactions to make sure everything has been processed successfully before commiting the change.

oroalej's avatar

Hi Sinnbeck,

Thank you for your response.

I tried implementing laravel-event-sourcing but it seems like it is not working. Projector never triggered even if I follow all instructions. weird.

oroalej's avatar

Hi,

Yes, there are multiple types of transactions such as withdrawals, deposit, purchases, transfer, credit and so on. I am having difficult if I should allow the transaction to be editable or not.

When working with money I suggest you use Database Transactions to make sure everything has been processed successfully before commiting the change.

Yeah, I'm currently using DB::transactions()

Edit:

Yeah, regarding DB::transaction, is there a way to implement this in laravel events and listeners?

Please or to participate in this conversation.