mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Verify ref_number_from_description return correct match
This commit is contained in:
parent
166ff44491
commit
dd48bb61d9
1 changed files with 5 additions and 1 deletions
|
@ -118,7 +118,11 @@ class BankTransaction < ApplicationRecord
|
||||||
|
|
||||||
def ref_number_from_description
|
def ref_number_from_description
|
||||||
(Billing::ReferenceNo::MULTI_REGEXP.match(description) || []).captures.each do |match|
|
(Billing::ReferenceNo::MULTI_REGEXP.match(description) || []).captures.each do |match|
|
||||||
break match if match.length == 7 || Billing::ReferenceNo.valid?(match)
|
break match if match.length == 7 || valid_ref_no?(match)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid_ref_no?(match)
|
||||||
|
return true if Billing::ReferenceNo.valid?(match) && Registrar.find_by(reference_no: match).any?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue