Module: Spree::LogEntryDecorator

Defined in:
app/models/spree/log_entry_decorator.rb

Instance Method Summary collapse

Instance Method Details

#parsed_detailsObject



3
4
5
# File 'app/models/spree/log_entry_decorator.rb', line 3

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

#parsed_paypal_entryObject



17
18
19
# File 'app/models/spree/log_entry_decorator.rb', line 17

def parsed_paypal_entry
  JSON.parse(parsed_details.read_body)['status'] rescue parsed_details.to_json
end

#success_parsed_details?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
# File 'app/models/spree/log_entry_decorator.rb', line 7

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