Class: Payment::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/payment/base.rb

Direct Known Subclasses

AuthorizeNet

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Set the variables and get default variables from the :prefs file. This method will be overriden by each gateway to set sensible defaults for each gateway.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/payment/base.rb', line 16

def initialize(options = {}) #:nodoc:
	# set some sensible defaults
	@type = 'normal authorization'
	
	# get defaults from a preference file
	prefs = File.expand_path(options[:prefs] || "~/.payment.yml")
	YAML.load(File.open(prefs)).each {|pref, value| instance_variable_set("@#{pref}", value) } if File.exists?(prefs)
	
	# include all provided data
	options.each { |pref, value| instance_variable_set("@#{pref}", value) }

	@required = Array.new
end

Instance Attribute Details

#account_numberObject

Returns the value of attribute account_number.



10
11
12
# File 'lib/payment/base.rb', line 10

def 
  @account_number
end

#actionObject

Returns the value of attribute action.



10
11
12
# File 'lib/payment/base.rb', line 10

def action
  @action
end

#addressObject

Returns the value of attribute address.



10
11
12
# File 'lib/payment/base.rb', line 10

def address
  @address
end

#amountObject

Returns the value of attribute amount.



10
11
12
# File 'lib/payment/base.rb', line 10

def amount
  @amount
end

#authorizationObject (readonly)

Returns the value of attribute authorization.



7
8
9
# File 'lib/payment/base.rb', line 7

def authorization
  @authorization
end

#bank_nameObject

Returns the value of attribute bank_name.



10
11
12
# File 'lib/payment/base.rb', line 10

def bank_name
  @bank_name
end

#card_numberObject

Returns the value of attribute card_number.



10
11
12
# File 'lib/payment/base.rb', line 10

def card_number
  @card_number
end

#cityObject

Returns the value of attribute city.



10
11
12
# File 'lib/payment/base.rb', line 10

def city
  @city
end

#countryObject

Returns the value of attribute country.



10
11
12
# File 'lib/payment/base.rb', line 10

def country
  @country
end

#customer_idObject

Returns the value of attribute customer_id.



10
11
12
# File 'lib/payment/base.rb', line 10

def customer_id
  @customer_id
end

#descriptionObject

Returns the value of attribute description.



10
11
12
# File 'lib/payment/base.rb', line 10

def description
  @description
end

#emailObject

Returns the value of attribute email.



10
11
12
# File 'lib/payment/base.rb', line 10

def email
  @email
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



7
8
9
# File 'lib/payment/base.rb', line 7

def error_code
  @error_code
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



7
8
9
# File 'lib/payment/base.rb', line 7

def error_message
  @error_message
end

#expirationObject

Returns the value of attribute expiration.



10
11
12
# File 'lib/payment/base.rb', line 10

def expiration
  @expiration
end

#faxObject

Returns the value of attribute fax.



10
11
12
# File 'lib/payment/base.rb', line 10

def fax
  @fax
end

#invoice_numberObject

Returns the value of attribute invoice_number.



10
11
12
# File 'lib/payment/base.rb', line 10

def invoice_number
  @invoice_number
end

#loginObject

Returns the value of attribute login.



10
11
12
# File 'lib/payment/base.rb', line 10

def 
  @login
end

#methodObject

Returns the value of attribute method.



10
11
12
# File 'lib/payment/base.rb', line 10

def method
  @method
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/payment/base.rb', line 10

def name
  @name
end

#passwordObject

Returns the value of attribute password.



10
11
12
# File 'lib/payment/base.rb', line 10

def password
  @password
end

#phoneObject

Returns the value of attribute phone.



10
11
12
# File 'lib/payment/base.rb', line 10

def phone
  @phone
end

#require_avsObject

Returns the value of attribute require_avs.



9
10
11
# File 'lib/payment/base.rb', line 9

def require_avs
  @require_avs
end

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/payment/base.rb', line 7

def response
  @response
end

#result_codeObject (readonly)

Returns the value of attribute result_code.



7
8
9
# File 'lib/payment/base.rb', line 7

def result_code
  @result_code
end

#routing_codeObject

Returns the value of attribute routing_code.



10
11
12
# File 'lib/payment/base.rb', line 10

def routing_code
  @routing_code
end

#stateObject

Returns the value of attribute state.



10
11
12
# File 'lib/payment/base.rb', line 10

def state
  @state
end

#test_transactionObject

Returns the value of attribute test_transaction.



9
10
11
# File 'lib/payment/base.rb', line 9

def test_transaction
  @test_transaction
end

#transaction_typeObject (readonly)

Returns the value of attribute transaction_type.



7
8
9
# File 'lib/payment/base.rb', line 7

def transaction_type
  @transaction_type
end

#typeObject

Returns the value of attribute type.



10
11
12
# File 'lib/payment/base.rb', line 10

def type
  @type
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/payment/base.rb', line 8

def url
  @url
end

#zipObject

Returns the value of attribute zip.



10
11
12
# File 'lib/payment/base.rb', line 10

def zip
  @zip
end

Class Method Details

.plainObject



56
# File 'lib/payment/base.rb', line 56

def @response.plain; @response_plain; end

Instance Method Details

#submitObject

:nodoc:

Raises:



30
31
32
# File 'lib/payment/base.rb', line 30

def submit #:nodoc:
	raise PaymentError, "No gateway specified"
end