# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 42 42: def capture(money, transaction_id, options = {}) 43: post ={} 44: post[:transaction_id] = transaction_id 45: commit('S', money, post) 46: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 64 64: def credit(money, creditcard_or_card_id, options = {}) 65: post = {} 66: add_payment_source(post, creditcard_or_card_id, options) 67: commit('C', money, post) 68: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 34 34: def purchase(money, creditcard_or_card_id, options = {}) 35: post = {} 36: add_invoice(post, options) 37: add_payment_source(post, creditcard_or_card_id, options) 38: add_address(post, options) 39: commit('D', money, post) 40: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 60 60: def refund(money, identification, options = {}) 61: commit('U', money, options.merge(:transaction_id => identification)) 62: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 48 48: def store(creditcard, options = {}) 49: post = {} 50: add_creditcard(post, creditcard, options) 51: commit('T', nil, post) 52: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 76 76: def add_address(post, options) 77: if address = options[:billing_address] || options[:address] 78: post[:cardholder_street_address] = address[:address1].to_s.gsub(/[^\w.]/, '+') 79: post[:cardholder_zip] = address[:zip].to_s 80: end 81: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 99 99: def add_creditcard(post, creditcard, options) 100: post[:card_number] = creditcard.number 101: post[:cvv2] = creditcard.verification_value if creditcard.verification_value? 102: post[:card_exp_date] = expdate(creditcard) 103: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 83 83: def add_invoice(post, options) 84: if options.has_key? :order_id 85: post[:invoice_number] = options[:order_id].to_s.gsub(/[^\w.]/, '') 86: end 87: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 89 89: def add_payment_source(post, creditcard_or_card_id, options) 90: if creditcard_or_card_id.is_a?(String) 91: # using stored card 92: post[:card_id] = creditcard_or_card_id 93: else 94: # card info is provided 95: add_creditcard(post, creditcard_or_card_id, options) 96: end 97: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 114 114: def commit(action, money, parameters) 115: 116: url = test? ? TEST_URL : LIVE_URL 117: parameters[:transaction_amount] = amount(money) if money unless action == 'V' 118: 119: response = parse( ssl_post(url, post_data(action,parameters)) ) 120: 121: Response.new(response["error_code"] == "000", message_from(response), response, 122: :authorization => response["transaction_id"], 123: :test => test?, 124: :cvv_result => response["cvv2_result"], 125: :avs_result => { :code => response["avs_result"] } 126: ) 127: 128: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 130 130: def expdate(creditcard) 131: year = sprintf("%.4i", creditcard.year) 132: month = sprintf("%.2i", creditcard.month) 133: "#{month}#{year[-2..-1]}" 134: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 136 136: def message_from(response) 137: if response["error_code"] == "000" 138: "This transaction has been approved" 139: else 140: response["auth_response_text"] 141: end 142: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 105 105: def parse(body) 106: results = {} 107: body.split(/&/).each do |pair| 108: key,val = pair.split(/=/) 109: results[key] = val 110: end 111: results 112: end
# File lib/active_merchant/billing/gateways/merchant_e_solutions.rb, line 144 144: def post_data(action, parameters = {}) 145: post = {} 146: post[:profile_id] = @options[:login] 147: post[:profile_key] = @options[:password] 148: post[:transaction_type] = action if action 149: 150: request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&") 151: request 152: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.