Sha256: 053820129ebca9ad9cfc7a4d7b6e562334431cedf6bd35b0c08f4426675e3d8e

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 Bytes

Contents

module Spree
  class Gateway::Pagseguro < Gateway
    def provider_class
      Spree::PagseguroProvider
    end

    def method_type
      'pagseguro'
    end

    def supports?(source)
      true
    end

    def auto_capture?
      false
    end

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_pagseguro_oficial-1.1.2 app/models/spree/gateway/pagseguro.rb
solidus_pagseguro_oficial-1.1.1 app/models/spree/gateway/pagseguro.rb
solidus_pagseguro_oficial-1.1.0 app/models/spree/gateway/pagseguro.rb