Module: Rubykassa::ActionViewExtension

Defined in:
lib/rubykassa/action_view_extension.rb

Instance Method Summary collapse

Instance Method Details

#pay_url(phrase, invoice_id, total, options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rubykassa/action_view_extension.rb', line 3

def pay_url(phrase, invoice_id, total, options = {}, &block)
  total, invoice_id  = total.to_s, invoice_id.to_s
  extra_params  = options.except :custom, :html
  custom_params = options[:custom] ||= {}
  html_params = options[:html] ||= {}
  url = Rubykassa.pay_url invoice_id, total, custom_params, extra_params
  if block_given?
    link_to phrase, url, html_params, &block
  else
    link_to phrase, url, html_params
  end
end