Always a bonus, maybe of 0

Stephen Paul Weber created

Change summary

bin/process_pending_btc_transactions | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Detailed changes

bin/process_pending_btc_transactions 🔗

@@ -214,7 +214,7 @@ class Customer
 
 	def add_btc_credit(txid, btc_amount, fiat_amount)
 		return unless add_transaction(txid, fiat_amount, "Bitcoin payment")
-		if (bonus = plan.bonus_for(fiat_amount))
+		if (bonus = plan.bonus_for(fiat_amount)) > 0
 			add_transaction("bonus_for_#{txid}", bonus, "Bitcoin payment bonus")
 		end
 		notify_btc_credit(txid, btc_amount, fiat_amount, bonus)
@@ -225,7 +225,7 @@ class Customer
 		notify([
 			"Your Bitcoin transaction of #{btc_amount.to_s('F')} BTC ",
 			"has been added as $#{'%.4f' % fiat_amount} (#{plan.currency}) ",
-			("+ $#{'%.4f' % bonus} bonus " if bonus),
+			("+ $#{'%.4f' % bonus} bonus " if bonus > 0),
 			"to your account.\n(txhash: #{tx_hash})"
 		].compact.join)
 	end