Module: SolidusStripe::LogEntries

Extended by:
ActiveSupport::Concern, LogEntries
Included in:
Gateway, LogEntries
Defined in:
app/models/concerns/solidus_stripe/log_entries.rb

Instance Method Summary collapse

Instance Method Details

#build_payment_log(success:, message:, response_code: nil, data: nil) ⇒ return type

Builds an ActiveMerchant::Billing::Response

Parameters:

  • [true,false] (Hash)

    a customizable set of options

  • [String] (Hash)

    a customizable set of options

  • [#to_json] (Hash)

    a customizable set of options

Returns:

  • (return type)

    return description



15
16
17
18
19
20
21
22
# File 'app/models/concerns/solidus_stripe/log_entries.rb', line 15

def build_payment_log(success:, message:, response_code: nil, data: nil)
  ActiveMerchant::Billing::Response.new(
    success,
    message,
    { 'data' => data.to_json },
    { authorization: response_code },
  )
end

#payment_log(payment, **options) ⇒ Object



24
25
26
27
28
29
30
# File 'app/models/concerns/solidus_stripe/log_entries.rb', line 24

def payment_log(payment, **options)
  payment.log_entries.create!(details: YAML.safe_dump(
    build_payment_log(**options),
    permitted_classes: Spree::LogEntry.permitted_classes,
    aliases: Spree::Config.log_entry_allow_aliases,
  ))
end