mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 07:34:45 +02:00
Return number if it already ends with zero
The specification does not mention this fact https://www.pangaliit.ee/settlements-and-standards/reference -number-of-the-invoice
This commit is contained in:
parent
640faaadb9
commit
214b7e435d
2 changed files with 2 additions and 1 deletions
|
@ -26,8 +26,8 @@ module Billing
|
||||||
next_number = number
|
next_number = number
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
next_number = next_number.next
|
|
||||||
return next_number if next_number.to_s.end_with?('0')
|
return next_number if next_number.to_s.end_with?('0')
|
||||||
|
next_number = next_number.next
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ class ReferenceNoBaseTest < ActiveSupport::TestCase
|
||||||
def test_generates_check_digit_for_a_given_base
|
def test_generates_check_digit_for_a_given_base
|
||||||
assert_equal 3, Billing::ReferenceNo::Base.new('1').check_digit
|
assert_equal 3, Billing::ReferenceNo::Base.new('1').check_digit
|
||||||
assert_equal 7, Billing::ReferenceNo::Base.new('1234567891234567891').check_digit
|
assert_equal 7, Billing::ReferenceNo::Base.new('1234567891234567891').check_digit
|
||||||
|
assert_equal 0, Billing::ReferenceNo::Base.new('773423').check_digit
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_returns_string_representation
|
def test_returns_string_representation
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue