API v1 financial_transactions endpoints (#627)

This commit is contained in:
wvengen 2020-07-25 14:18:59 +00:00 committed by GitHub
parent 8c8b42c2b2
commit b96ce06d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 397 additions and 1 deletions

View file

@ -22,6 +22,17 @@ class FinancialTransaction < ApplicationRecord
initialize_financial_transaction_type
end
# @todo remove alias (and rename created_on to created_at below) after #575
ransack_alias :created_at, :created_on
def self.ransackable_attributes(auth_object = nil)
%w(id amount note created_on user_id)
end
def self.ransackable_associations(auth_object = nil)
%w() # none, and certainly not user until we've secured that more
end
# Use this save method instead of simple save and after callback
def add_transaction!
ordergroup.add_financial_transaction! amount, note, user, financial_transaction_type
@ -43,6 +54,11 @@ class FinancialTransaction < ApplicationRecord
reverts.present? || reverted_by.present?
end
# @todo rename in model, see #575
def created_at
created_on
end
protected
def initialize_financial_transaction_type