vinsol/spree_bank_transfer

View on GitHub
app/models/spree/payment_method/bank_transfer.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Spree
  class PaymentMethod::BankTransfer < PaymentMethod

    def actions
      %w{capture void}
    end

    # Indicates whether its possible to capture the payment
    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)
      simulated_successful_billing_response
    end

    def void(*args)
      simulated_successful_billing_response
    end

    def source_required?
      false
    end

    def credit(*args)
      simulated_successful_billing_response
    end

    private

      def simulated_successful_billing_response
        ActiveMerchant::Billing::Response.new(true, "", {}, {})
      end
  end

end