Class: SpreePagseguroSimple::Gateway
- Inherits:
-
Object
- Object
- SpreePagseguroSimple::Gateway
- Defined in:
- lib/spree_pagseguro_simple/gateway.rb
Instance Method Summary collapse
-
#initialize(payment) ⇒ Gateway
constructor
A new instance of Gateway.
- #is_not_completed? ⇒ Boolean
- #payment_url ⇒ Object
Constructor Details
#initialize(payment) ⇒ Gateway
Returns a new instance of Gateway.
6 7 8 9 10 11 12 13 |
# File 'lib/spree_pagseguro_simple/gateway.rb', line 6 def initialize(payment) @payment = payment @order = @payment.order @payment_method_email = @payment.payment_method.preferred_email @payment_method_token = @payment.payment_method.preferred_token process end |
Instance Method Details
#is_not_completed? ⇒ Boolean
15 16 17 |
# File 'lib/spree_pagseguro_simple/gateway.rb', line 15 def is_not_completed? !@payment.completed? && transaction_exists_and_is_loaded && @pag_seguro_transaction.state == 'pending' end |
#payment_url ⇒ Object
19 20 21 22 |
# File 'lib/spree_pagseguro_simple/gateway.rb', line 19 def payment_url subdomain = @env == :sandbox ? 'sandbox.pagseguro' : 'pagseguro' "https://#{subdomain}.uol.com.br/v2/checkout/payment.html?code=#{@pag_seguro_transaction.code}" end |