mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
16 lines
380 B
Ruby
16 lines
380 B
Ruby
module Billing
|
|
class ReferenceNo
|
|
REGEXP = /\A\d{2,20}\z/
|
|
MULTI_REGEXP = /(\d{2,20})/
|
|
|
|
def self.generate(owner:)
|
|
result = EisBilling::GetReferenceNumber.call(owner: owner)
|
|
JSON.parse(result.body)['reference_number']
|
|
end
|
|
|
|
def self.valid?(ref)
|
|
base = Base.new(ref.to_s[0...-1])
|
|
ref.to_s == "#{base}#{base.check_digit}"
|
|
end
|
|
end
|
|
end
|