我有activemerchant 1.16.0和rails 3.0.5。
我正在尝试使用active merchant构建基本代码,与PayPal的网关通信。
if credit_card.valid?
# or gateway.purchase to do both authorize and capture
response = gateway.authorize(1000, credit_card, :ip => "127.0.0.1")
if response.success?
gateway.capture(1000, response.authorization)
puts "Purchase complete!"
else
puts "Error: #{response.message}"
end
else
puts "Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}"
end
I get the following error:
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.9/lib/active_support/xml_mini/rexml.rb:20:in `parse': uninitialized constant ActiveSupport::XmlMini_REXML::StringIO (NameError)
这个错误来自于
gateway.authorize()
调用。有什么问题导致的呢?谢谢。
require "stringio"
,但你不应该需要这样做。 - Andrew Grimm