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
# File 'app/helpers/kaui/payment_helper.rb', line 9

def colored_transaction_status(transaction_status)
  alert_class = transaction_status == 'SUCCESS' ? 'alert-success' : 'alert-danger'
  tag.span(transaction_status, class: alert_class)
end

#gateway_url(payment_method, payment) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/kaui/payment_helper.rb', line 14

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