~singpolyma/sgx-jmp

2f5450cc665f5f5824198a32360890016cb804fc — Stephen Paul Weber 2 years ago 7474137
Amount needs to be a number to check it
1 files changed, 2 insertions(+), 1 deletions(-)

M lib/transaction.rb
M lib/transaction.rb => lib/transaction.rb +2 -1
@@ 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