mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 15:44:45 +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
|
end
|
||||||
|
|
||||||
def ref_number_from_description
|
def ref_number_from_description
|
||||||
match_data = /(\d{7})/.match(description)
|
(Billing::ReferenceNo::MULTI_REGEXP.match(description) || []).captures.each do |match|
|
||||||
match_data[0] if match_data.present?
|
break match if match.length == 7 || Registrar.where(reference_no: match).present?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Billing
|
module Billing
|
||||||
class ReferenceNo
|
class ReferenceNo
|
||||||
REGEXP = /\A\d{2,20}\z/
|
REGEXP = /\A\d{2,20}\z/
|
||||||
|
MULTI_REGEXP = /(\d{2,20})/
|
||||||
|
|
||||||
def self.generate
|
def self.generate
|
||||||
base = Base.generate
|
base = Base.generate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue