Class: Workarea::Search::Admin::PaymentTransaction

Inherits:
Workarea::Search::Admin show all
Defined in:
app/models/workarea/search/admin/payment_transaction.rb

Instance Method Summary collapse

Methods inherited from Workarea::Search::Admin

#as_document, #created_at, for, #id, jump_to, #jump_to_param, #jump_to_route_helper, #releasable?, #sanitized_keywords, #should_be_indexed?, #type, #updated_at

Methods included from Elasticsearch::Document

all, #as_bulk_document, #as_document, current_index_prefix, #destroy, #initialize, #save

Instance Method Details

#auth_statusObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 19

def auth_status
  return nil unless model.authorize?

  if model.captured_amount.zero?
    'pending_capture'
  elsif model.captured_amount > 0 &&
          model.captured_amount < model.amount
    'partially_captured'
  elsif model.captured_amount == model.amount
    'captured'
  end
end

#facetsObject



32
33
34
35
36
37
38
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 32

def facets
  super.merge(
    auth_status: auth_status,
    tender_type: tender_type,
    transaction: model.action
  )
end

#jump_to_positionObject



56
57
58
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 56

def jump_to_position
  nil
end

#jump_to_search_textObject



52
53
54
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 52

def jump_to_search_text
  nil
end

#jump_to_textObject



48
49
50
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 48

def jump_to_text
  nil
end

#keywordsObject



15
16
17
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 15

def keywords
  super + [model.payment_id]
end

#nameObject



40
41
42
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 40

def name
  nil
end

#search_textObject



44
45
46
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 44

def search_text
  nil
end

#statusObject



5
6
7
8
9
10
11
12
13
# File 'app/models/workarea/search/admin/payment_transaction.rb', line 5

def status
  if model.canceled?
    'canceled'
  elsif model.success?
    'success'
  else
    'failure'
  end
end