You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: data_presenter.rb
    path of file: ./repos/openfoodnetwork/app/models/invoice
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class Invoice
  class DataPresenter
    include ::ActionView::Helpers::NumberHelper
    attr_reader :invoice

    delegate :display_number, :data, :previous_invoice, to: :invoice
    delegate :date, to: :invoice, prefix: true

    FINALIZED_NON_SUCCESSFUL_STATES 
    
    def display_checkout_taxes_hash
      tax_adjustment_totals.map do |tax_rate_id, tax_amount|
        tax_rate = tax_rate_by_id[tax_rate_id]
        {
          amount: Spree::Money.new(tax_amount, currency:),
          percentage: number_to_percentage(tax_rate.amount * 100, precision: 1),
          rate_amount: tax_rate.amount,
        }
      end.sort_by { |tax| tax[:rate_amount] }
    end

    def display_date
      I18n.l(invoice_date.to_date, format: :long)
    end

    def display_tax_adjustment_total
      Spree::Money.new(all_tax_adjustments.map(&:amount).sum, currency:)
    end

    def tax_adjustment_totals
      all_tax_adjustments.each_with_object(Hash.new(0)) do |adjustment, totals|
        totals[adjustment.originator.id] += adjustment.amount
      end
    end

    def tax_rate_by_id
      all_tax_adjustments.each_with_object({}) do |adjustment, tax_rates|
        tax_rates[adjustment.originator.id] = adjustment.originator
      end
    end

    def all_tax_adjustments
      all_eligible_adjustments.select { |a| a.originator.type == 'Spree::TaxRate' }
    end

    def paid?
      data[:payment_state] == 'paid' || data[:payment_state] == 'credit_owed'
    end

    def outstanding_balance?
      !new_outstanding_balance.zero?
    end

    def new_outstanding_balance
      if state.in?(FINALIZED_NON_SUCCESSFUL_STATES)
        -payment_total
      else
        total - payment_total
      end
    end