Module: Ipizza::Rails::FormHelpers

Defined in:
lib/ipizza-rails/form_helpers.rb

Instance Method Summary collapse

Instance Method Details

#ipizza_payment_form_tag(payment, options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ipizza-rails/form_helpers.rb', line 4

def ipizza_payment_form_tag(payment, options = {}, &block)
  request = case options.delete(:service).to_sym
  when :lhv
    Ipizza::Provider::Lhv.new.payment_request(payment)
  when :swedbank
    Ipizza::Provider::Swedbank.new.payment_request(payment)
  when :seb
    Ipizza::Provider::Seb.new.payment_request(payment)
  when :sampo
    Ipizza::Provider::Sampo.new.payment_request(payment)
  when :nordea, :danske
    Ipizza::Provider::Nordea.new.payment_request(payment)
  when :krediidipank
    Ipizza::Provider::Krediidipank.new.payment_request(payment)
  when :luminor
    Ipizza::Provider::Luminor.new.payment_request(payment)
  end

  form_tag(request.service_url, options) do
    request.request_params.each do |name, value|
      concat(hidden_field_tag(name, value))
    end

    yield if block_given?
  end if request
end