Sha256: 3a559433e6fd49e5cb4af2295954f81f4a80b88227bca970909e3ec6800524ed

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

module Spree
  class PurchaseOrder < ActiveRecord::Base
    belongs_to :payment_method
    has_many :payments, as: :source

    validates_presence_of :po_number, :organization_name

    def actions
      %w(complete void)
    end

    # Indicates whether its possible to complete the payment
    def can_complete?(payment)
      payment.pending? || payment.checkout?
    end

    # Indicates whether its possible to void the payment.
    def can_void?(payment)
      !payment.failed? && !payment.void?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_purchase_order-2.2.0 app/models/spree/purchase_order.rb