Class: Cybersourcery::Payment

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming, ActiveModel::Translation
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
lib/cybersourcery/payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(signer, profile, params) ⇒ Payment

Returns a new instance of Payment.



26
27
28
29
30
31
32
33
# File 'lib/cybersourcery/payment.rb', line 26

def initialize(signer, profile, params)
  @signer = signer
  @profile = profile
  @params = params
  # I'm not doing dependency injection for ActiveModel dependencies.
  # Given we're extending ActiveModel::Naming above, we're already tightly bound...
  @errors = ActiveModel::Errors.new(self)
end

Instance Attribute Details

#bill_to_address_cityObject

Returns the value of attribute bill_to_address_city.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_address_city
  @bill_to_address_city
end

#bill_to_address_line1Object

Returns the value of attribute bill_to_address_line1.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_address_line1
  @bill_to_address_line1
end

#bill_to_address_line2Object

Returns the value of attribute bill_to_address_line2.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_address_line2
  @bill_to_address_line2
end

#bill_to_address_postal_codeObject

Returns the value of attribute bill_to_address_postal_code.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_address_postal_code
  @bill_to_address_postal_code
end

#bill_to_address_stateObject

Returns the value of attribute bill_to_address_state.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_address_state
  @bill_to_address_state
end

#bill_to_emailObject

Returns the value of attribute bill_to_email.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_email
  @bill_to_email
end

#bill_to_forenameObject

Returns the value of attribute bill_to_forename.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_forename
  @bill_to_forename
end

#bill_to_surnameObject

Returns the value of attribute bill_to_surname.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def bill_to_surname
  @bill_to_surname
end

#card_expiry_dateObject

Returns the value of attribute card_expiry_date.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def card_expiry_date
  @card_expiry_date
end

#card_expiry_monthObject

Returns the value of attribute card_expiry_month.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def card_expiry_month
  @card_expiry_month
end

#card_expiry_yearObject

Returns the value of attribute card_expiry_year.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def card_expiry_year
  @card_expiry_year
end

#card_numberObject

Returns the value of attribute card_number.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def card_number
  @card_number
end

#card_typeObject

Returns the value of attribute card_type.



12
13
14
# File 'lib/cybersourcery/payment.rb', line 12

def card_type
  @card_type
end

#errorsObject (readonly)

Returns the value of attribute errors.



11
12
13
# File 'lib/cybersourcery/payment.rb', line 11

def errors
  @errors
end

#paramsObject (readonly)

Returns the value of attribute params.



11
12
13
# File 'lib/cybersourcery/payment.rb', line 11

def params
  @params
end

#profileObject (readonly)

Returns the value of attribute profile.



11
12
13
# File 'lib/cybersourcery/payment.rb', line 11

def profile
  @profile
end

#signerObject (readonly)

Returns the value of attribute signer.



11
12
13
# File 'lib/cybersourcery/payment.rb', line 11

def signer
  @signer
end

Instance Method Details

#form_action_urlObject



35
36
37
# File 'lib/cybersourcery/payment.rb', line 35

def form_action_url
  @profile.transaction_url
end

#persisted?Boolean

To keep ActiveModel::Conversion happy

Returns:

  • (Boolean)


22
23
24
# File 'lib/cybersourcery/payment.rb', line 22

def persisted?
  false
end

#signed_fieldsObject



39
40
41
# File 'lib/cybersourcery/payment.rb', line 39

def signed_fields
  @signer.add_and_sign_fields(@params)
end