Class: SallieMaeGateway::Payment

Inherits:
Object
  • Object
show all
Defined in:
app/models/sallie_mae_gateway/payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Payment

Returns a new instance of Payment.



8
9
10
11
12
13
14
15
16
17
# File 'app/models/sallie_mae_gateway/payment.rb', line 8

def initialize(args={})
  if args.is_a? Hash
    args[:allow_edit] ||= false 
    args[:payment_type] ||= CREDIT_CARD
    args.each { |key, value|
      instance_variable_set "@#{key}", value
    }
  end
  @line_items ||= []
end

Instance Attribute Details

#allow_editObject

Returns the value of attribute allow_edit.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def allow_edit
  @allow_edit
end

#cancel_urlObject

Returns the value of attribute cancel_url.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def cancel_url
  @cancel_url
end

#finish_urlObject

Returns the value of attribute finish_url.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def finish_url
  @finish_url
end

#line_itemsObject

Returns the value of attribute line_items.



5
6
7
# File 'app/models/sallie_mae_gateway/payment.rb', line 5

def line_items
  @line_items
end

#payment_typeObject

Returns the value of attribute payment_type.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def payment_type
  @payment_type
end

#postback_urlObject

Returns the value of attribute postback_url.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def postback_url
  @postback_url
end

#school_idObject

Returns the value of attribute school_id.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def school_id
  @school_id
end

#studentObject

Returns the value of attribute student.



5
6
7
# File 'app/models/sallie_mae_gateway/payment.rb', line 5

def student
  @student
end

#user_def1Object

Returns the value of attribute user_def1.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def user_def1
  @user_def1
end

#user_def2Object

Returns the value of attribute user_def2.



6
7
8
# File 'app/models/sallie_mae_gateway/payment.rb', line 6

def user_def2
  @user_def2
end

Instance Method Details

#total_amountObject



35
36
37
# File 'app/models/sallie_mae_gateway/payment.rb', line 35

def total_amount
  @line_items.reduce(0.0) { |sum, item| sum += item.amount }
end