ActiveMerchant响应为paypal提供StandardError。

时间:2014-10-09 15:42:18

标签: ruby paypal activemerchant

无法找到原因。它只是不起作用。我有这样的错误

  

test.rb:38:在`':字段比服务器更长或更短   允许(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

1 个答案:

答案 0 :(得分:0)

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

TrustCommerceGateway改为PaypalExpressGateway ....

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