Sha256: a5e7a97980c1d5c3c12267feffda7a69962665ae4da5bc9af5db4d8125540d59

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

module Spree
  class PaymentMethod::Pagseguro < PaymentMethod
    preference :email, :string
    preference :token, :string

    def payment_profiles_supported?
      false
    end

    def supports?(source)
      true
    end

    def provider_class
      Billing::Pagseguro
    end

    def provider
      provider_class.new
    end

    def source_required?
      false
    end

    def auto_capture?
      false
    end

    def method_type
      'pag_seguro'
    end

    def can_capture?(payment)
      ['checkout', 'pending'].include?(payment.state)
    end

    # Indicates whether its possible to void the payment.
    def can_void?(payment)
      payment.state != 'void'
    end

    def capture(*args)
      ActiveMerchant::Billing::Response.new(true, "", {}, {})
    end

    def cancel(response); end

    def void(*args)
      ActiveMerchant::Billing::Response.new(true, "", {}, {})
    end

    def actions
      %w(capture void)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_pagseguro_simple-1.0.1.alpha app/models/spree/payment_method/pagseguro.rb