Class: PaymentMethod::PagSeguroMethod
- Inherits:
-
PaymentMethod
- Object
- PaymentMethod
- PaymentMethod::PagSeguroMethod
- Defined in:
- app/models/spree/payment_method/pag_seguro_method.rb
Instance Attribute Summary collapse
-
#order_id ⇒ Object
Returns the value of attribute order_id.
Instance Method Summary collapse
- #actions ⇒ Object
-
#can_capture?(payment) ⇒ Boolean
Indicates whether its possible to capture the payment.
-
#can_void?(payment) ⇒ Boolean
Indicates whether its possible to void the payment.
- #capture(*args) ⇒ Object
- #code(payment) ⇒ Object
- #payment_source_class ⇒ Object
- #source_required? ⇒ Boolean
- #void(*args) ⇒ Object
Instance Attribute Details
#order_id ⇒ Object
Returns the value of attribute order_id.
4 5 6 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 4 def order_id @order_id end |
Instance Method Details
#actions ⇒ Object
10 11 12 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 10 def actions %w{capture void} end |
#can_capture?(payment) ⇒ Boolean
Indicates whether its possible to capture the payment
15 16 17 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 15 def can_capture?(payment) ['checkout', 'pending'].include?(payment.state) end |
#can_void?(payment) ⇒ Boolean
Indicates whether its possible to void the payment.
20 21 22 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 20 def can_void?(payment) payment.state != 'void' end |
#capture(*args) ⇒ Object
24 25 26 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 24 def capture(*args) ActiveMerchant::Billing::Response.new(true, "", {}, {}) end |
#code(payment) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 40 def code(payment) if payment.pag_seguro_payment.present? payment.pag_seguro_payment.code else pag_seguro_payment = Spree::PagSeguroPayment.new pag_seguro_payment.process!(payment) pag_seguro_payment.code end end |
#payment_source_class ⇒ Object
32 33 34 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 32 def payment_source_class self.class end |
#source_required? ⇒ Boolean
36 37 38 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 36 def source_required? false end |
#void(*args) ⇒ Object
28 29 30 |
# File 'app/models/spree/payment_method/pag_seguro_method.rb', line 28 def void(*args) ActiveMerchant::Billing::Response.new(true, "", {}, {}) end |