undefined方法`[]'表示false:自适应补偿-sdk-ruby上的FalseClass

时间:2017-01-01 18:31:45

标签: ruby-on-rails ruby ruby-on-rails-3 paypal

有人遇到这个问题吗?或者现在为什么这是在配置paypal sdk adaptive?

将配置放在yml上没有显示此消息但是也没有用,所以

我将sdk配置为:购买行动

并在日志中显示:

第58行是PayPal :: SDK.configure

  

NoMethodError(未定义方法[]' for false:FalseClass):
app/controllers/orders_controller.rb:58:in
买'

def buy
    require 'paypal-sdk-adaptivepayments'

    PayPal::SDK.configure(
      :mode      => "live",  # Set "live" for production
      :app_id    => "APP-xxxxx",
      :username  => "xxxx.yyyy.com",
      :password  => "xxxx",
      :signature => "xxxxx" )



      @api = PayPal::SDK::AdaptivePayments.new


      order = Order.find(params[:id])


      @pay = @api.build_pay({
        :actionType => "PAY",
        :cancelUrl => carts_url,
        :currencyCode => "US",
        :feesPayer => "SENDER",
        :ipnNotificationUrl => ipn_notification_order_url(order),

        :receiverList => {
          :receiver => [{
            :email =>  seller@seller.com,
            :amount => 1.0,
            :primary => true},
            {:email => buyer@buyer.com,
             :amount => 1.0, 
             :primary => false}]},
             :returnUrl => carts_url })

             @response = @api.pay(@pay)

             # Access response
             if @response.success? && @response.payment_exec_status != "ERROR"
               @response.payKey
               redirect_to @api.payment_url(@response)  # Url to complete payment
             else
               @response.error[0].message
               redirect_to fail_order_path(order)

             end
  end

0 个答案:

没有答案