Add model and views for bank accounts
This commit is contained in:
parent
4b1e9a6f53
commit
f0a55fb951
24 changed files with 351 additions and 1 deletions
34
app/models/bank_transaction.rb
Normal file
34
app/models/bank_transaction.rb
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
class BankTransaction < ActiveRecord::Base
|
||||
|
||||
# @!attribute external_id
|
||||
# @return [String] Unique Identifier of the transaction within the bank account.
|
||||
# @!attribute date
|
||||
# @return [Date] Date of the transaction.
|
||||
# @!attribute amount
|
||||
# @return [Number] Amount credited.
|
||||
# @!attribute iban
|
||||
# @return [String] Internation Bank Account Number of the sending/receiving account.
|
||||
# @!attribute reference
|
||||
# @return [String] 140 character long reference field as defined by SEPA.
|
||||
# @!attribute text
|
||||
# @return [String] Short description of the transaction.
|
||||
# @!attribute receipt
|
||||
# @return [String] Optional additional more detailed description of the transaction.
|
||||
# @!attribute image
|
||||
# @return [Binary] Optional PNG image for e.g. scan of paper receipt.
|
||||
|
||||
belongs_to :bank_account
|
||||
belongs_to :financial_link
|
||||
belongs_to :supplier, foreign_key: 'iban', primary_key: 'iban'
|
||||
belongs_to :user, foreign_key: 'iban', primary_key: 'iban'
|
||||
|
||||
validates_presence_of :date, :amount, :bank_account_id
|
||||
validates_numericality_of :amount
|
||||
|
||||
# Replace numeric seperator with database format
|
||||
localize_input_of :amount
|
||||
|
||||
def image_url
|
||||
'data:image/png;base64,' + Base64.encode64(self.image)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue