Sha256: 539deae8fe49e9dbe3871c1a8f9869642d40db3825e0c2e9aff3ade39143eb93

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

module Spree
  module LogEntryDecorator
    def parsed_details
      @details ||= YAML.safe_load(details, [ActiveMerchant::Billing::Response, Net::HTTPCreated, URI::HTTPS, URI::RFC3986_Parser, Symbol, Regexp, Object, ActiveMerchant::Billing::MultiResponse]) rescue nil
    end

    def success_parsed_details?
      if parsed_details.is_a?(Net::HTTPCreated)
        parsed_paypal_entry == 'COMPLETED'
      elsif parsed_details.is_a?(ActiveMerchant::Billing::Response)
        parsed_details.success?
      else
        true
      end
    end

    def parsed_paypal_entry
      JSON.parse(parsed_details.read_body)['status'] rescue parsed_details.to_json
    end
  end
end
::Spree::LogEntry.prepend(Spree::LogEntryDecorator)

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
spree_paypal_checkout-0.0.2 app/models/spree/log_entry_decorator.rb
spree_paypal_api_checkout-0.1.5 app/models/spree/log_entry_decorator.rb
spree_paypal_api_checkout-0.1.4 app/models/spree/log_entry_decorator.rb