为什么我的代码不执行甚至条件都是真的?

时间:2016-12-01 16:25:32

标签: ruby-on-rails paypal

我想在我的应用中实施PayPal付款,并为此:

protect_from_forgery except: [:hook]
def hook
params.permit! # Permit all Paypal input params
status = params[:payment_status]

if status == "Pending"
  logger.info("AAAAAAAAA")

  @order = Order.find params[:invoice]
  @order.update_attributes notification_params: params, status: status, transaction_id: params[:txn_id], purchased_at: Time.now
end

render nothing: true

从PayPal我得到这些参数:

Parameters: {"mc_gross"=>"1.00", "invoice"=>"10", "protection_eligibility"=>"Eligible", "address_status"=>"unconfirmed", "payment_date"=>"08:13:55 Dec 01, 2016 PST", "payment_status"=>"Pending" ... }

如何看待我的payment_status等于"等待",但我的代码没有执行,我不知道为什么,即使我的条件status == "Pending"是真的。

有什么问题?我的日志上没有logger.info。我该如何解决这个问题?

0 个答案:

没有答案
相关问题