Add model for BankGateway

This commit is contained in:
Patrick Gansterer 2021-03-05 12:43:40 +01:00
parent 7e60ce6ce2
commit 87fe9ccdb1
6 changed files with 45 additions and 0 deletions

View file

@ -1,5 +1,6 @@
class BankAccount < ApplicationRecord
has_many :bank_transactions, dependent: :destroy
belongs_to :bank_gateway, optional: true
normalize_attributes :name, :iban, :description

View file

@ -0,0 +1,8 @@
class BankGateway < ApplicationRecord
has_many :bank_accounts, dependent: :nullify
belongs_to :unattended_user, class_name: 'User', optional: true
scope :with_unattended_support, -> { where.not(unattended_user: nil) }
validates_presence_of :name, :url
end

View file

@ -35,9 +35,15 @@ de:
unit_quantity: Gebindegröße
bank_account:
balance: Kontostand
bank_gateway: Bankgateway
description: Beschreibung
iban: IBAN
name: Name
bank_gateway:
authorization: Authorization-Header
name: Name
unattended_user: Bedienerlos-Benutzer_in
url: URL
bank_transaction:
amount: Betrag
date: Datum
@ -244,6 +250,8 @@ de:
models:
article: Artikel
article_category: Kategorie
bank_account: Bankkonto
bank_gateway: Bankgateway
bank_transaction: Banktransaktion
delivery: Lieferung
financial_transaction: Kontotransaktion

View file

@ -35,9 +35,15 @@ en:
unit_quantity: Unit quantity
bank_account:
balance: Balance
bank_gateway: Bank gateway
description: Description
iban: IBAN
name: Name
bank_gateway:
authorization: Authorization-Header
name: Name
unattended_user: Unattended user
url: URL
bank_transaction:
amount: Amount
date: Date
@ -244,6 +250,8 @@ en:
models:
article: Article
article_category: Category
bank_account: Bank account
bank_gateway: Bank gateway
bank_transaction: Bank transaction
delivery: Delivery
financial_transaction: Financial transaction

View file

@ -0,0 +1,12 @@
class CreateBankGateways < ActiveRecord::Migration[4.2]
def change
create_table :bank_gateways do |t|
t.string :name, null: false
t.string :url, null: false
t.string :authorization
t.integer :unattended_user_id
end
add_reference :bank_accounts, :bank_gateway
end
end

View file

@ -89,6 +89,14 @@ ActiveRecord::Schema.define(version: 2021_02_05_090257) do
t.decimal "balance", precision: 12, scale: 2, default: "0.0", null: false
t.datetime "last_import"
t.string "import_continuation_point"
t.integer "bank_gateway_id"
end
create_table "bank_gateways", id: :integer, force: :cascade do |t|
t.string "name", null: false
t.string "url", null: false
t.string "authorization"
t.integer "unattended_user_id"
end
create_table "bank_transactions", id: :integer, force: :cascade do |t|