mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
BankTransaction: Find reference numbers with any length from description
This commit is contained in:
parent
05ca909741
commit
e61601fdd7
2 changed files with 4 additions and 2 deletions
|
@ -121,7 +121,8 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def ref_number_from_description
|
||||
match_data = /(\d{7})/.match(description)
|
||||
match_data[0] if match_data.present?
|
||||
(Billing::ReferenceNo::MULTI_REGEXP.match(description) || []).captures.each do |match|
|
||||
break match if match.length == 7 || Registrar.where(reference_no: match).present?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Billing
|
||||
class ReferenceNo
|
||||
REGEXP = /\A\d{2,20}\z/
|
||||
MULTI_REGEXP = /(\d{2,20})/
|
||||
|
||||
def self.generate
|
||||
base = Base.generate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue