无法让ActiveMerchant使用rails 3服务器进行响应

时间:2011-09-08 04:25:59

标签: ruby-on-rails activemerchant

我正在使用Rails 3.1和ActiveMerchant 1.17

我正在使用正确的测试信用卡详细信息呼叫PaymentExpress网关。但是,它一直在提供某种形式的无效回复。

我能说的最多的是response.params数组包含

{"re_co"=>"Zz", "response_text"=>"Error in getting response.", "success"=>"0"}

这是使用本地rails服务器。

我有预感可能与SSL verify_peer选项有关,虽然我无法证明这一点,但我不知道如何配置该选项。

这是我的代码,相当标准的东西:

credit_card = ActiveMerchant::Billing::CreditCard.new(params[:credit_card])
gateway = ActiveMerchant::Billing::PaymentExpressGateway.new(:login => APP_CONFIG[:dps_username], :password => APP_CONFIG[:dps_password])
response = gateway.authorize total_cents, credit_card

有趣的是,它似乎从rails控制台运行良好。我有什么步骤可以调试吗?

1 个答案:

答案 0 :(得分:0)

好的,事实证明问题根本与ActiveMerchant无关。

我应该一直在使用

APP_CONFIG['dps_username']

而不是

APP_CONFIG[:dps_username]

啊,简单问题