Module: Kaui::PaymentHelper

Defined in:
app/helpers/kaui/payment_helper.rb

Instance Method Summary collapse

Instance Method Details

#colored_transaction_status(transaction_status) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/kaui/payment_helper.rb', line 9

def colored_transaction_status(transaction_status)
  data = "<span class='alert-"
  data += if transaction_status == 'SUCCESS'
            "success'>"
          else
            "danger'>"
          end
  data += transaction_status
  data += '</span>'
  data.html_safe
end

#gateway_url(payment_method, payment) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/kaui/payment_helper.rb', line 21

def gateway_url(payment_method, payment)
  return nil if payment_method.nil? || payment.nil? || payment.transactions.empty?

  template = Kaui.gateways_urls[payment_method.plugin_name]
  return nil if template.nil?

  first_payment_reference_id = payment.transactions.first.first_payment_reference_id
  return nil if first_payment_reference_id.nil?

  template.gsub('FIRST_PAYMENT_REFERENCE_ID', first_payment_reference_id)
end

#transaction_statusesObject



5
6
7
# File 'app/helpers/kaui/payment_helper.rb', line 5

def transaction_statuses
  Kaui::Payment::TRANSACTION_STATUSES
end