Sha256: 1fe9839d9f546c3eec5352499eec4cde52eb0d6dab913efef84e0cff4bdc4fe8

Contents?: true

Size: 860 Bytes

Versions: 98

Compression:

Stored size: 860 Bytes

Contents

module Spree
  class PaymentMethod::Check < ::Spree::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(*)
      simulated_successful_billing_response
    end

    def cancel(*)
      simulated_successful_billing_response
    end

    def void(*)
      simulated_successful_billing_response
    end

    def source_required?
      false
    end

    def credit(*)
      simulated_successful_billing_response
    end

    private

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

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/models/spree/payment_method/check.rb
spree_core-4.10.0 app/models/spree/payment_method/check.rb
spree_core-4.9.0 app/models/spree/payment_method/check.rb
spree_core-4.8.3 app/models/spree/payment_method/check.rb
spree_core-4.8.2 app/models/spree/payment_method/check.rb
spree_core-4.7.3 app/models/spree/payment_method/check.rb
spree_core-4.6.6 app/models/spree/payment_method/check.rb
spree_core-4.5.5 app/models/spree/payment_method/check.rb
spree_core-4.0.9 app/models/spree/payment_method/check.rb
spree_core-4.1.15 app/models/spree/payment_method/check.rb
spree_core-4.2.7 app/models/spree/payment_method/check.rb
spree_core-4.3.3 app/models/spree/payment_method/check.rb
spree_core-4.4.1 app/models/spree/payment_method/check.rb
spree_core-4.5.4 app/models/spree/payment_method/check.rb
spree_core-4.6.5 app/models/spree/payment_method/check.rb
spree_core-4.7.2 app/models/spree/payment_method/check.rb
spree_core-4.7.1 app/models/spree/payment_method/check.rb
spree_core-4.6.4 app/models/spree/payment_method/check.rb
spree_core-4.7.0 app/models/spree/payment_method/check.rb
spree_core-4.6.3 app/models/spree/payment_method/check.rb