1
0
Fork 0
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:
Zach Gollwitzer 2024-08-09 20:11:27 -04:00 committed by GitHub
parent f3c44464be
commit 94be117a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 286 additions and 17 deletions

View file

@ -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