Class: Gateway::Pagseguro

Inherits:
Gateway
  • Object
show all
Defined in:
app/models/spree/gateway/pagseguro.rb

Instance Method Summary collapse

Instance Method Details

#authorize(amount, source, gateway_options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'app/models/spree/gateway/pagseguro.rb', line 19

def authorize(amount, source, gateway_options = {})
  transaction = PagSeguro::Transaction.find_by_code(source.transaction_id)

  if transaction
    ActiveMerchant::Billing::Response.new(true, 'PagSeguro Gateway: Realizado com sucesso', {}, :authorization => source.transaction_id)
  else
    ActiveMerchant::Billing::Response.new(false, 'PagSeguro Gateway: Realizado com falha', { :message => 'Pagamento com PagSeguro inconsistente, por favor verificar!' })
  end
end

#auto_capture?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/spree/gateway/pagseguro.rb', line 15

def auto_capture?
  false
end

#method_typeObject



7
8
9
# File 'app/models/spree/gateway/pagseguro.rb', line 7

def method_type
  'pagseguro'
end

#provider_classObject



3
4
5
# File 'app/models/spree/gateway/pagseguro.rb', line 3

def provider_class
  Spree::PagseguroProvider
end

#supports?(source) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/models/spree/gateway/pagseguro.rb', line 11

def supports?(source)
  true
end