Sha256: f19fd6683efafed1db16d5e11862103fadf0acf400e4362b7dcbec9005ec3670
Contents?: true
Size: 1.35 KB
Versions: 5
Compression:
Stored size: 1.35 KB
Contents
module Spree class PaymentMethod < ActiveRecord::Base default_scope where(:deleted_at => nil) scope :production, lambda { where(:environment => 'production') } attr_accessible :name, :description, :environment, :active validates :name, :presence => true def self.providers Rails.application.config.spree.payment_methods end def provider_class raise 'You must implement provider_class method for this gateway.' end # The class that will process payments for this payment type, used for @payment.source # e.g. CreditCard in the case of a the Gateway payment type # nil means the payment method doesn't require a source e.g. check def payment_source_class raise 'You must implement payment_source_class method for this gateway.' end def self.available all.select do |p| p.active && (p.environment == Rails.env || p.environment.blank?) end end def self.active? where(:type => self.to_s, :environment => Rails.env, :active => true).count > 0 end def method_type type.demodulize.downcase end def destroy touch :deleted_at end def self.find_with_destroyed *args self.with_exclusive_scope { find(*args) } end def payment_profiles_supported? false end def source_required? true end end end
Version data entries
5 entries across 5 versions & 2 rubygems