mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Merge pull request #2096 from internetee/2095-undefined-method-settings
Fix for manual invoice binding
This commit is contained in:
commit
8f9b39fce6
2 changed files with 15 additions and 2 deletions
|
@ -92,7 +92,7 @@ class BankTransaction < ApplicationRecord
|
|||
activity_type: AccountActivity::ADD_CREDIT)
|
||||
|
||||
if activity.save
|
||||
reset_pending_registrar_balance_reload
|
||||
reset_pending_registrar_balance_reload registrar
|
||||
true
|
||||
else
|
||||
false
|
||||
|
@ -105,7 +105,7 @@ class BankTransaction < ApplicationRecord
|
|||
|
||||
private
|
||||
|
||||
def reset_pending_registrar_balance_reload
|
||||
def reset_pending_registrar_balance_reload(registrar)
|
||||
return unless registrar.settings['balance_auto_reload']
|
||||
|
||||
registrar.settings['balance_auto_reload'].delete('pending')
|
||||
|
|
|
@ -180,6 +180,19 @@ class BankTransactionTest < ActiveSupport::TestCase
|
|||
statement.description = "all invalid 12 123 55 77777 --"
|
||||
assert_nil statement.parsed_ref_number
|
||||
end
|
||||
|
||||
def test_manual_bind_with_wrong_ref_number
|
||||
invoice_ref_no = '1111'
|
||||
bank_transaction_ref_no = '9999'
|
||||
create_payable_invoice(number: '2222', total: 10, reference_no: invoice_ref_no)
|
||||
transaction = BankTransaction.new(description: 'invoice #2222',
|
||||
sum: 10,
|
||||
reference_no: bank_transaction_ref_no)
|
||||
|
||||
assert_difference 'AccountActivity.count' do
|
||||
transaction.bind_invoice('2222')
|
||||
end
|
||||
end
|
||||
private
|
||||
|
||||
def create_payable_invoice(attributes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue