mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Deposit, Withdrawal, and Interest Transactions for Investment View (#1075)
* Trade and Transaction builders * Consolidate logic * Remove redundant fields from trade form * Add deposit, withdrawal, and interest form controls
This commit is contained in:
parent
f3c44464be
commit
94be117a02
11 changed files with 286 additions and 17 deletions
|
@ -12,13 +12,14 @@ class Account::TradesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@builder = Account::TradeBuilder.new(entry_params)
|
||||
@builder = Account::EntryBuilder.new(entry_params)
|
||||
|
||||
if entry = @builder.save
|
||||
entry.sync_account_later
|
||||
redirect_to account_path(@account), notice: t(".success")
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
flash[:alert] = t(".failure")
|
||||
redirect_back_or_to account_path(@account)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,6 +30,8 @@ class Account::TradesController < ApplicationController
|
|||
end
|
||||
|
||||
def entry_params
|
||||
params.require(:account_entry).permit(:type, :date, :qty, :ticker, :price).merge(account: @account)
|
||||
params.require(:account_entry)
|
||||
.permit(:type, :date, :qty, :ticker, :price, :amount, :currency, :transfer_account_id)
|
||||
.merge(account: @account)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue