mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
* Add auto-update strategies for current balance on manual accounts * Remove deprecated BalanceUpdater, replace with new methods
21 lines
699 B
Ruby
21 lines
699 B
Ruby
module Account::Reconcileable
|
|
extend ActiveSupport::Concern
|
|
|
|
def create_reconciliation(balance:, date:, dry_run: false)
|
|
result = reconciliation_manager.reconcile_balance(balance: balance, date: date, dry_run: dry_run)
|
|
sync_later if result.success?
|
|
result
|
|
end
|
|
|
|
def update_reconciliation(existing_valuation_entry, balance:, date:, dry_run: false)
|
|
result = reconciliation_manager.reconcile_balance(balance: balance, date: date, existing_valuation_entry: existing_valuation_entry, dry_run: dry_run)
|
|
sync_later if result.success?
|
|
result
|
|
end
|
|
|
|
private
|
|
def reconciliation_manager
|
|
@reconciliation_manager ||= Account::ReconciliationManager.new(self)
|
|
end
|
|
end
|