Class: TransactionRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/mock_braintree/transaction_request.rb

Instance Method Summary collapse

Instance Method Details

#sale(hash = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/mock_braintree/transaction_request.rb', line 2

def sale(hash = {})
  if hash[:amount].to_f < 2000.00
    SuccessfulResult.new(hash)
  elsif (hash[:amount].to_f >= 2000) && (hash[:amount].to_i < 3000)
    UnsuccessfulResult.new(hash)
  elsif (hash[:amount].to_f >= 3000) && (hash[:amount].to_i <= 3000.99)
    UnsuccessfulResult.new(hash)
  else
    UnsuccessfulResult.new(hash)
  end
end