Class: GatewayCustomer
- Inherits:
-
Object
- Object
- GatewayCustomer
- Includes:
- GatewayErrors
- Defined in:
- lib/gateway_customer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#cell_phone ⇒ Object
Returns the value of attribute cell_phone.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email_id ⇒ Object
Returns the value of attribute email_id.
-
#fax ⇒ Object
Returns the value of attribute fax.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#home_phone ⇒ Object
Returns the value of attribute home_phone.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#office_ext ⇒ Object
Returns the value of attribute office_ext.
-
#office_phone ⇒ Object
Returns the value of attribute office_phone.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
- #convert_to_authorize_net_input(card = nil) ⇒ Object
- #convert_to_braintree_input(card = nil) ⇒ Object
- #convert_to_fortis_input ⇒ Object
-
#initialize(first_name, last_name, email_id) ⇒ GatewayCustomer
constructor
A new instance of GatewayCustomer.
Constructor Details
#initialize(first_name, last_name, email_id) ⇒ GatewayCustomer
Returns a new instance of GatewayCustomer.
6 7 8 9 10 |
# File 'lib/gateway_customer.rb', line 6 def initialize(first_name, last_name, email_id) self.first_name = first_name.to_s.gsub(/\s/, "") self.last_name = last_name.to_s.gsub(/\s/, "") self.email_id = email_id.to_s.gsub(/\s/, "") end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def address @address end |
#cell_phone ⇒ Object
Returns the value of attribute cell_phone.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def cell_phone @cell_phone end |
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def country @country end |
#email_id ⇒ Object
Returns the value of attribute email_id.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def email_id @email_id end |
#fax ⇒ Object
Returns the value of attribute fax.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def fax @fax end |
#first_name ⇒ Object
Returns the value of attribute first_name.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def first_name @first_name end |
#home_phone ⇒ Object
Returns the value of attribute home_phone.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def home_phone @home_phone end |
#last_name ⇒ Object
Returns the value of attribute last_name.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def last_name @last_name end |
#office_ext ⇒ Object
Returns the value of attribute office_ext.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def office_ext @office_ext end |
#office_phone ⇒ Object
Returns the value of attribute office_phone.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def office_phone @office_phone end |
#state ⇒ Object
Returns the value of attribute state.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def state @state end |
#zip ⇒ Object
Returns the value of attribute zip.
4 5 6 |
# File 'lib/gateway_customer.rb', line 4 def zip @zip end |
Instance Method Details
#convert_to_authorize_net_input(card = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/gateway_customer.rb', line 28 def (card = nil) customer = { :description => "Diaspark Payment Gateway", :email => self.email_id, :payment_profiles => [{ :cust_type => AuthorizeNet::CIM::PaymentProfile::CustomerType::INDIVIDUAL, :first_name => self.first_name, :last_name => self.last_name, :address => self.address, :city => self.city, :state => self.state, :zip => self.zip, :phone => self.cell_phone, :fax => self.fax, :country => self.country }] } if card raise TransactionGatewayInvalidCardType unless card.class == GatewayCard customer[:payment_profiles][0].merge!({ :card_num => card.card_number, :exp_date => "#{card.expiration_month}#{card.expiration_year}" }) end return customer end |
#convert_to_braintree_input(card = nil) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/gateway_customer.rb', line 62 def convert_to_braintree_input(card = nil) customer = { :first_name => self.first_name, :last_name => self.last_name, :email => self.email_id } if card raise TransactionGatewayInvalidCardType unless card.class == GatewayCard customer.merge!( {:credit_card => { :number => card.card_number, :cvv => card.cvv, :expiration_month => card.expiration_month, :expiration_year => card.expiration_year, :options => {:verify_card => "1"} } }) end return customer end |
#convert_to_fortis_input ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gateway_customer.rb', line 12 def convert_to_fortis_input return { :first_name => self.first_name, :last_name => self.last_name, :email => self.email_id, :address => self.address, :city => self.city, :state => self.state, :zip => self.zip, :cell_phone => self.cell_phone, :office_phone => self.office_phone, :office_ext_phone => self.office_ext, :home_phone => self.home_phone } end |