Class: Bcash::Payment

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, ActiveModel::Validations
Defined in:
lib/bcash/payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package, options = {}) ⇒ Payment

Returns a new instance of Payment.



11
12
13
14
15
# File 'lib/bcash/payment.rb', line 11

def initialize(package, options = {})
	@package = package
	@options = options
	@email = @options[:email_loja]
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



7
8
9
# File 'lib/bcash/payment.rb', line 7

def email
  @email
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/bcash/payment.rb', line 6

def options
  @options
end

#packageObject

Returns the value of attribute package.



6
7
8
# File 'lib/bcash/payment.rb', line 6

def package
  @package
end

Instance Method Details

#htmlObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bcash/payment.rb', line 17

def html
	form_content = File.open(File.join(File.dirname(__FILE__), 'form_bcash.html.haml')).read

	if block_given?
		button_html = yield
	else
		button_html = ('button', 'Pagar com Bcash!', type: "submit")
	end

	Haml::Engine.new(form_content).render(nil, package: self.package, options: self.options, button_html: button_html)			
end