Class: GolfSwitch::Payment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Payment

Returns a new instance of Payment.



8
9
10
11
12
13
14
15
16
# File 'lib/golf_switch/payment.rb', line 8

def initialize(attributes={})
  attributes.each do |name, value|
    begin
      send("#{name}=", value)
    rescue
      puts "invalid attribute #{name} in payment"
    end
  end
end

Instance Attribute Details

#cc_address1Object

Returns the value of attribute cc_address1.



6
7
8
# File 'lib/golf_switch/payment.rb', line 6

def cc_address1
  @cc_address1
end

#cc_cityObject

Returns the value of attribute cc_city.



6
7
8
# File 'lib/golf_switch/payment.rb', line 6

def cc_city
  @cc_city
end

#cc_countryObject

Returns the value of attribute cc_country.



6
7
8
# File 'lib/golf_switch/payment.rb', line 6

def cc_country
  @cc_country
end

#cc_cvvObject

cc_type is VI: Visa,MC: MastercardAX: American Express only



5
6
7
# File 'lib/golf_switch/payment.rb', line 5

def cc_cvv
  @cc_cvv
end

#cc_emailObject

Returns the value of attribute cc_email.



6
7
8
# File 'lib/golf_switch/payment.rb', line 6

def cc_email
  @cc_email
end

#cc_exp_moObject

cc_type is VI: Visa,MC: MastercardAX: American Express only



5
6
7
# File 'lib/golf_switch/payment.rb', line 5

def cc_exp_mo
  @cc_exp_mo
end

#cc_exp_yrObject

cc_type is VI: Visa,MC: MastercardAX: American Express only



5
6
7
# File 'lib/golf_switch/payment.rb', line 5

def cc_exp_yr
  @cc_exp_yr
end

#cc_nameObject

Returns the value of attribute cc_name.



6
7
8
# File 'lib/golf_switch/payment.rb', line 6

def cc_name
  @cc_name
end

#cc_phoneObject

Returns the value of attribute cc_phone.



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

def cc_phone
  @cc_phone
end

#cc_postal_codeObject

Returns the value of attribute cc_postal_code.



6
7
8
# File 'lib/golf_switch/payment.rb', line 6

def cc_postal_code
  @cc_postal_code
end

#cc_stateObject

Returns the value of attribute cc_state.



6
7
8
# File 'lib/golf_switch/payment.rb', line 6

def cc_state
  @cc_state
end

#cc_typeObject

cc_type is VI: Visa,MC: MastercardAX: American Express only



5
6
7
# File 'lib/golf_switch/payment.rb', line 5

def cc_type
  @cc_type
end

#pay_amountObject

Returns the value of attribute pay_amount.



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

def pay_amount
  @pay_amount
end

#pay_currObject

Returns the value of attribute pay_curr.



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

def pay_curr
  @pay_curr
end

#pay_numberObject

cc_type is VI: Visa,MC: MastercardAX: American Express only



5
6
7
# File 'lib/golf_switch/payment.rb', line 5

def pay_number
  @pay_number
end

#pay_typeObject

cc_type is VI: Visa,MC: MastercardAX: American Express only



5
6
7
# File 'lib/golf_switch/payment.rb', line 5

def pay_type
  @pay_type
end

Instance Method Details

#option_attributesObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/golf_switch/payment.rb', line 18

def option_attributes
  options = {}
  options.merge!("PayType"=>@pay_type || "CC")
  options.merge!("CcType"=>@cc_type|| "VI")
  options.merge!("PayNumber"=>@pay_number)
  options.merge!("CcExpMo"=>@cc_exp_mo)
  options.merge!("CcExpYr"=>@cc_exp_yr)
  options.merge!("CcCVV"=>@cc_cvv) unless @cc_cvv.blank?
  options.merge!("CcName"=>@cc_name)
  options.merge!("CcAddress1"=>@cc_address1)
  options.merge!("CcCity"=>@cc_city)
  options.merge!("CcState"=>@cc_state)
  options.merge!("CcCountry"=>@cc_country || "USA")
  options.merge!("CcPostalCode"=>@cc_postal_code)
  options.merge!("CcEmail"=>@cc_email) unless @cc_email.blank?
  options.merge!("CcPhone"=>@cc_phone) unless @cc_phone.blank?
  options.merge!("PayAmount"=>@pay_amount)
  options.merge!("PayCurr"=>@pay_curr || "USD")

end