<commit_before>require "active_support/concern"
module ShiftCommerce
  module UiPaymentGateway
    module ControllerExtensions

      def order_model
        ::ShiftCommerce::UiPaymentGateway::Config.instance.order_model.constantize
      end

      def new_with_gateway
        redirect_to payment_service.setup_payment(cart: cart)
      end

      def new
        self.page_title = I18n.t("transactions.new.page_title")
      end

      def new_with_token
        gateway_response = payment_service.process_token(token: params[:token], cart: cart, payer_id: params[:PayerID])
        txn = {
          gateway_response: gateway_response,
          amount: cart.total,
          currency: ::ShiftCommerce::UiPaymentGateway::DEFAULT_CURRENCY,
          transaction_type: "settlement",
          payment_gateway_reference: "paypal_express",
          status: "success",
        }
        order = order_model.create(cart_id: cart.id, transaction_attributes: txn )
        on_order_created(order)
      end

      def on_order_created(order)
        redirect_to action: :show, id: order.id, controller: ::ShiftCommerce::UiPaymentGateway::Config.instance.order_model.underscore.pluralize

      end
<commit_msg>Now sending order_ip_address on order create<commit_after>require "active_support/concern"
module ShiftCommerce
  module UiPaymentGateway
    module ControllerExtensions

      def order_model
        ::ShiftCommerce::UiPaymentGateway::Config.instance.order_model.constantize
      end

      def new_with_gateway
        redirect_to payment_service.setup_payment(cart: cart)
      end

      def new
        self.page_title = I18n.t("transactions.new.page_title")
      end

      def new_with_token
        gateway_response = payment_service.process_token(token: params[:token], cart: cart, payer_id: params[:PayerID])
        txn = {
          gateway_response: gateway_response,
          amount: cart.total,
          currency: ::ShiftCommerce::UiPaymentGateway::DEFAULT_CURRENCY,
          transaction_type: "settlement",
          payment_gateway_reference: "paypal_express",
          status: "success",
        }
        order = order_model.create(cart_id: cart.id, transaction_attributes: txn, order_ip_address: request.ip )
        on_order_created(order)
      end

      def on_order_created(order)
        redirect_to action: :show, id: order.id, controller: ::ShiftCommerce::UiPaymentGateway::Config.instance.order_model.underscore.pluralize

      end

{'fraction_non_alphanumeric': 0.08202020202020202, 'fraction_numerical': 0.0016161616161616162, 'mean_word_length': 3.1895093062605753, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3314373', 'n_tokens_mistral': 724, 'n_tokens_neox': 709, 'n_words': 131}