<commit_before>module SpreeKomoju
  module ControllerHelpers
    def permitted_source_attributes
      super.push(permitted_komoju_konbini_attributes)
      super.push(permitted_komoju_banktransfer_attributes)
      super.push(permitted_komoju_pay_easy_attributes)
      super.push(permitted_komoju_web_money_attributes)
      super.flatten.uniq
    end

    private

    def permitted_komoju_konbini_attributes
      :convenience
    end

    def permitted_komoju_banktransfer_attributes
      [:email, :phone, :family_name, :given_name, :family_name_kana, :given_name_kana]
    end

    def permitted_komoju_pay_easy_attributes
      [:email, :phone, :family_name, :given_name, :family_name_kana, :given_name_kana]
    end

    def permitted_komoju_web_money_attributes
      [:email, :prepaid_number]
    end
  end
end<commit_msg>Include request headers in payments<commit_after>module SpreeKomoju
  module ControllerHelpers
    extend ActiveSupport::Concern

    included do
      before_action :add_request_env_to_payments, only: :update
    end

    def permitted_source_attributes
      super.push(permitted_komoju_konbini_attributes)
      super.push(permitted_komoju_banktransfer_attributes)
      super.push(permitted_komoju_pay_easy_attributes)
      super.push(permitted_komoju_web_money_attributes)
      super.flatten.uniq
    end

    private

    def permitted_komoju_konbini_attributes
      :convenience
    end

    def permitted_komoju_banktransfer_attributes
      [:email, :phone, :family_name, :given_name, :family_name_kana, :given_name_kana]
    end

    def permitted_komoju_pay_easy_attributes
      [:email, :phone, :family_name, :given_name, :family_name_kana, :given_name_kana]
    end

    def permitted_komoju_web_money_attributes
      [:email, :prepaid_number]
    end

    def add_request_env_to_payments
      @order.payments.each {|payment| payment.request_env = request.headers.env }
    end
  end
end
{'fraction_non_alphanumeric': 0.0593089221248066, 'fraction_numerical': 0.0, 'mean_word_length': 4.22911051212938, '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': '7043862', 'n_tokens_mistral': 668, 'n_tokens_neox': 631, 'n_words': 103}