assign queue and other bug
This commit is contained in:
@@ -9,28 +9,8 @@ class Customer < ApplicationRecord
|
||||
validates_presence_of :name, :contact_no, :email
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
|
||||
paginates_per 50
|
||||
|
||||
# def self.get_member_group
|
||||
|
||||
# membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
# memberaction = MembershipAction.find_by_membership_type("get_all_member_group")
|
||||
# app_token = membership.auth_token.to_s
|
||||
|
||||
# url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
# response = HTTParty.get(url,
|
||||
# :body => { app_token: app_token}.to_json,
|
||||
# :headers => {
|
||||
# 'Content-Type' => 'application/json',
|
||||
# 'Accept' => 'application/json'
|
||||
# }
|
||||
# )
|
||||
# puts response.body, response.code, response.message, response.headers.inspect
|
||||
|
||||
# return response;
|
||||
|
||||
# end
|
||||
paginates_per 50
|
||||
|
||||
def self.get_member_account(customer)
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
@@ -38,6 +18,7 @@ class Customer < ApplicationRecord
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
# urltest =self.url_exist?(url)
|
||||
|
||||
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
@@ -59,6 +40,35 @@ class Customer < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
# require "net/http"
|
||||
# def self.url_exist?(url_string)
|
||||
# url = URI.parse(url_string)
|
||||
|
||||
|
||||
# req = Net::HTTP.new(url.host, url.port)
|
||||
# puts "hhhhhhhhhhhh"
|
||||
# puts req.to_json
|
||||
# req.use_ssl = (url.scheme == 'https')
|
||||
# puts "aaaaaaaaaaaa"
|
||||
# puts req.use_ssl?
|
||||
# path = url.path if url.path.present?
|
||||
# puts "bbbbbbbbbbbbb"
|
||||
# puts path
|
||||
# res = req.request_head(path || '/')
|
||||
# puts "cccccccccccccc"
|
||||
# puts res.to_json
|
||||
# puts "ddddddddd"
|
||||
# puts res.kind_of?(Net::HTTPRedirection)
|
||||
# if res.kind_of?(Net::HTTPRedirection)
|
||||
# url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL
|
||||
# else
|
||||
# ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families
|
||||
# end
|
||||
# rescue Errno::ENOENT
|
||||
# false #false if can't find the server
|
||||
# end
|
||||
|
||||
|
||||
# def self.search(search)
|
||||
# where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
|
||||
# end
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
class DiningQueue < ApplicationRecord
|
||||
|
||||
belongs_to :dining_facility, :optional => true
|
||||
def self.generate_queue_no
|
||||
queue_no = DiningQueue.all.count + 1
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
dining_queues = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? ", today).order("queue_no desc")
|
||||
queue_no = dining_queues.count + 1
|
||||
return queue_no
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user