Sha256: 07ed2779c04c9bb3974ee916c051625bee97b9597ab836cca150d664719aca54

Contents?: true

Size: 793 Bytes

Versions: 21

Compression:

Stored size: 793 Bytes

Contents

module Spree
  class LogEntry < Spree::Base
    if defined?(Spree::Security::LogEntries)
      include Spree::Security::LogEntries
    end

    belongs_to :source, polymorphic: true

    # Fix for #1767
    # If a payment fails, we want to make sure we keep the record of it failing
    after_rollback :save_anyway, if: proc { !Rails.env.test? }

    def save_anyway
      Spree::LogEntry.create!(source: source, details: details)
    end

    def parsed_details
      @details ||= if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
                     YAML.safe_load(details, permitted_classes: [ActiveMerchant::Billing::Response])
                   else
                     YAML.safe_load(details, [ActiveMerchant::Billing::Response])
                   end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/models/spree/log_entry.rb
spree_core-4.10.0 app/models/spree/log_entry.rb
spree_core-4.9.0 app/models/spree/log_entry.rb
spree_core-4.8.3 app/models/spree/log_entry.rb
spree_core-4.8.2 app/models/spree/log_entry.rb
spree_core-4.7.3 app/models/spree/log_entry.rb
spree_core-4.6.6 app/models/spree/log_entry.rb
spree_core-4.5.5 app/models/spree/log_entry.rb
spree_core-4.5.4 app/models/spree/log_entry.rb
spree_core-4.6.5 app/models/spree/log_entry.rb
spree_core-4.7.2 app/models/spree/log_entry.rb
spree_core-4.7.1 app/models/spree/log_entry.rb
spree_core-4.6.4 app/models/spree/log_entry.rb
spree_core-4.7.0 app/models/spree/log_entry.rb
spree_core-4.6.3 app/models/spree/log_entry.rb
spree_core-4.6.2 app/models/spree/log_entry.rb
spree_core-4.6.1 app/models/spree/log_entry.rb
spree_core-4.6.0 app/models/spree/log_entry.rb
spree_core-4.5.3 app/models/spree/log_entry.rb
spree_core-4.5.2 app/models/spree/log_entry.rb