Currently Authorization and Capture is not implemented because capturing requires the original credit card information
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 31 31: def purchase(money, credit_card, options = {}) 32: requires!(options, :order_id) 33: 34: post = {} 35: add_amount(post, money) 36: add_invoice(post, options) 37: add_credit_card(post, credit_card) 38: 39: commit(:purchase, money, post) 40: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 50 50: def add_amount(post, money) 51: post[:amount] = amount(money) 52: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 61 61: def add_credit_card(post, credit_card) 62: post[:cardnum] = credit_card.number 63: post[:cardname] = credit_card.name 64: post[:expiry] = expdate(credit_card) 65: post[:cvv2] = credit_card.verification_value 66: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 54 54: def add_invoice(post, options) 55: post[:merchant_transid] = options[:order_id].to_s.slice(0,21) 56: post[:memnum] = options[:invoice] 57: post[:custnum] = options[:customer] 58: post[:clientdata] = options[:description] 59: end
Used for capturing, which is currently not supported.
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 44 44: def add_reference(post, identification) 45: auth, trans_id = identification.split(";") 46: post[:authnum] = auth 47: post[:transid] = trans_id 48: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 75 75: def commit(action, money, parameters) 76: response = parse( ssl_post(URL, post_data(action, parameters)) ) 77: 78: Response.new(successful?(response), message_from(response), response, 79: :test => test_response?(response), 80: :authorization => authorization_from(response) 81: ) 82: 83: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 68 68: def expdate(credit_card) 69: year = sprintf("%.4i", credit_card.year) 70: month = sprintf("%.2i", credit_card.month) 71: 72: "#{month}#{year[-2..-1]}" 73: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 97 97: def message_from(response) 98: successful?(response) ? SUCCESS_MESSAGE : response[:errorstring] 99: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 101 101: def parse(body) 102: response = {} 103: body.to_s.each_line do |l| 104: key, value = l.split(":", 2) 105: response[key.to_s.downcase.to_sym] = value.strip 106: end 107: response 108: end
# File lib/active_merchant/billing/gateways/pay_secure.rb, line 110 110: def post_data(action, parameters = {}) 111: parameters[:request_type] = TRANSACTIONS[action] 112: parameters[:merchant_id] = @options[:login] 113: parameters[:password] = @options[:password] 114: 115: parameters.reject{|k,v| v.blank?}.collect { |key, value| "#{key.to_s.upcase}=#{CGI.escape(value.to_s)}" }.join("&") 116: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.