Sha256: 655a735ee5ff19a5d5fc6be8e0a39c3b3d2bafac0715d8b050ec5baee90ee7b9

Contents?: true

Size: 305 Bytes

Versions: 3

Compression:

Stored size: 305 Bytes

Contents

# frozen_string_literal: true
module Workarea
  decorate Payment::Transaction, with: :cim do
    def purchase?
      action == "purchase"
    end

    def refunds
      self.class.successful.refunds.where(reference_id: id)
    end

    def refund_amount
      refunds.to_a.sum(&:amount)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-authorize_cim-2.1.3 app/models/workarea/payment/transaction.decorator
workarea-authorize_cim-2.1.2 app/models/workarea/payment/transaction.decorator
workarea-authorize_cim-2.1.1 app/models/workarea/payment/transaction.decorator