Sha256: d23d029bd2bec85a6b71e8ead72f8333aca0c706ff112d0f2e17c315bc21fea7
Contents?: true
Size: 699 Bytes
Versions: 1
Compression:
Stored size: 699 Bytes
Contents
module Moneytree class Transaction < Moneytree::ApplicationRecord belongs_to :payment_gateway belongs_to :order, polymorphic: true validates_presence_of :psp_error, if: :failed? enum status: %i[initialized pending completed failed] serialize :details after_create_commit :execute_transaction def process_response(response) if response.success? update!( status: :completed, psp_error: response.message, details: (details || {}).merge(response.body) ) else # FIXME: pending state update!( status: :failed, psp_error: response.message ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moneytree-rails-0.1.9 | app/models/moneytree/transaction.rb |