Sha256: b87c8c3657f36b70310c435d5ada1b510a558e5f41a5bb5f2eceb032ccfd2960

Contents?: true

Size: 880 Bytes

Versions: 15

Compression:

Stored size: 880 Bytes

Contents

module Kaui
  module PaymentHelper

    def transaction_statuses
      Kaui::Payment::TRANSACTION_STATUSES
    end

    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

    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
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kaui-2.1.0 app/helpers/kaui/payment_helper.rb
kaui-2.0.4 app/helpers/kaui/payment_helper.rb
kaui-2.0.3 app/helpers/kaui/payment_helper.rb
kaui-2.0.2 app/helpers/kaui/payment_helper.rb
kaui-2.0.1 app/helpers/kaui/payment_helper.rb
kaui-2.0.0 app/helpers/kaui/payment_helper.rb
kaui-1.4.1 app/helpers/kaui/payment_helper.rb
kaui-1.4.0 app/helpers/kaui/payment_helper.rb
kaui-1.3.0 app/helpers/kaui/payment_helper.rb
kaui-1.2.0 app/helpers/kaui/payment_helper.rb
kaui-1.1.0 app/helpers/kaui/payment_helper.rb
kaui-1.0.0 app/helpers/kaui/payment_helper.rb
kaui-0.16.2 app/helpers/kaui/payment_helper.rb
kaui-0.16.1 app/helpers/kaui/payment_helper.rb
kaui-0.16.0 app/helpers/kaui/payment_helper.rb