mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Link bank transaction with AccountActivity
This commit is contained in:
parent
5d8e78f3c6
commit
1011876872
1 changed files with 7 additions and 7 deletions
|
@ -59,9 +59,7 @@ class BankTransaction < ApplicationRecord
|
|||
if create_activity(registrar, invoice)
|
||||
payment_order.paid!
|
||||
else
|
||||
payment_order.failed!
|
||||
payment_order.notes = 'Failed to create activity'
|
||||
payment_order.save!
|
||||
payment_order.update(notes: 'Failed to create activity', status: 'failed')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -95,10 +93,12 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def create_activity(registrar, invoice)
|
||||
activity = AccountActivity.new(account: registrar.cash_account,
|
||||
activity = AccountActivity.new(
|
||||
account: registrar.cash_account, bank_transaction: self,
|
||||
invoice: invoice, sum: invoice.subtotal,
|
||||
currency: currency, description: description,
|
||||
activity_type: AccountActivity::ADD_CREDIT)
|
||||
activity_type: AccountActivity::ADD_CREDIT
|
||||
)
|
||||
if activity.save
|
||||
reset_pending_registrar_balance_reload
|
||||
true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue