Module: TbCommerce::Admin::TransactionsHelper

Defined in:
app/helpers/tb_commerce/admin/transactions_helper.rb

Instance Method Summary collapse

Instance Method Details



16
17
18
19
20
21
22
# File 'app/helpers/tb_commerce/admin/transactions_helper.rb', line 16

def link_to_for_stripe_charge(transaction)
  if transaction.captured?
    return link_to transaction.stripe_charge_id, url_for_stripe_charge(transaction.stripe_charge_id), :target => :blank
  else
    return '--'
  end
end

#stripe_base_urlObject



28
29
30
# File 'app/helpers/tb_commerce/admin/transactions_helper.rb', line 28

def stripe_base_url
  return "https://dashboard.stripe.com"
end

#tb_commerce_status_label_for_transaction(status) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/tb_commerce/admin/transactions_helper.rb', line 3

def tb_commerce_status_label_for_transaction(status)
  if status == 'captured'
    cls = 'success'
  elsif status == 'fail'
    cls = 'important'
  elsif status == 'refunded' || status == 'voided'
    cls = 'warning'
  else
    cls = 'default'
  end
   :span, status.titleize, :class => "label label-#{cls}"
end

#url_for_stripe_charge(stripe_charge_id) ⇒ Object



24
25
26
# File 'app/helpers/tb_commerce/admin/transactions_helper.rb', line 24

def url_for_stripe_charge(stripe_charge_id)
  return "#{stripe_base_url}/payments/#{stripe_charge_id}"
end