Class: Walletone::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/walletone/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payment) ⇒ Form

Returns a new instance of Form.



7
8
9
10
11
12
# File 'lib/walletone/form.rb', line 7

def initialize payment
  unless payment.is_a?( Walletone::Payment ) && payment.valid? && payment.signed?
    Walletone.raise_error ArgumentError.new("Must be valid and signed Payment #{payment}")
  end
  @payment = payment
end

Instance Attribute Details

#paymentObject (readonly)

Returns the value of attribute payment.



5
6
7
# File 'lib/walletone/form.rb', line 5

def payment
  @payment
end

Instance Method Details

#checkout_urlObject



14
15
16
# File 'lib/walletone/form.rb', line 14

def checkout_url
  Walletone.config.web_checkout_url
end

#hidden_fields_tagsObject



18
19
20
21
22
23
# File 'lib/walletone/form.rb', line 18

def hidden_fields_tags
  payment.as_list.map do |field|
    key, value = field
    hidden_field_tag(key, value)
  end.join
end

#optionsObject

Рекомендуемые опции



26
27
28
# File 'lib/walletone/form.rb', line 26

def options
  { authenticity_token: false, enforce_utf8: false }
end