Class: PagSeguro::Payment
- Inherits:
-
Object
- Object
- PagSeguro::Payment
- Extended by:
- ConvertFieldToDigit
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/pag_seguro/payment.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#extra_amount ⇒ Object
Returns the value of attribute extra_amount.
-
#id ⇒ Object
(also: #reference)
Returns the value of attribute id.
-
#items ⇒ Object
Returns the value of attribute items.
-
#max_age ⇒ Object
Returns the value of attribute max_age.
-
#max_uses ⇒ Object
Returns the value of attribute max_uses.
-
#notification_url ⇒ Object
Returns the value of attribute notification_url.
-
#pre_approval ⇒ Object
Returns the value of attribute pre_approval.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#response ⇒ Object
Returns the value of attribute response.
-
#sender ⇒ Object
Returns the value of attribute sender.
-
#shipping ⇒ Object
Returns the value of attribute shipping.
-
#token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
- #checkout_payment_url ⇒ Object
- #checkout_url ⇒ Object
- #checkout_xml ⇒ Object
- #code ⇒ Object
- #date ⇒ Object
-
#initialize(email = nil, token = nil, options = {}) ⇒ Payment
constructor
A new instance of Payment.
- #reset! ⇒ Object
Methods included from ConvertFieldToDigit
Constructor Details
#initialize(email = nil, token = nil, options = {}) ⇒ Payment
Returns a new instance of Payment.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pag_seguro/payment.rb', line 20 def initialize(email = nil, token = nil, = {}) @email = email unless email.nil? @token = token unless token.nil? @id = [:id] || [:reference] @sender = [:sender] || Sender.new @shipping = [:shipping] @items = [:items] || [] @extra_amount = [:extra_amount] @redirect_url = [:redirect_url] @notification_url = [:notification_url] @max_uses = [:max_uses] @max_age = [:max_age] @pre_approval = [:pre_approval] end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def email @email end |
#extra_amount ⇒ Object
Returns the value of attribute extra_amount.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def extra_amount @extra_amount end |
#id ⇒ Object Also known as: reference
Returns the value of attribute id.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def id @id end |
#items ⇒ Object
Returns the value of attribute items.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def items @items end |
#max_age ⇒ Object
Returns the value of attribute max_age.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def max_age @max_age end |
#max_uses ⇒ Object
Returns the value of attribute max_uses.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def max_uses @max_uses end |
#notification_url ⇒ Object
Returns the value of attribute notification_url.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def notification_url @notification_url end |
#pre_approval ⇒ Object
Returns the value of attribute pre_approval.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def pre_approval @pre_approval end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def redirect_url @redirect_url end |
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def response @response end |
#sender ⇒ Object
Returns the value of attribute sender.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def sender @sender end |
#shipping ⇒ Object
Returns the value of attribute shipping.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def shipping @shipping end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/pag_seguro/payment.rb', line 6 def token @token end |
Class Method Details
Instance Method Details
#checkout_payment_url ⇒ Object
55 56 57 |
# File 'lib/pag_seguro/payment.rb', line 55 def checkout_payment_url self.class.checkout_payment_url(code) end |
#checkout_url ⇒ Object
59 60 61 |
# File 'lib/pag_seguro/payment.rb', line 59 def checkout_url self.class.checkout_url end |
#checkout_xml ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pag_seguro/payment.rb', line 43 def checkout_xml xml_content = File.open( File.dirname(__FILE__) + "/checkout.xml.haml" ).read haml_engine = Haml::Engine.new(xml_content) haml_engine.render Object.new, items: @items, payment: self, sender: @sender, shipping: @shipping, pre_approval: @pre_approval end |
#code ⇒ Object
63 64 65 66 |
# File 'lib/pag_seguro/payment.rb', line 63 def code response || parse_checkout_response parse_code end |
#date ⇒ Object
68 69 70 71 |
# File 'lib/pag_seguro/payment.rb', line 68 def date response || parse_checkout_response parse_date end |
#reset! ⇒ Object
73 74 75 |
# File 'lib/pag_seguro/payment.rb', line 73 def reset! @response = nil end |