<commit_before>module Spree
  CheckoutController.class_eval do
    append_before_filter :redirect_if_ipay, only: [:update]
    skip_before_filter :verify_authenticity_token, only: [:ipay88_proxy, :ipay88_return, :ipay88_cancel]

    def redirect_if_ipay
      if  nested_params[:payments_attributes] &&
          nested_params[:payments_attributes].first[:payment_method_id] &&
          PaymentMethod.find(nested_params[:payments_attributes].first[:payment_method_id]).type == 'Spree::BillingIntegration::Ipay88'
        redirect_to ipay88_proxy_order_checkout_path(@order, params)
      end
    end

    def ipay88_proxy
      @payment_method = PaymentMethod.find(object_params[:payments_attributes].first[:payment_method_id])
      @ipay_params = @payment_method.form_params(@order, {response_url: ipay88_return_order_checkout_url(@order, payment_method_id: @payment_method.id),backend_url: ipay88_url(payment_method_id: @payment_method.id) })
    end

    def ipay88_return
      #Standard iPay
      merchant_code = params[:MerchantCode]
      payment_id = params[:PaymentId]
      reference_no = params[:RefNo]
      amount = params[:Amount]
      if params[:ErrDesc] && !params[:ErrDesc].empty?
        flash[:error] = params[:ErrDesc]
        redirect_to edit_order_checkout_path(@order)
        return
      end


      unless @order.payments.where(:source_type => 'Spree::Ipay88Transaction').present?
        payment_method = PaymentMethod.find(params[:payment_method_id])
        if payment_method.remote_validation({reference_no: @order.number, amount: amount})

          ipay88_transaction = Ipay88Transaction.create_from_postback(params)

          payment = @order.payments.create({:amount => @order.total,
                                           :source => ipay88_transaction,
                                           :payment_method => payment_method})
          payment.started_processing!
          payment.complete!
        else
<commit_msg>use nested_params method instead of object_params<commit_after>module Spree
  CheckoutController.class_eval do
    append_before_filter :redirect_if_ipay, only: [:update]
    skip_before_filter :verify_authenticity_token, only: [:ipay88_proxy, :ipay88_return, :ipay88_cancel]

    def redirect_if_ipay
      if  nested_params[:payments_attributes] &&
          nested_params[:payments_attributes].first[:payment_method_id] &&
          PaymentMethod.find(nested_params[:payments_attributes].first[:payment_method_id]).type == 'Spree::BillingIntegration::Ipay88'
        redirect_to ipay88_proxy_order_checkout_path(@order, params)
      end
    end

    def ipay88_proxy
      @payment_method = PaymentMethod.find(nested_params[:payments_attributes].first[:payment_method_id])
      @ipay_params = @payment_method.form_params(@order, {response_url: ipay88_return_order_checkout_url(@order, payment_method_id: @payment_method.id),backend_url: ipay88_url(payment_method_id: @payment_method.id) })
    end

    def ipay88_return
      #Standard iPay
      merchant_code = params[:MerchantCode]
      payment_id = params[:PaymentId]
      reference_no = params[:RefNo]
      amount = params[:Amount]
      if params[:ErrDesc] && !params[:ErrDesc].empty?
        flash[:error] = params[:ErrDesc]
        redirect_to edit_order_checkout_path(@order)
        return
      end


      unless @order.payments.where(:source_type => 'Spree::Ipay88Transaction').present?
        payment_method = PaymentMethod.find(params[:payment_method_id])
        if payment_method.remote_validation({reference_no: @order.number, amount: amount})

          ipay88_transaction = Ipay88Transaction.create_from_postback(params)

          payment = @order.payments.create({:amount => @order.total,
                                           :source => ipay88_transaction,
                                           :payment_method => payment_method})
          payment.started_processing!
          payment.complete!
        else

{'fraction_non_alphanumeric': 0.09672544080604534, 'fraction_numerical': 0.01309823677581864, 'mean_word_length': 3.5227790432801824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7655708', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1137, 'n_words': 169}