# File lib/active_merchant/billing/gateways/federated_canada.rb, line 47 47: def capture(money, authorization, options = {}) 48: options[:transactionid] = authorization 49: commit('capture', money, options) 50: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 61 61: def credit(money, authorization, options = {}) 62: deprecated CREDIT_DEPRECATION_MESSAGE 63: refund(money, authorization, options) 64: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 29 29: def purchase(money, creditcard, options = {}) 30: post = {} 31: add_invoice(post, options) 32: add_creditcard(post, creditcard) 33: add_address(post, options) 34: add_customer_data(post, options) 35: commit('sale', money, post) 36: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 75 75: def add_address(post, options) 76: if address = (options[:billing_address] || options[:address]) 77: post[:company] = address[:company] 78: post[:address1] = address[:address1] 79: post[:address2] = address[:address2] 80: post[:city] = address[:city] 81: post[:state] = address[:state] 82: post[:zip] = address[:zip] 83: post[:country] = address[:country] 84: post[:phone] = address[:phone] 85: end 86: if address = options[:shipping_address] 87: post[:shipping_firstname] = address[:first_name] 88: post[:shipping_lastname] = address[:last_name] 89: post[:shipping_company] = address[:company] 90: post[:shipping_address1] = address[:address1] 91: post[:shipping_address2] = address[:address2] 92: post[:shipping_city] = address[:city] 93: post[:shipping_state] = address[:state] 94: post[:shipping_zip] = address[:zip] 95: post[:shipping_country] = address[:country] 96: post[:shipping_email] = address[:email] 97: end 98: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 105 105: def add_creditcard(post, creditcard) 106: post[:ccnumber] = creditcard.number 107: post[:ccexp] = expdate(creditcard) 108: post[:cvv] = creditcard.verification_value 109: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 68 68: def add_customer_data(post, options) 69: post[:firstname] = options[:first_name] 70: post[:lastname] = options[:last_name] 71: 72: post[:email] = options[:email] 73: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 100 100: def add_invoice(post, options) 101: post[:orderid] = options[:order_id] 102: post[:orderdescription] = options[:description] 103: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 125 125: def commit(action, money, parameters) 126: parameters[:amount] = amount(money) 127: data = ssl_post(URL, post_data(action, parameters)) 128: response = parse(data) 129: message = message_from(response) 130: test_mode = test? 131: 132: Response.new(success?(response), message, response, 133: :test => test?, 134: :authorization => response['transactionid'], 135: :avs_result => {:code => response['avsresponse']}, 136: :cvv_result => response['cvvresponse'] 137: ) 138: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 111 111: def expdate(creditcard) 112: year = sprintf("%.4i", creditcard.year) 113: month = sprintf("%.2i", creditcard.month) 114: "#{month}#{year[-2..-1]}" 115: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 148 148: def message_from(response) 149: case response['response'].to_i 150: when APPROVED 151: "Transaction Approved" 152: when DECLINED 153: "Transaction Declined" 154: else 155: "Error in transaction data or system error" 156: end 157: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 117 117: def parse(body) 118: body.split('&').inject({}) do |memo, x| 119: k, v = x.split('=') 120: memo[k] = v 121: memo 122: end 123: end
# File lib/active_merchant/billing/gateways/federated_canada.rb, line 159 159: def post_data(action, parameters = {}) 160: parameters[:type] = action 161: parameters[:username] = @options[:login] 162: parameters[:password] = @options[:password] 163: parameters.map{|k, v| "#{k}=#{CGI.escape(v.to_s)}"}.join('&') 164: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.