【问题标题】:Testing Paypal error messages using ActiveMerchant使用 ActiveMerchant 测试 Paypal 错误消息
【发布时间】:2011-01-29 04:40:30
【问题描述】:

有没有办法测试您的应用程序对 Paypal 生成的信用卡错误的处理和处理?我想验证我的应用程序是否可以处理被拒绝的信用卡或类似情况。

那么有没有办法让 Paypal 发送错误消息?还是生成存根并在测试环境中使用它会更好?如果这是更好的方法,如何生成存根?

谢谢!

【问题讨论】:

    标签: ruby-on-rails paypal ruby-on-rails-plugins activemerchant


    【解决方案1】:

    是的!您可以通过设置进行测试:

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

    然而,PayPal 会要求您输入完整的账单信息,否则 API 甚至不会接受并返回:

    Error: There's an error with this transaction. Please enter a complete billing address.
    

    在这种情况下,您可以为其提供一些通用信息:

    :billing_address => {
        :name     => "Test Guy",
        :address1 => "123 W 423 E",
        :city     => "Somewhere",
        :state    => "CA",
        :country  => "US",
        :zip      => "88888"
     }
    

    【讨论】:

      猜你喜欢
      • 2013-01-01
      • 2014-01-26
      • 2012-03-14
      • 2012-06-30
      • 2016-08-07
      • 2014-10-06
      • 2020-02-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多