Sha256: 4d4447a39897fc58dc10b660a7f0d1b03c149b7913e621840951f3431bad2b5d

Contents?: true

Size: 821 Bytes

Versions: 3

Compression:

Stored size: 821 Bytes

Contents

module TbCommerce::Admin::TransactionsHelper

  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
    content_tag :span, status.titleize, :class => "label label-#{cls}"
  end

  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

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

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tb_commerce-0.0.4 app/helpers/tb_commerce/admin/transactions_helper.rb
tb_commerce-0.0.3 app/helpers/tb_commerce/admin/transactions_helper.rb
tb_commerce-0.0.2 app/helpers/tb_commerce/admin/transactions_helper.rb