无法使用 Rails 3 服务器让 ActiveMerchant 做出响应

发布于 2024-12-03 21:21:51 字数 747 浏览 0 评论 0原文

我正在使用 Rails 3.1 和 ActiveMerchant 1.17

我正在调用 PaymentExpress 网关,使用正确的测试信用卡详细信息。但是,它不断给出某种形式的无效响应。

我最多能看出的是,response.params 数组包含

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

This is using the local Rails server。

我有预感,这可能与 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 控制台上运行良好。我应该采取任何步骤来调试这个吗?

I'm using Rails 3.1 and ActiveMerchant 1.17

I'm calling the PaymentExpress gateway, using the correct test credit card details. However, it keeps giving some form of invalid response.

The most I can make out is that the response.params array contains

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

This is using the local rails server.

I have a hunch that it may be to do with the SSL verify_peer option, though I have no way of proving that, and I have no idea how to configure that option.

This is my code, fairly standard stuff:

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

Interestingly, it seems to work fine from the rails console. Are there any steps I should be taking to debug this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耶耶耶 2024-12-10 21:21:51

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

我应该使用

APP_CONFIG['dps_username']

而不是

APP_CONFIG[:dps_username]

啊,简单的问题

Ok, it turns out the problem wasn't to do with ActiveMerchant at all.

I should have been using

APP_CONFIG['dps_username']

instead of

APP_CONFIG[:dps_username]

Ahh, the simple problems

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文