update jade integration

This commit is contained in:
Aung Myo
2017-08-23 19:46:00 +06:30
parent 0c89b09249
commit 07b13d8f87
7 changed files with 130 additions and 17 deletions

View File

@@ -194,6 +194,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}%"])