# File lib/active_merchant/billing/gateways/instapay.rb, line 51 51: def capture(money, authorization, options = {}) 52: post = {} 53: add_amount(post, money) 54: add_reference(post, authorization) 55: commit('ns_quicksale_cc', post) 56: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 40 40: def purchase(money, creditcard, options = {}) 41: post = {} 42: add_amount(post, money) 43: add_invoice(post, options) 44: add_creditcard(post, creditcard) 45: add_address(post, options) 46: add_customer_data(post, options) 47: 48: commit('ns_quicksale_cc', post) 49: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 73 73: def add_address(post, options) 74: if address = options[:billing_address] || options[:address] 75: post[:ci_billaddr1] = address[:address1] 76: post[:ci_billaddr2] = address[:address2] 77: post[:ci_billcity] = address[:city] 78: post[:ci_billstate] = address[:state] 79: post[:ci_billzip] = address[:zip] 80: post[:ci_billcountry] = address[:country] 81: post[:ci_phone] = address[:phone] 82: end 83: 84: if address = options[:shipping_address] 85: post[:ci_shipaddr1] = address[:address1] 86: post[:ci_shipaddr2] = address[:address2] 87: post[:ci_shipcity] = address[:city] 88: post[:ci_shipstate] = address[:state] 89: post[:ci_shipzip] = address[:zip] 90: post[:ci_shipcountry] = address[:country] 91: end 92: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 60 60: def add_amount(post, money) 61: post[:amount] = amount(money) 62: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 100 100: def add_creditcard(post, creditcard) 101: post[:ccnum] = creditcard.number 102: post[:expmon] = format(creditcard.month, :two_digits) 103: post[:cvv2] = creditcard.verification_value if creditcard.verification_value? 104: post[:expyear] = creditcard.year 105: post[:ccname] = creditcard.name 106: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 68 68: def add_customer_data(post, options) 69: post[:ci_email] = options[:email] 70: post["ci_IP Address"] = options[:ip] 71: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 94 94: def add_invoice(post, options) 95: post[:merchantordernumber] = options[:order_id] 96: post[:ci_memo] = options[:description] 97: post[:pocustomerrefid] = options[:invoice] 98: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 64 64: def add_reference(post, reference) 65: post[:postonly] = reference 66: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 140 140: def commit(action, parameters) 141: data = ssl_post GATEWAY_URL , post_data(action, parameters) 142: response = parse(data) 143: 144: Response.new(response[:success] , response[:message], response, 145: :authorization => response[:transaction_id], 146: :avs_result => { :code => response[:avs_result] }, 147: :cvv_result => response[:cvv_result] 148: ) 149: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 108 108: def parse(body) 109: results = {} 110: fields = body.split("\r\n") 111: 112: response = fields[1].split('=') 113: response_data = response[1].split(':') 114: 115: if response[0] == SUCCESS 116: results[:success] = true 117: results[:message] = SUCCESS_MESSAGE 118: results[:transaction_type] = response_data[0] 119: results[:authorization_code] = response_data[1] 120: results[:reference_number] = response_data[2] 121: results[:batch_number] = response_data[3] 122: results[:transaction_id] = response_data[4] 123: results[:avs_result] = response_data[5] 124: results[:authorize_net] = response_data[6] 125: results[:cvv_result] = response_data[7] 126: else 127: results[:success] = false 128: results[:result] = response_data[0] 129: results[:response_code] = response_data[1] 130: results[:message] = response_data[2] 131: end 132: 133: fields[1..1].each do |pair| 134: key, value = pair.split('=') 135: results[key] = value 136: end 137: results 138: end
# File lib/active_merchant/billing/gateways/instapay.rb, line 151 151: def post_data(action, parameters = {}) 152: post = {} 153: post[:acctid] = @options[:login] 154: if(@options[:password]) 155: post[:merchantpin] = @options[:password] 156: end 157: post[:action] = action 158: request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&") 159: request 160: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.