~singpolyma/jmp-pay

e6548033ff58c6e1b4b86d7bc2207d1d77c97ccf — Stephen Paul Weber 1 year, 3 months ago 4ecd14b
Fix btc script use of Transaction
1 files changed, 1 insertions(+), 12 deletions(-)

M bin/process_pending_btc_transactions
M bin/process_pending_btc_transactions => bin/process_pending_btc_transactions +1 -12
@@ 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)|