Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -32,6 +32,7 @@ class Ability
|
||||
|
||||
|
||||
can :manage, Order
|
||||
can :manage, Booking
|
||||
can :manage, Sale
|
||||
|
||||
|
||||
@@ -84,7 +85,7 @@ class Ability
|
||||
|
||||
can :read, Order
|
||||
can :update, Order
|
||||
|
||||
can :menage, Booking
|
||||
can :read, Sale
|
||||
can :update, Sale
|
||||
can :get_customer, Customer
|
||||
|
||||
@@ -23,13 +23,17 @@ class Customer < ApplicationRecord
|
||||
# urltest =self.url_exist?(url)
|
||||
|
||||
begin
|
||||
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
response = HTTParty.get(url, :body => {
|
||||
membership_id: customer.membership_id,
|
||||
merchant_uid:merchant_uid,
|
||||
type: "summary",
|
||||
auth_token:auth_token
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10)
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Server Error"}
|
||||
|
||||
@@ -63,7 +67,7 @@ class Customer < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -91,7 +95,7 @@ class Customer < ApplicationRecord
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
|
||||
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
|
||||
|
||||
@customers.each do |customer|
|
||||
member_params = { name: customer.name,phone: customer.contact_no,
|
||||
@@ -102,7 +106,7 @@ class Customer < ApplicationRecord
|
||||
|
||||
# Check for paypar account exists
|
||||
# if paypar_account_no != nil || paypar_account_no != ''
|
||||
if paypar_account_no.present?
|
||||
if customer.paypar_account_no.present?
|
||||
member_params = { name: customer.name,phone: customer.contact_no,
|
||||
email: customer.email,dob: customer.date_of_birth,
|
||||
address: customer.address,nrc:customer.nrc_no,
|
||||
@@ -116,7 +120,7 @@ class Customer < ApplicationRecord
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
})
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false, message: "Server Time out" }
|
||||
@@ -127,7 +131,6 @@ class Customer < ApplicationRecord
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
|
||||
end
|
||||
@@ -161,10 +164,12 @@ class Customer < ApplicationRecord
|
||||
credit = 1
|
||||
end
|
||||
end
|
||||
|
||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||
overall_dis = sObj.total_discount
|
||||
|
||||
total_amount = rebate_prices - payparcost - overall_dis
|
||||
|
||||
if credit == 1
|
||||
total_amount = 0
|
||||
end
|
||||
@@ -183,7 +188,7 @@ class Customer < ApplicationRecord
|
||||
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
@@ -215,7 +220,7 @@ class Customer < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
|
||||
@@ -85,7 +85,7 @@ class SalePayment < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
@@ -120,17 +120,18 @@ class SalePayment < ApplicationRecord
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => { generic_customer_id:membership_id,
|
||||
:body => { membership_id:membership_id,
|
||||
total_amount: redeem_prices,
|
||||
total_sale_transaction_amount: sale_data.grand_total,
|
||||
redeem_amount:received_amount,
|
||||
receipt_no:sale_data.receipt_no,
|
||||
campaign_type_id:campaign_type_id,
|
||||
account_no:"",merchant_uid:merchant_uid,
|
||||
account_no:"",
|
||||
merchant_uid:merchant_uid,
|
||||
auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -399,7 +400,7 @@ class SalePayment < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
@@ -468,7 +469,7 @@ class SalePayment < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
|
||||
Reference in New Issue
Block a user