Class Index [+]

Quicksearch

ActiveMerchant::Billing::VerifiGateway

Constants

URL
RESPONSE_CODE_MESSAGES
SUCCESS
TRANSACTIONS

Public Class Methods

new(options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/verifi.rb, line 66
66:         def initialize(options = {})
67:         requires!(options, :login, :password)
68:         @options = options
69:         super
70:         end

Public Instance Methods

authorize(money, credit_card, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/verifi.rb, line 76
76:       def authorize(money, credit_card, options = {})
77:         sale_authorization_or_credit_template(:authorization, money, credit_card, options)
78:       end
capture(money, authorization, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/verifi.rb, line 80
80:       def capture(money, authorization, options = {})
81:         capture_void_or_refund_template(:capture, money, authorization, options)
82:       end
credit(money, credit_card_or_authorization, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/verifi.rb, line 88
88:       def credit(money, credit_card_or_authorization, options = {})
89:         if credit_card_or_authorization.is_a?(String)
90:           deprecated CREDIT_DEPRECATION_MESSAGE
91:           refund(money, credit_card_or_authorization, options)
92:         else
93:           sale_authorization_or_credit_template(:credit, money, credit_card_or_authorization, options)
94:         end
95:       end
purchase(money, credit_card, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/verifi.rb, line 72
72:       def purchase(money, credit_card, options = {})
73:         sale_authorization_or_credit_template(:purchase, money, credit_card, options)
74:       end
refund(money, reference, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/verifi.rb, line 97
97:       def refund(money, reference, options = {})
98:         capture_void_or_refund_template(:refund, money, reference, options)
99:       end
void(authorization, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/verifi.rb, line 84
84:       def void(authorization, options = {})
85:         capture_void_or_refund_template(:void, 0, authorization, options)
86:       end

Private Instance Methods

add_addresses(post, options) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 136
136:       def add_addresses(post, options)
137:         if billing_address = options[:billing_address] || options[:address]
138:           post[:company]    = billing_address[:company]
139:           post[:address1]   = billing_address[:address1]
140:           post[:address2]   = billing_address[:address2]
141:           post[:city]       = billing_address[:city]                           
142:           post[:state]      = billing_address[:state]
143:           post[:zip]        = billing_address[:zip]                               
144:           post[:country]    = billing_address[:country]
145:           post[:phone]      = billing_address[:phone]
146:           post[:fax]        = billing_address[:fax]             
147:         end
148:         
149:         if shipping_address = options[:shipping_address]
150:           post[:shipping_firstname] = shipping_address[:first_name]
151:           post[:shipping_lastname]  = shipping_address[:last_name]  
152:           post[:shipping_company]   = shipping_address[:company]    
153:           post[:shipping_address1]  = shipping_address[:address1]   
154:           post[:shipping_address2]  = shipping_address[:address2]   
155:           post[:shipping_city]      = shipping_address[:city]       
156:           post[:shipping_state]     = shipping_address[:state]      
157:           post[:shipping_zip]       = shipping_address[:zip]        
158:           post[:shipping_country]   = shipping_address[:country]    
159:           post[:shipping_email]     = shipping_address[:email]      
160:         end        
161:       end
add_credit_card(post, credit_card) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 121
121:       def add_credit_card(post, credit_card)
122:         post[:ccnumber]  = credit_card.number
123:         post[:ccexp]     = expdate(credit_card)
124:         post[:firstname] = credit_card.first_name
125:         post[:lastname]  = credit_card.last_name      
126:         post[:cvv]       = credit_card.verification_value
127:       end
add_customer_data(post, options) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 163
163:       def add_customer_data(post, options)
164:         post[:email]     = options[:email]
165:         post[:ipaddress] = options[:ip]
166:       end
add_invoice_data(post, options) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 168
168:       def add_invoice_data(post, options)
169:         post[:orderid]            = options[:order_id]
170:         post[:ponumber]           = options[:invoice]
171:         post[:orderdescription]   = options[:description]
172:         post[:tax]                = options[:tax]
173:         post[:shipping]           = options[:shipping]
174:       end
add_optional_data(post, options) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 176
176:       def add_optional_data(post, options)
177:         post[:billing_method]     = options[:billing_method]    
178:         post[:website]            = options[:website]   
179:         post[:descriptor]         = options[:descriptor]         
180:         post[:descriptor_phone]   = options[:descriptor_phone]   
181:         post[:cardholder_auth]    = options[:cardholder_auth]    
182:         post[:cavv]               = options[:cavv]               
183:         post[:xid]                = options[:xid]                
184:         post[:customer_receipt]   = options[:customer_receipt]
185:       end
add_security_key_data(post, options, money) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 187
187:       def add_security_key_data(post, options, money)
188:         # MD5(username|password|orderid|amount|time)
189:         now = Time.now.to_i.to_s
190:         md5 = Digest::MD5.new
191:         md5 << @options[:login].to_s + "|"
192:         md5 << @options[:password].to_s + "|"
193:         md5 << options[:order_id].to_s + "|"
194:         md5 << amount(money).to_s + "|"
195:         md5 << now
196:         post[:key]  = md5.hexdigest
197:         post[:time] = now
198:       end
capture_void_or_refund_template(trx_type, money, authorization, options) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 114
114:       def capture_void_or_refund_template(trx_type, money, authorization, options)
115:         post = VerifiPostData.new
116:         post[:transactionid] = authorization
117:         
118:         commit(trx_type, money, post)
119:       end
commit(trx_type, money, post) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 200
200:       def commit(trx_type, money, post)
201:         post[:amount] = amount(money)
202:         
203:         response = parse( ssl_post(URL, post_data(trx_type, post)) )
204:                          
205:         Response.new(response[:response].to_i == SUCCESS, message_from(response), response,
206:           :test => test?,
207:           :authorization => response[:transactionid],
208:           :avs_result => { :code => response[:avsresponse] },
209:           :cvv_result => response[:cvvresponse]
210:         )
211:       end
expdate(credit_card) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 129
129:       def expdate(credit_card)
130:         year  = sprintf("%.4i", credit_card.year)
131:         month = sprintf("%.2i", credit_card.month)
132: 
133:         "#{month}#{year[-2..-1]}"
134:       end
message_from(response) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 213
213:       def message_from(response)
214:         response[:response_code_message] ? response[:response_code_message] : ""
215:       end
parse(body) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 217
217:       def parse(body)
218:         results = {}
219:         CGI.parse(body).each { |key, value| results[key.intern] = value[0] }
220:         results[:response_code_message] = RESPONSE_CODE_MESSAGES[results[:response_code]] if results[:response_code]
221:         results
222:       end
post_data(trx_type, post) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 224
224:       def post_data(trx_type, post)
225:         post[:username]   = @options[:login]  
226:         post[:password]   = @options[:password]
227:         post[:type]       = TRANSACTIONS[trx_type]
228:         
229:         post.to_s
230:       end
sale_authorization_or_credit_template(trx_type, money, credit_card, options = {}) click to toggle source
     # File lib/active_merchant/billing/gateways/verifi.rb, line 103
103:       def sale_authorization_or_credit_template(trx_type, money, credit_card, options = {})
104:         post = VerifiPostData.new
105:         add_security_key_data(post, options, money)
106:         add_credit_card(post, credit_card)
107:         add_addresses(post, options)
108:         add_customer_data(post, options)
109:         add_invoice_data(post, options)
110:         add_optional_data(post, options)
111:         commit(trx_type, money, post)  
112:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.