2011-07-22 29 views
0

下面的代碼故障排除的商戶「回無法與500內部服務器錯誤」

 
    purchase = @order.authorize_payment(@credit_card, options) 
    is_success = purchase.success? 
    if is_success 
     ... 
    else 
     flash[:notice] = "!! " + purchase.message + "
" + purchase.params['missingField'].to_s redirect_to :action => :payment, :id => @order.id end

結果「!!無法與500內部服務器錯誤」在我的閃存[:另行通知。沒有堆棧跟蹤,沒有web服務器錯誤,我知道的只是purchase.message被填充並且purchase.success?是錯誤的。

我真的不知如何解決這個問題。我認爲這可能是一個SSL的要求,但我不能看到肥皂請求,或測試與網絡資源(我的支付網關)的基本連接。

建立我的網關與此代碼(config.after_initialize做後):

 
ActiveMerchant::Billing::Base.mode = :production # :test 
    ActiveMerchant::Billing::CreditCard.require_verification_value = false 
    ActiveMerchant::Billing::CyberSourceGateway.wiredump_device = File.new(File.join([Rails.root, "log", "cybersource.log"]), "a") # doesn't work (!) 
    # we need to open an external file to get the password 
    mypassphrase = File.open('/var/www/foo/shared/passphrase.txt').read 
    OrderTransaction.gateway = ActiveMerchant::Billing::CyberSourceGateway.new(:login => 'vxxxxxxx', 
                :password => mypassphrase.to_s, 
                :test => false, 
                :vat_reg_number => 'your VAT registration number', 
                # sets the states/provinces where you have a physical presense for tax purposes 
                :nexus => "GA OH", 
                # don‘t want to use AVS so continue processing even if AVS would have failed 
                :ignore_avs => true, 
                # don‘t want to use CVV so continue processing even if CVV would have failed 
                :ignore_cvv => true, 
                :money_format => :dollars 
                ) 

我能看到SOAP請求?有沒有方法可以測試其中的一部分?任何幫助不勝感激。

最佳,

+0

你能提供stacktrace嗎? – Anatoly

+0

不,沒有錯誤或異常,只是@ order.authorize_payment的成功屬性爲false。所以我很想有堆棧跟蹤。從操作系統或紅寶石的角度來看沒有錯誤。我能得到的唯一反饋是閃光燈中的錯誤信息,這不是很有幫助。 – bonhoffer

+0

flash [:notice] = purchase.errors.full_messages.join(',) – Anatoly

回答

1

所以,後期的反應,但......

我所做的工作,良好的量與Cyber​​Source的網關,並查看SOAP請求的唯一途徑/ cybersource網關的響應當前是打開gem並對其進行編輯。

如果修改的lib/active_merchant /計費/網關/ cybersource.rb的commit方法,你可以做這樣的事情:

def commit(request, options) 
    puts "*** POSTING TO: #{test? ? TEST_URL : LIVE_URL}" 
    request = build_request(request, options) 
    puts "*** POSTING:" 
    puts request 
    begin 
     post_response = ssl_post(test? ? TEST_URL : LIVE_URL, request) 
    rescue ActiveMerchant::ResponseError => e 
     puts "ERROR!" 
     puts e.response 
    end 
    puts post_response 

這將是很好,如果有一種方式來獲得該響應如果沒有經歷這個麻煩,我會看看是否有辦法通過返回的響應對象傳遞這些信息並將其添加到我的fork中。

+0

你有什麼想法爲什麼網絡發送500響應? – Nerve

4

ActiveMerchant :: Billing :: Cyber​​SourceGateway.logger = your_logger