Sha256: 0f186001261f43c8748014dbcc77c4665d6821e6be9c72c534919fcfc7e2277e
Contents?: true
Size: 688 Bytes
Versions: 5
Compression:
Stored size: 688 Bytes
Contents
module Moneytree class Transaction < 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
5 entries across 5 versions & 1 rubygems