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)
|
if create_activity(registrar, invoice)
|
||||||
payment_order.paid!
|
payment_order.paid!
|
||||||
else
|
else
|
||||||
payment_order.failed!
|
payment_order.update(notes: 'Failed to create activity', status: 'failed')
|
||||||
payment_order.notes = 'Failed to create activity'
|
|
||||||
payment_order.save!
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -95,10 +93,12 @@ class BankTransaction < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_activity(registrar, invoice)
|
def create_activity(registrar, invoice)
|
||||||
activity = AccountActivity.new(account: registrar.cash_account,
|
activity = AccountActivity.new(
|
||||||
invoice: invoice, sum: invoice.subtotal,
|
account: registrar.cash_account, bank_transaction: self,
|
||||||
currency: currency, description: description,
|
invoice: invoice, sum: invoice.subtotal,
|
||||||
activity_type: AccountActivity::ADD_CREDIT)
|
currency: currency, description: description,
|
||||||
|
activity_type: AccountActivity::ADD_CREDIT
|
||||||
|
)
|
||||||
if activity.save
|
if activity.save
|
||||||
reset_pending_registrar_balance_reload
|
reset_pending_registrar_balance_reload
|
||||||
true
|
true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue