Sha256: df95658812f2edf837cb51d57b76c8474ac474351431a372e19508b308e43970

Contents?: true

Size: 376 Bytes

Versions: 3

Compression:

Stored size: 376 Bytes

Contents

# frozen_string_literal: true
module Workarea
  decorate Payment, with: :cim do
    def successful_captures
      transactions.select { |t| t.success? && (t.capture? || t.purchase?) }
    end

    def eligible_for_refund?
      return true unless credit_card? && successful_captures.present?

      successful_captures.first.created_at < Time.now - 24.hours
    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.decorator
workarea-authorize_cim-2.1.2 app/models/workarea/payment.decorator
workarea-authorize_cim-2.1.1 app/models/workarea/payment.decorator