[英]Testing paypal with rails URL error
我的Rails應用程序中有paypal,我想對其進行測試,該請求看起來不錯,但是由於某種原因,提交URL時已附加了localhost:3000並給了我這個錯誤。 我在secrets.yml文件中稱呼地址
[2015-01-20 14:33:31]錯誤URI :: InvalidURIError:方案http不接受注冊表部分:localhost:3000api.sandbox.paypal.com(或錯誤的主機名?)C:/ Ruby193 / lib / ruby /1.9.1/uri/generic.rb:1202:
rescue in merge' C:/Ruby193/lib/ruby/1.9.1/uri/generic.rb:1199:in
合並中C:/ Ruby193 / lib / ruby /1.9.1/webrick/httpresponse.rb:220setup_header' C:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:150:in
setup_header'Csetup_header' C:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:150:in
send_response'C:/Ruby193/lib/ruby/1.9 .1 / webrick / httpserver.rb:110:在run' C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in
在start_thread塊中'
代碼看起來像這樣
def paypal_url(return_path)
values = {
business: "username-facilitator@yahoo.com",
cmd: "_xclick",
upload: 1,
return: "#{Rails.application.secrets.app_host}#{return_path}",
invoice: id,
amount: course.price,
item_name: course.name,
item_number: course.id,
quantity: '1',
notify_url: "#{Rails.application.secrets.app_host}/hook"
}
"#{Rails.application.secrets.paypal_host}/cgi-bin/webscr?" + values.to_query
end
生成的Paypal URL錯誤:
localhost:3000api.sandbox.paypal.com
將Rails.application.secrets.paypal_host
修改為https://api.sandbox.paypal.com
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.