~singpolyma/jmp-pay

42ba84419f572cf5fe6496a49ccd0122cfb9d6d2 — Stephen Paul Weber 3 years ago a529fc2
Don't notify when re-processing transaction already in DB
1 files changed, 4 insertions(+), 2 deletions(-)

M bin/process_pending_btc_transactions
M bin/process_pending_btc_transactions => bin/process_pending_btc_transactions +4 -2
@@ 213,7 213,9 @@ class Customer
	end

	def add_btc_credit(txid, btc_amount, fiat_amount)
		add_transaction(txid, btc_amount, fiat_amount, "Bitcoin payment")
		return unless add_transaction(
			txid, btc_amount, fiat_amount, "Bitcoin payment"
		)
		if (bonus = plan.bonus_for(fiat_amount))
			add_transaction("bonus_for_#{txid}", bonus, "Bitcoin payment bonus")
		end


@@ 231,7 233,7 @@ class Customer
	end

	def add_transaction(id, amount, note)
		DB.exec_params(<<-SQL, [@customer_id, id, amount, note])
		DB.exec_params(<<-SQL, [@customer_id, id, amount, note]).cmd_tuples > 0
			INSERT INTO transactions
				(customer_id, transaction_id, amount, note)
			VALUES