Module: Paygate::Rails::FormHelper

Defined in:
lib/paygate/rails/form_helper.rb

Class Method Summary collapse

Class Method Details

.paygate_open_pay_api_form(options = {}) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/paygate/rails/form_helper.rb', line 137

def paygate_open_pay_api_form(options = {})
  form_tag({}, name: 'PGIOForm') do
    fields = []

    PAYGATE_FORM_TEXT_FIELDS.each do |key, opts|
      arg_opts = options[key] || {}
      fields << text_field_tag(
        key,
        arg_opts[:value] || opts[:default],
        name: opts[:name] || key.to_s,
        placeholder: arg_opts[:placeholder] || opts[:placeholder]
      ).html_safe
    end

    fields.join.html_safe
  end.html_safe
end

.paygate_open_pay_api_js_urlObject



128
129
130
131
132
133
134
# File 'lib/paygate/rails/form_helper.rb', line 128

def paygate_open_pay_api_js_url
  if Paygate.configuration.mode == :live
    'https://api.paygate.net/ajax/common/OpenPayAPI.js'
  else
    'https://stgapi.paygate.net/ajax/common/OpenPayAPI.js'
  end
end

.paygate_open_pay_api_screenObject



156
157
158
# File 'lib/paygate/rails/form_helper.rb', line 156

def paygate_open_pay_api_screen
  (:div, nil, id: 'PGIOscreen')
end