@@ 172,7 172,7 @@ class Customer
end
def add_btc_credit(txid, btc_amount, fiat_amount)
- tx = Transaction.new(txid, fiat_amount, "Bitcoin payment")
+ tx = Transaction.new(@customer_id, txid, fiat_amount, "Bitcoin payment")
return unless tx.save
tx.bonus&.save
@@ 188,17 188,6 @@ class Customer
"to your account.\n(txhash: #{tx_hash})"
].compact.join)
end
-
- def add_transaction(id, amount, note)
- args = [@customer_id, id, amount, note]
- DB.exec_params(<<-SQL, args).cmd_tuples.positive?
- INSERT INTO transactions
- (customer_id, transaction_id, settled_after, amount, note)
- VALUES
- ($1, $2, LOCALTIMESTAMP, $3, $4)
- ON CONFLICT (transaction_id) DO NOTHING
- SQL
- end
end
done = REDIS.hgetall("pending_btc_transactions").map { |(txid, customer_id)|