Amount needs to be a number to check it

Stephen Paul Weber created

Change summary

lib/transaction.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Detailed changes

lib/transaction.rb 🔗

@@ -1,6 +1,7 @@
 # frozen_string_literal: true
 
 require "bigdecimal"
+require "bigdecimal/util"
 
 require_relative "trust_level_repo"
 
@@ -24,7 +25,7 @@ class Transaction
 			TrustLevelRepo.new.find(customer), customer.declines,
 			payment_method || customer.payment_methods.then(&:default_payment_method)
 		]).then do |(lock, tl, declines, selected_method)|
-			raise "Declined" unless tl.credit_card_transaction?(amount, declines)
+			raise "Declined" unless tl.credit_card_transaction?(amount.to_d, declines)
 			raise "Too many payments recently" if lock == 1
 			raise "No valid payment method on file" unless selected_method