<commit_before>module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Bancomer
        class Helper < ActiveMerchant::Billing::Integrations::Helper

          def initialize(order, account, options = {})
            super
            add_field('Ds_Merchant_Currency', 484)
            add_field('Ds_Merchant_TransactionType', 0)
            add_field('Ds_Merchant_Order', format_order_number(order))
            add_field('Ds_Merchant_MerchantCode', account)
            add_field('Ds_Merchant_Terminal', 1)
          end

          # Limited to 12 digits max
          def format_order_number(number)
            number.to_s.gsub(/[A-Z]/, '').rjust(12, "0")
          end

          def sha1secret(value)
            @sha1secret = value
          end

          def form_fields
            @fields.merge('Ds_Merchant_MerchantSignature' => generate_sha1check)
          end

          def generate_sha1string
            SHA1_CHECK_FIELDS.map {|key| @fields[key.to_s]} * "" + @sha1secret
          end

          def generate_sha1check
            Digest::SHA1.hexdigest(generate_sha1string)
          end

          SHA1_CHECK_FIELDS = [ 'Ds_Merchant_Amount', 'Ds_Merchant_Order',
                                'Ds_Merchant_MerchantCode', 'Ds_Merchant_Currency',
                                'Ds_Merchant_TransactionType' ]

          mapping :amount, 'Ds_Merchant_Amount'
          mapping :notify_url, 'Ds_Merchant_MerchantURL'
          mapping :return_url, 'Ds_Merchant_UrlOk'
          mapping :cancel_return_url, 'Ds_Merchant_UrlKo'
          mapping :description, 'Ds_Merchant_ProductDescription'
        end
      end
    end
  end
end
<commit_msg>Removing decimal separator from amount<commit_after>module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Bancomer
        class Helper < ActiveMerchant::Billing::Integrations::Helper

          def initialize(order, account, options = {})
            super
            add_field('Ds_Merchant_Currency', 484)
            add_field('Ds_Merchant_TransactionType', 0)
            add_field('Ds_Merchant_Order', format_order_number(order))
            add_field('Ds_Merchant_MerchantCode', account.to_s.gsub(/\./, ''))
            add_field('Ds_Merchant_Terminal', 1)
          end

          # Limited to 12 digits max
          def format_order_number(number)
            number.to_s.gsub(/[A-Z]/, '').rjust(12, "0")
          end

          def sha1secret(value)
            @sha1secret = value
          end

          def form_fields
            @fields.merge('Ds_Merchant_MerchantSignature' => generate_sha1check)
          end

          def generate_sha1string
            SHA1_CHECK_FIELDS.map {|key| @fields[key.to_s]} * "" + @sha1secret
          end

          def generate_sha1check
            Digest::SHA1.hexdigest(generate_sha1string)
          end

          SHA1_CHECK_FIELDS = [ 'Ds_Merchant_Amount', 'Ds_Merchant_Order',
                                'Ds_Merchant_MerchantCode', 'Ds_Merchant_Currency',
                                'Ds_Merchant_TransactionType' ]

          mapping :amount, 'Ds_Merchant_Amount'
          mapping :notify_url, 'Ds_Merchant_MerchantURL'
          mapping :return_url, 'Ds_Merchant_UrlOk'
          mapping :cancel_return_url, 'Ds_Merchant_UrlKo'
          mapping :description, 'Ds_Merchant_ProductDescription'
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08513708513708514, 'fraction_numerical': 0.011544011544011544, 'mean_word_length': 2.150909090909091, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7305339', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1013, 'n_words': 180}