Module: Kaui::PaymentHelper

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

Instance Method Summary collapse

Instance Method Details

#colored_transaction_status(transaction_status) ⇒ Object


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

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

#gateway_url(payment_method, payment) ⇒ Object


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

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


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

def transaction_statuses
  Kaui::Payment::TRANSACTION_STATUSES
end