2017-04-10 35 views
0

付款這是一個「現在的工作現在它沒有」的情況 一切工作只是貝寶沙細,現在它給我下面的錯誤獲得當試圖創建通過PayPal

Internal Server Error 

The server encountered an internal error or misconfiguration and was unable 
to complete your request. 

Please contact the server administrator, [email protected] and inform 
them of the time the error occurred, and anything you might have done that 
may have caused the error. 

More information about this error may be available in the server error log. 
內部服務器錯誤

這是我cart.rb

def paypal_url(return_url,notify_url) 
    values = { 
    :business => '[email protected]', 
    :cmd => '_cart', 
    :upload => 1, 
    :return => return_url, 
    :invoice => id, 
    :notify_url => notify_url, 
    :cert_id => "4VA2YEE757V8A" 
    } 
    shopping_cart_items.each_with_index do |item, index| 
    values.merge!({ 
     "amount_#{index+1}" => (item.price_cents/100), 
     "item_name_#{index+1}" => Product.find(item.item_id).name, 
     "item_number_#{index+1}" => item.item_id, 
     "quantity_#{index+1}" => item.quantity 
    }) 
    end 
    encrypt_for_paypal(values) 
end 

PAYPAL_CERT_PEM = File.read("#{Rails.root}/certs/paypal_cert.pem") 
APP_CERT_PEM = File.read("#{Rails.root}/certs/app_cert.pem") 
APP_KEY_PEM = File.read("#{Rails.root}/certs/app_key.pem") 

def encrypt_for_paypal(values) 
    signed = OpenSSL::PKCS7::sign(OpenSSL::X509::Certificate.new(APP_CERT_PEM), 
           OpenSSL::PKey::RSA.new(APP_KEY_PEM, ''), 
           values.map { |k, v| "#{k}=#{v}" }.join("\n"), 
           [], 
           OpenSSL::PKCS7::BINARY) 

    OpenSSL::PKCS7::encrypt([OpenSSL::X509::Certificate.new(PAYPAL_CERT_PEM)], 
          signed.to_der, 
          OpenSSL::Cipher::Cipher::new("DES3"), 
          OpenSSL::PKCS7::BINARY).to_s.gsub("\n", "") 
end 

我重定向視圖

<%= form_tag "https://www.sandbox.paypal.com/cgi-bin/webscr", :id => 
'checkoutform' do %> 
    <%= hidden_field_tag :cmd, "_s-xclick" %> 
    <%= hidden_field_tag :encrypted, 
    @cart.paypal_url("http://www.mywebsite.com", 
    payment_notifications_url(:secret => "secretcode")) %> 
<% end %> 

我經歷了一切的一步一步,我什麼也沒得到

+0

你能清除你的緩存和餅乾,然後再試一次嗎? –

+0

我用了整個其他瀏覽器,我得到了非常相同的錯誤 –

回答

1

我從PayPal沙箱與加密按鈕收到相同的錯誤。我也沒有更改我的代碼,它在兩三個星期前工作。但是現在我得到和你一樣的錯誤。看起來PayPal並不太在乎修復他們的沙箱。他們不重視它。我建議你與他們開一張票。如果有足夠的客戶投訴,他們將解決這個問題的唯一方法。

+0

我想我會這樣做 –

相關問題