Class Index [+]

Quicksearch

ActiveMerchant::Billing::SallieMaeGateway

Constants

URL

Public Class Methods

new(options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 18
18:       def initialize(options = {})
19:         requires!(options, :login)
20:         @options = options
21:         super
22:       end

Public Instance Methods

authorize(money, creditcard, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 28
28:       def authorize(money, creditcard, options = {})
29:         post = PostData.new
30:         add_invoice(post, options)
31:         add_creditcard(post, creditcard)
32:         add_address(post, creditcard, options)
33:         add_customer_data(post, options)
34: 
35:         commit(:authonly, money, post)
36:       end
capture(money, authorization, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 48
48:       def capture(money, authorization, options = {})
49:         post = PostData.new
50:         post[:postonly] = authorization
51:         commit(:capture, money, post)
52:       end
purchase(money, creditcard, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 38
38:       def purchase(money, creditcard, options = {})
39:         post = PostData.new
40:         add_invoice(post, options)
41:         add_creditcard(post, creditcard)
42:         add_address(post, creditcard, options)
43:         add_customer_data(post, options)
44: 
45:         commit(:sale, money, post)
46:       end
test?() click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 24
24:       def test?
25:         @options[:login] == "TEST0"
26:       end

Private Instance Methods

add_address(post, creditcard, options) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 65
65:       def add_address(post, creditcard, options)
66:         if address = options[:billing_address] || options[:address]
67:           post[:ci_billaddr1] = address[:address1].to_s
68:           post[:ci_billaddr2] = address[:address2].to_s unless address[:address2].blank?
69:           post[:ci_billcity]  = address[:city].to_s
70:           post[:ci_billstate] = address[:state].to_s
71:           post[:ci_billzip]   = address[:zip].to_s
72:         end
73: 
74:         if shipping_address = options[:shipping_address] || options[:address]
75:           post[:ci_shipaddr1] = shipping_address[:address1].to_s
76:           post[:ci_shipaddr2] = shipping_address[:address2].to_s unless shipping_address[:address2].blank?
77:           post[:ci_shipcity]  = shipping_address[:city].to_s
78:           post[:ci_shipstate] = shipping_address[:state].to_s
79:           post[:ci_shipzip]   = shipping_address[:zip].to_s
80:         end
81:       end
add_creditcard(post, creditcard) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 88
88:       def add_creditcard(post, creditcard)
89:         post[:ccnum]   = creditcard.number.to_s
90:         post[:ccname]  = creditcard.name.to_s
91:         post[:cvv2]    = creditcard.verification_value.to_s if creditcard.verification_value?
92:         post[:expmon]  = creditcard.month.to_s
93:         post[:expyear] = creditcard.year.to_s
94:       end
add_customer_data(post, options) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 56
56:       def add_customer_data(post, options)
57:         if address = options[:billing_address] || options[:shipping_address] || options[:address]
58:           post[:ci_phone] = address[:phone].to_s
59:         end
60: 
61:         post[:ci_email] = options[:email].to_s unless options[:email].blank?
62:         post[:ci_IP]    = options[:ip].to_s unless options[:ip].blank?
63:       end
add_invoice(post, options) click to toggle source
    # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 83
83:       def add_invoice(post, options)
84:         memo = "OrderID: #{options[:order_id]}\nDescription: #{options[:description]}"
85:         post[:ci_memo] = memo
86:       end
commit(action, money, parameters) click to toggle source
     # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 108
108:       def commit(action, money, parameters)
109:         parameters[:acctid] = @options[:login].to_s
110:         parameters[:subid]  = @options[:sub_id].to_s unless @options[:sub_id].blank?
111:         parameters[:amount] = amount(money)
112: 
113:         case action
114:         when :sale
115:           parameters[:action] = "ns_quicksale_cc"
116:         when :authonly
117:           parameters[:action] = "ns_quicksale_cc"
118:           parameters[:authonly] = 1
119:         when :capture
120:           parameters[:action] = "ns_quicksale_cc"
121:         end
122: 
123:         response = parse(ssl_post(URL, parameters.to_post_data) || "")
124:         Response.new(successful?(response), message_from(response), response,
125:           :test => test?,
126:           :authorization => response["refcode"]
127:         )
128:       end
message_from(response) click to toggle source
     # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 134
134:       def message_from(response)
135:         if successful?(response)
136:           "Accepted"
137:         else
138:           response["Reason"].split(":")[2].capitalize unless response["Reason"].nil?
139:         end
140:       end
parse(body) click to toggle source
     # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 96
 96:       def parse(body)
 97:         h = {}
 98:         body.gsub!("<html><body><plaintext>", "")
 99:         body.
100:           split("\r\n").
101:           map do |i|
102:             a = i.split("=")
103:             h[a.first] = a.last unless a.first.nil?
104:           end
105:         h
106:       end
successful?(response) click to toggle source
     # File lib/active_merchant/billing/gateways/sallie_mae.rb, line 130
130:       def successful?(response)
131:         response["Status"] == "Accepted"
132:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.