licensing
This commit is contained in:
@@ -5,6 +5,7 @@ require 'uri'
|
||||
class AESEncDec {
|
||||
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
|
||||
|
||||
<<<<<<< HEAD
|
||||
def self.export_key(passphrase)
|
||||
# We want a 256 bit key symetric key based on passphrase
|
||||
digest = Digest::SHA256.new
|
||||
|
||||
@@ -41,6 +41,22 @@ class Booking < ApplicationRecord
|
||||
return new_dining.type
|
||||
end
|
||||
|
||||
def self.search(filter,from,to)
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
keyword = "booking_id LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%"
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to)
|
||||
query = sale.where(keyword)
|
||||
else
|
||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
|
||||
|
||||
@@ -33,7 +33,6 @@ class DiningFacility < ApplicationRecord
|
||||
|
||||
def get_current_booking
|
||||
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
|
||||
|
||||
if booking.count > 0 then
|
||||
return booking[0]
|
||||
else
|
||||
|
||||
@@ -34,20 +34,13 @@ class License
|
||||
end
|
||||
end
|
||||
|
||||
def detail_with_local_file(lookup, key, iv)
|
||||
def detail_with_local_cache(lookup)
|
||||
##Check from local redis - if available load local otherwise get from remote
|
||||
#cache_key = "store:license:#{key}:hostname"
|
||||
cache_key = "store:license:#{@secret}:hostname"
|
||||
end
|
||||
|
||||
# No Needs for current
|
||||
# @secret = key
|
||||
|
||||
#cache_license = nil
|
||||
|
||||
##Get redis connection from connection pool
|
||||
#
|
||||
|
||||
#Rails.logger.info "Cache key - " + cache_key.to_s
|
||||
|
||||
def detail_with_local_file(lookup, key, iv)
|
||||
has_license = check_license_file
|
||||
|
||||
if has_license
|
||||
@@ -56,7 +49,6 @@ class License
|
||||
|
||||
if cache_license.nil?
|
||||
##change the d/e key
|
||||
# @options = { query: {device: "SXlite", lookup: lookup, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
@params = { query: { lookup_type: self.server_mode, lookup: lookup, encrypted_key: key, iv_key: iv} }
|
||||
|
||||
response = self.class.get("/request_license", @params)
|
||||
|
||||
Reference in New Issue
Block a user