Class: Payment::Base

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

Direct Known Subclasses

AuthorizeNet

Constant Summary collapse

@@required =
[]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



20
21
22
23
24
25
26
27
# File 'lib/payment/base.rb', line 20

def initialize(options = {})
	# set some sensible defaults
	@strict_ssl = true
	@action = 'credit'
	
	# include all provided data
	options.each { |method, value| eval "@#{method} = '#{value}'" if methods.include? "#{method}=" }
end

Instance Attribute Details

#account_numberObject

Returns the value of attribute account_number.



16
17
18
# File 'lib/payment/base.rb', line 16

def 
  @account_number
end

#actionObject

Returns the value of attribute action.



16
17
18
# File 'lib/payment/base.rb', line 16

def action
  @action
end

#addressObject

Returns the value of attribute address.



16
17
18
# File 'lib/payment/base.rb', line 16

def address
  @address
end

#amountObject

Returns the value of attribute amount.



16
17
18
# File 'lib/payment/base.rb', line 16

def amount
  @amount
end

#authorizationObject (readonly)

Returns the value of attribute authorization.



13
14
15
# File 'lib/payment/base.rb', line 13

def authorization
  @authorization
end

#bank_nameObject

Returns the value of attribute bank_name.



16
17
18
# File 'lib/payment/base.rb', line 16

def bank_name
  @bank_name
end

#card_numberObject

Returns the value of attribute card_number.



16
17
18
# File 'lib/payment/base.rb', line 16

def card_number
  @card_number
end

#cityObject

Returns the value of attribute city.



16
17
18
# File 'lib/payment/base.rb', line 16

def city
  @city
end

#countryObject

Returns the value of attribute country.



16
17
18
# File 'lib/payment/base.rb', line 16

def country
  @country
end

#customer_idObject

Returns the value of attribute customer_id.



16
17
18
# File 'lib/payment/base.rb', line 16

def customer_id
  @customer_id
end

#descriptionObject

Returns the value of attribute description.



16
17
18
# File 'lib/payment/base.rb', line 16

def description
  @description
end

#emailObject

Returns the value of attribute email.



16
17
18
# File 'lib/payment/base.rb', line 16

def email
  @email
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



13
14
15
# File 'lib/payment/base.rb', line 13

def error_message
  @error_message
end

#expirationObject

Returns the value of attribute expiration.



16
17
18
# File 'lib/payment/base.rb', line 16

def expiration
  @expiration
end

#faxObject

Returns the value of attribute fax.



16
17
18
# File 'lib/payment/base.rb', line 16

def fax
  @fax
end

#invoice_numberObject

Returns the value of attribute invoice_number.



16
17
18
# File 'lib/payment/base.rb', line 16

def invoice_number
  @invoice_number
end

#loginObject

Returns the value of attribute login.



16
17
18
# File 'lib/payment/base.rb', line 16

def 
  @login
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/payment/base.rb', line 16

def name
  @name
end

#passwordObject

Returns the value of attribute password.



16
17
18
# File 'lib/payment/base.rb', line 16

def password
  @password
end

#phoneObject

Returns the value of attribute phone.



16
17
18
# File 'lib/payment/base.rb', line 16

def phone
  @phone
end

#require_avsObject

Returns the value of attribute require_avs.



15
16
17
# File 'lib/payment/base.rb', line 15

def require_avs
  @require_avs
end

#result_codeObject (readonly)

Returns the value of attribute result_code.



13
14
15
# File 'lib/payment/base.rb', line 13

def result_code
  @result_code
end

#routing_codeObject

Returns the value of attribute routing_code.



16
17
18
# File 'lib/payment/base.rb', line 16

def routing_code
  @routing_code
end

#stateObject

Returns the value of attribute state.



16
17
18
# File 'lib/payment/base.rb', line 16

def state
  @state
end

#strict_sslObject

Returns the value of attribute strict_ssl.



15
16
17
# File 'lib/payment/base.rb', line 15

def strict_ssl
  @strict_ssl
end

#test_transactionObject

Returns the value of attribute test_transaction.



15
16
17
# File 'lib/payment/base.rb', line 15

def test_transaction
  @test_transaction
end

#transaction_typeObject (readonly)

Returns the value of attribute transaction_type.



13
14
15
# File 'lib/payment/base.rb', line 13

def transaction_type
  @transaction_type
end

#typeObject

Returns the value of attribute type.



16
17
18
# File 'lib/payment/base.rb', line 16

def type
  @type
end

#urlObject

Returns the value of attribute url.



14
15
16
# File 'lib/payment/base.rb', line 14

def url
  @url
end

#zipObject

Returns the value of attribute zip.



16
17
18
# File 'lib/payment/base.rb', line 16

def zip
  @zip
end

Instance Method Details

#submitObject

Raises:



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

def submit
	raise PaymentError, "No gateway specified"
end

#success?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/payment/base.rb', line 33

def success?
	@is_success ? true : false
end