我创建使用Active商家和PayPal沙箱,现在的商店。这似乎是工作正常,但我不认为它甚至远程安全。我真的不知道太多关于HTTPS和如何实现安全连接。

我目前通过信用卡,并在会话(可能不是最聪明的想法)的计费信息。我当前的代码贴在下面。我真的需要什么方向和要采取的措施,以使之成为一个安全,可用储存帮助。

 def payment
session[:billing_address] = params[:billing_address] 
 end

 def summary
    @credit_card = params[:credit_card]
    session[:credit_card] = params[:credit_card]
    @billing_address = session[:billing_address]
    @cart = get_cart
    @purchases  = @cart.purchases
    @total = @cart.total
 end

 def finish
     @cart = get_cart
     @total = @cart.total

     credit_card = ActiveMerchant::Billing::CreditCard.new( session[:credit_card] )

     billing_address = session[:billing_address]

     flash[:notice] = credit_card.errors and return unless credit_card.valid?

     gateway = ActiveMerchant::Billing::PaypalGateway.new(:login=>$PAYPAL_LOGIN, :password=>$PAYPAL_PASSWORD)

     res = gateway.authorize(@total, credit_card, :ip=>request.remote_ip, :billing_address=>billing_address)

     if res.success?
        gateway.capture(@total, res.authorization)
        flash[:notice] = "Authorized" 
     else
        flash[:notice] = "Failure: " + res.message.to_s
     end    
  end
有帮助吗?

解决方案

有是有关如何实现SSL良好的railscast。

http://railscasts.com/episodes/143-paypal-security

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top