Sha256: 73c21b14fc409fe10c189675e49102fc7df6751c522c5d7a962c8e8e4a95c7a7

Contents?: true

Size: 798 Bytes

Versions: 6

Compression:

Stored size: 798 Bytes

Contents

module Spree
  class PaymentMethod::Check < PaymentMethod
    def actions
      %w{capture void credit}
    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(*); end

    def void(*)
      simulated_successful_billing_response
    end

    def credit(*)
      simulated_successful_billing_response
    end

    def source_required?
      false
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_core-2.3.1 app/models/spree/payment_method/check.rb
solidus_core-2.3.0 app/models/spree/payment_method/check.rb
solidus_core-2.3.0.rc3 app/models/spree/payment_method/check.rb
solidus_core-2.3.0.rc2 app/models/spree/payment_method/check.rb
solidus_core-2.3.0.rc1 app/models/spree/payment_method/check.rb
solidus_core-2.3.0.beta1 app/models/spree/payment_method/check.rb