<commit_before>module Spree
  CheckoutController.class_eval do
    before_filter :redirect_to_paypal_express_form_if_needed, :only => [:update]

    def paypal_checkout
      load_order
      opts = all_opts(@order, params[:payment_method_id], 'checkout')
      opts.merge!(address_options(@order))
      @gateway = paypal_gateway

      if Spree::Config[:auto_capture]
        @ppx_response = @gateway.setup_purchase(opts[:money], opts)
      else
        @ppx_response = @gateway.setup_authorization(opts[:money], opts)
      end

      unless @ppx_response.success?
        gateway_error(@ppx_response)
        redirect_to edit_order_url(@order)
        return
      end

      redirect_to (@gateway.redirect_url_for response.token, :review => payment_method.preferred_review)
    rescue ActiveMerchant::ConnectionError => e
      gateway_error I18n.t(:unable_to_connect_to_gateway)
      redirect_to :back
    end

    def paypal_payment
      load_order
      opts = all_opts(@order,params[:payment_method_id], 'payment')
      opts.merge!(address_options(@order))
      @gateway = paypal_gateway

      if Spree::Config[:auto_capture]
        @ppx_response = @gateway.setup_purchase(opts[:money], opts)
      else
        @ppx_response = @gateway.setup_authorization(opts[:money], opts)
      end

      unless @ppx_response.success?
        gateway_error(@ppx_response)
        redirect_to edit_order_checkout_url(@order, :state => "payment")
        return
      end

      redirect_to (@gateway.redirect_url_for @ppx_response.token, :review => payment_method.preferred_review)
    rescue ActiveMerchant::ConnectionError => e
      gateway_error I18n.t(:unable_to_connect_to_gateway)
      redirect_to :back
    end

    def paypal_confirm
      load_order

      opts = { :token => params[:token], :payer_id => params[:PayerID] }.merge all_opts(@order, params[:payment_method_id],  'payment')
      gateway = paypal_gateway

      @ppx_details = gateway.details_for params[:token]

      if @ppx_details.success?
        # now save the updated order info<commit_msg>No space after redirect_to arguments, add bracket for separate args<commit_after>module Spree
  CheckoutController.class_eval do
    before_filter :redirect_to_paypal_express_form_if_needed, :only => [:update]

    def paypal_checkout
      load_order
      opts = all_opts(@order, params[:payment_method_id], 'checkout')
      opts.merge!(address_options(@order))
      @gateway = paypal_gateway

      if Spree::Config[:auto_capture]
        @ppx_response = @gateway.setup_purchase(opts[:money], opts)
      else
        @ppx_response = @gateway.setup_authorization(opts[:money], opts)
      end

      unless @ppx_response.success?
        gateway_error(@ppx_response)
        redirect_to edit_order_url(@order)
        return
      end

      redirect_to(@gateway.redirect_url_for(response.token, :review => payment_method.preferred_review))
    rescue ActiveMerchant::ConnectionError => e
      gateway_error I18n.t(:unable_to_connect_to_gateway)
      redirect_to :back
    end

    def paypal_payment
      load_order
      opts = all_opts(@order,params[:payment_method_id], 'payment')
      opts.merge!(address_options(@order))
      @gateway = paypal_gateway

      if Spree::Config[:auto_capture]
        @ppx_response = @gateway.setup_purchase(opts[:money], opts)
      else
        @ppx_response = @gateway.setup_authorization(opts[:money], opts)
      end

      unless @ppx_response.success?
        gateway_error(@ppx_response)
        redirect_to edit_order_checkout_url(@order, :state => "payment")
        return
      end

      redirect_to(@gateway.redirect_url_for(@ppx_response.token, :review => payment_method.preferred_review))
    rescue ActiveMerchant::ConnectionError => e
      gateway_error I18n.t(:unable_to_connect_to_gateway)
      redirect_to :back
    end

    def paypal_confirm
      load_order

      opts = { :token => params[:token], :payer_id => params[:PayerID] }.merge all_opts(@order, params[:payment_method_id],  'payment')
      gateway = paypal_gateway

      @ppx_details = gateway.details_for params[:token]

      if @ppx_details.success?
        # now save the updated order info
{'fraction_non_alphanumeric': 0.0977640342530923, 'fraction_numerical': 0.0019029495718363464, 'mean_word_length': 3.5118025751072963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6982975', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1301, 'n_words': 232}