Class: SpreePagseguroSimple::Gateway

Inherits:
Object
  • Object
show all
Defined in:
lib/spree_pagseguro_simple/gateway.rb

Instance Method Summary collapse

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

Returns:

  • (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_urlObject



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