Merge branch 'addorder' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -203,6 +203,41 @@ class Customer < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.search_paypar_account_no(account_no)
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("search_paypar_account_no")
|
||||
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
|
||||
begin
|
||||
response = HTTParty.get(url,
|
||||
:body => { paypar_account_no:account_no,
|
||||
merchant_uid:merchant_uid,
|
||||
auth_token:auth_token
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Server Error"}
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false , message: "Server Time out"}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
end
|
||||
puts "sssssssssssss"
|
||||
puts response.to_json
|
||||
return response
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
|
||||
Reference in New Issue
Block a user