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請求?有沒有方法可以測試其中的一部分?任何幫助不勝感激。
最佳,
添
你能提供stacktrace嗎? – Anatoly
不,沒有錯誤或異常,只是@ order.authorize_payment的成功屬性爲false。所以我很想有堆棧跟蹤。從操作系統或紅寶石的角度來看沒有錯誤。我能得到的唯一反饋是閃光燈中的錯誤信息,這不是很有幫助。 – bonhoffer
flash [:notice] = purchase.errors.full_messages.join(',) – Anatoly