January 2020
Intermediate to advanced
530 pages
11h 11m
English
The insertTrans() method will insert a new transaction to the transactions relation by using the pg client. It is invoked after the customer's balance is updated by the /payment endpoint.
The method runs an INSERT query to insert the transaction into the transactions database. Apart from the transaction details, an additional flag, transtype, is inserted with the data to indicate that the transaction is an Outgoing transaction, as shown in the following code block:
var insertTrans = function(trans,res) {client.query('INSERT INTO transactions(transaction_id,sname, saccount,sbank, saddress, rname, raccount, rbank, raddress, amount, currency, invhash, boehash, dochash, transtype) values ($1, ...Read now
Unlock full access