mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +02:00
Invoice cancelling
This commit is contained in:
parent
56d7f9f2e2
commit
a26ce110b2
17 changed files with 113 additions and 25 deletions
|
@ -42,7 +42,7 @@ describe BankTransaction do
|
|||
invoice = r.issue_prepayment_invoice(200, 'add some money')
|
||||
|
||||
bt = Fabricate(:bank_transaction, { sum: 240 })
|
||||
bt.bind_invoice(invoice.id)
|
||||
bt.bind_invoice(invoice.number)
|
||||
|
||||
invoice.receipt_date.should_not be_blank
|
||||
r.cash_account.balance.should == 240.0
|
||||
|
@ -53,11 +53,22 @@ describe BankTransaction do
|
|||
invoice = r.issue_prepayment_invoice(200, 'add some money')
|
||||
|
||||
bt = Fabricate(:bank_transaction, { sum: 10 })
|
||||
bt.bind_invoice(invoice.id)
|
||||
bt.bind_invoice(invoice.number)
|
||||
|
||||
bt.errors.full_messages.should match_array(["Invoice and transaction sums do not match"])
|
||||
end
|
||||
|
||||
it 'should not bind transaction with cancelled invoice' do
|
||||
r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663')
|
||||
invoice = r.issue_prepayment_invoice(200, 'add some money')
|
||||
invoice.cancel
|
||||
|
||||
bt = Fabricate(:bank_transaction, { sum: 240 })
|
||||
bt.bind_invoice(invoice.number)
|
||||
|
||||
bt.errors.full_messages.should match_array(["Cannot bind cancelled invoice"])
|
||||
end
|
||||
|
||||
it 'should have one version' do
|
||||
with_versioning do
|
||||
@bank_transaction.versions.should == []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue