【问题标题】:ActiveMerchant response gives StandardError for paypal.ActiveMerchant 响应为 paypal 提供 StandardError。
【发布时间】:2014-12-04 15:07:12
【问题描述】:

找不到原因。这只是行不通。我有这样的错误

test.rb:38:in `': 字段比服务器长或短 允许 (StandardError)

require "rubygems"
require "active_merchant" # 1.44

ActiveMerchant::Billing::Base.mode = :test

credit_card = ActiveMerchant::Billing::CreditCard.new(
  :brand              => 'Discover',
  :number             => "6011290531695840",
  :month              => 10,
  :year               => 2019,
  :first_name         => "Andrew",
  :last_name          => "Buyer",
  :verification_value => '123'
)

gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
  :login      => 'andrew.nashkolniy-facilitator_api1.gmail.com',
  :password   => 'TB6WUMTVUGYC6YAM'
)

amount = 100


if credit_card.validate.empty?

  response = gateway.authorize(amount, credit_card, :ip => "127.0.0.1")

  if response.success?
    gateway.capture(1000, response.authorization)
  else
    raise StandardError, response.message
  end
else
  puts "Error: credit card is not valid."
end

【问题讨论】:

    标签: ruby paypal activemerchant


    【解决方案1】:

    不确定我是否正确,但仅通过在 ActiveMerchant gem 中使用不同的模块解决了问题。

    TrustCommerceGateway 已更改为 PaypalExpressGateway....

    我没有找到更好的解决方案。

    【讨论】:

      猜你喜欢
      • 2011-06-16
      • 2011-06-01
      • 2011-04-02
      • 1970-01-01
      • 2011-04-03
      • 2013-03-05
      • 2010-12-13
      • 2013-01-01
      相关资源
      最近更新 更多