Class: Workarea::Admin::TransactionViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Defined in:
app/view_models/workarea/admin/transaction_view_model.rb

Instance Method Summary collapse

Instance Method Details

#can_be_captured?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/view_models/workarea/admin/transaction_view_model.rb', line 34

def can_be_captured?
  model.action == 'authorize'
end

#order_idObject



4
5
6
# File 'app/view_models/workarea/admin/transaction_view_model.rb', line 4

def order_id
  model.payment_id
end

#payment_titleObject



16
17
18
19
20
21
22
# File 'app/view_models/workarea/admin/transaction_view_model.rb', line 16

def payment_title
  if model.tender.present?
    payment_type.titleize
  else
    t('workarea.admin.payment_transactions.tender.title')
  end
end

#payment_typeObject



8
9
10
11
12
13
14
# File 'app/view_models/workarea/admin/transaction_view_model.rb', line 8

def payment_type
  if model.tender.present?
    model.tender.class.name.demodulize.underscore
  else
    t('workarea.admin.payment_transactions.tender.missing')
  end
end

#statusObject



24
25
26
27
28
29
30
31
32
# File 'app/view_models/workarea/admin/transaction_view_model.rb', line 24

def status
  if canceled?
    t('workarea.admin.payment_transactions.status.canceled')
  elsif success?
    t('workarea.admin.payment_transactions.status.success')
  else
    t('workarea.admin.payment_transactions.status.failure')
  end
end