mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 07:34:45 +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)
|
activity_type: AccountActivity::ADD_CREDIT)
|
||||||
|
|
||||||
if activity.save
|
if activity.save
|
||||||
reset_pending_registrar_balance_reload
|
reset_pending_registrar_balance_reload registrar
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -105,7 +105,7 @@ class BankTransaction < ApplicationRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def reset_pending_registrar_balance_reload
|
def reset_pending_registrar_balance_reload(registrar)
|
||||||
return unless registrar.settings['balance_auto_reload']
|
return unless registrar.settings['balance_auto_reload']
|
||||||
|
|
||||||
registrar.settings['balance_auto_reload'].delete('pending')
|
registrar.settings['balance_auto_reload'].delete('pending')
|
||||||
|
|
|
@ -180,6 +180,19 @@ class BankTransactionTest < ActiveSupport::TestCase
|
||||||
statement.description = "all invalid 12 123 55 77777 --"
|
statement.description = "all invalid 12 123 55 77777 --"
|
||||||
assert_nil statement.parsed_ref_number
|
assert_nil statement.parsed_ref_number
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def create_payable_invoice(attributes)
|
def create_payable_invoice(attributes)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue