Sha256: 04d910c6ce265bcca5673f171f0a1009781c42845bd5271bae69d8ca30d90ee2

Contents?: true

Size: 851 Bytes

Versions: 50

Compression:

Stored size: 851 Bytes

Contents

module Spree
  class PaymentMethod::Check < 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

50 entries across 50 versions & 1 rubygems

Version Path
spree_core-3.2.9 app/models/spree/payment_method/check.rb
spree_core-3.1.14 app/models/spree/payment_method/check.rb
spree_core-3.3.6 app/models/spree/payment_method/check.rb
spree_core-3.2.8 app/models/spree/payment_method/check.rb
spree_core-3.1.13 app/models/spree/payment_method/check.rb
spree_core-3.3.5 app/models/spree/payment_method/check.rb
spree_core-3.3.4 app/models/spree/payment_method/check.rb
spree_core-3.2.7 app/models/spree/payment_method/check.rb
spree_core-3.1.12 app/models/spree/payment_method/check.rb
spree_core-3.3.3 app/models/spree/payment_method/check.rb
spree_core-3.2.6 app/models/spree/payment_method/check.rb
spree_core-3.1.11 app/models/spree/payment_method/check.rb
spree_core-3.1.10 app/models/spree/payment_method/check.rb
spree_core-3.3.2 app/models/spree/payment_method/check.rb
spree_core-3.2.5 app/models/spree/payment_method/check.rb
spree_core-3.1.9 app/models/spree/payment_method/check.rb
spree_core-3.3.1 app/models/spree/payment_method/check.rb
spree_core-3.2.4 app/models/spree/payment_method/check.rb
spree_core-3.1.8 app/models/spree/payment_method/check.rb
spree_core-3.3.0 app/models/spree/payment_method/check.rb