<commit_before>module CatarsePagarme
  class ContributionDelegator
    attr_accessor :contribution, :transaction

    def initialize(contribution)
      configure_pagarme
      self.contribution = contribution
    end

    def change_status_by_transaction(transactin_status)
      case transactin_status
      when 'paid', 'authorized' then
        self.contribution.confirm unless self.contribution.confirmed?
      when 'refunded' then
        self.contribution.refund unless self.contribution.refunded?
      when 'refused' then
        self.contribution.cancel unless self.contribution.canceled?
      when 'waiting_payment', 'processing' then
        self.contribution.waiting unless self.contribution.waiting_confirmation?
      end
    end

    def fill_acquirer_data
      if !contribution.acquirer_name.present? || !contribution.acquirer_tid.present?
        contribution.update_attributes({
          acquirer_name: transaction.acquirer_name,
          acquirer_tid: transaction.acquirer_tid
        })
      end<commit_msg>correct is tid and not acquirer_tid<commit_after>module CatarsePagarme
  class ContributionDelegator
    attr_accessor :contribution, :transaction

    def initialize(contribution)
      configure_pagarme
      self.contribution = contribution
    end

    def change_status_by_transaction(transactin_status)
      case transactin_status
      when 'paid', 'authorized' then
        self.contribution.confirm unless self.contribution.confirmed?
      when 'refunded' then
        self.contribution.refund unless self.contribution.refunded?
      when 'refused' then
        self.contribution.cancel unless self.contribution.canceled?
      when 'waiting_payment', 'processing' then
        self.contribution.waiting unless self.contribution.waiting_confirmation?
      end
    end

    def fill_acquirer_data
      if !contribution.acquirer_name.present? || !contribution.acquirer_tid.present?
        contribution.update_attributes({
          acquirer_name: transaction.acquirer_name,
          acquirer_tid: transaction.tid
        })
      end
{'fraction_non_alphanumeric': 0.06343104276790004, 'fraction_numerical': 0.0, 'mean_word_length': 3.3016528925619837, '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': '3949957', 'n_tokens_mistral': 614, 'n_tokens_neox': 578, 'n_words': 116}