【发布时间】:2015-12-11 06:59:56
【问题描述】:
我有一个 Authorize.net 帐户,用于在我的电子商务网站上进行抄送处理,并且我使用 ActiveMerchant 来验证交易。直到不久前它工作得很好,然后就停止了。我不知道为什么。当我在测试模式下运行它时,它工作正常,创建交易并成功授权资金。但是当我尝试使用真实账户时,它失败了。当我从控制台运行它时,代码如下:
cc_hash =
:first_name => 'Donald',
:last_name => 'Duck',
:number => '4007000000027',
:month => '8',
:year => Time.now.year+1,
:verification_value => '000'
}
card = ActiveMerchant::Billing::CreditCard.new(cc_hash)
#--- valid?
RYeller.bar
if card.valid?
puts "card valid"
else
puts "card not valid"
end
#ActiveMerchant::Billing::Base.mode = :test
#gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login=>'scrubbed',:password=>'scrubbed')
ActiveMerchant::Billing::Base.mode = :production
gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login=>'scrubbed',:password=>'scrubbed')
amount = rand(1000)+2500
options = {}
options[:order_id] = "WEBSITE 26"
options[:description] = 'WEBSITE TEST'
#--- authorize transaction
response = gateway.authorize(amount, card, options)
puts response.inspect
当我在测试模式下运行它时,在我的沙盒帐户中(上面代码中注释掉的两行) - 它工作正常。当我在我的真实帐户上运行它时(代码如上) - 我收到一个错误:“处理过程中发生错误。请致电商家服务提供商。”完整的响应哈希是:
#<ActiveMerchant::Billing::Response:0x1078607d8 @fraud_review=false, @params={"response_reason_code"=>"35", "avs_result_code"=>"P", "transaction_id"=>"scrubbed", "response_code"=>2, "response_reason_text"=>"An error occurred during processing. Call Merchant Service Provider.", "card_code"=>"P"}, @message="An error occurred during processing. Call Merchant Service Provider", @authorization="scrubbed", @test=false, @cvv_result={"message"=>"Not Processed", "code"=>"P"}, @success=false, @avs_result={"message"=>"Postal code matches, but street address not verified.", "street_match"=>nil, "postal_match"=>"Y", "code"=>"P"}>
我正在使用测试 CC 编号和 card.valid?测试返回真。
当我查看 Authorize.net 中的交易时,我看到了所有已创建的交易和所有正确的信息,但交易代码是一般错误。
有什么想法吗?非常感谢您的帮助,我已经走到了尽头,并且正在快速下沉。
【问题讨论】:
标签: ruby-on-rails transactions authorize.net activemerchant