This commit is contained in:
Nweni
2017-06-20 18:59:34 +06:30
parent bdb42daad7
commit a9e1d8c3d1
20 changed files with 970 additions and 149 deletions

View File

@@ -67,7 +67,7 @@ class SalePayment < ApplicationRecord
end
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
# Control for Paypar Cloud
# Control for Paypar Cloud
begin
response = HTTParty.get(url,
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
@@ -91,14 +91,14 @@ class SalePayment < ApplicationRecord
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
sale_data = Sale.find_by_sale_id(sale_id)
if sale_data
# Control for Paypar Cloud
# Control for Paypar Cloud
begin
response = HTTParty.post(url,
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
},
},
:timeout => 10
)
rescue Net::OpenTimeout
@@ -238,10 +238,17 @@ class SalePayment < ApplicationRecord
end
def table_update_status(sale_obj)
booking = Booking.find_by_sale_id(sale_obj.id)
status = true
booking = Booking.find_by_sale_id(sale_obj.id)
if booking
table = DiningFacility.find(booking.dining_facility_id)
if table
bookings = table.bookings
bookings.each do |tablebooking|
if tablebooking.sale.sale_status != 'completed'
status = false
end
end
if status
table.status = "available"
table.save
end
@@ -274,7 +281,7 @@ class SalePayment < ApplicationRecord
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
# Control for Paypar Cloud
# Control for Paypar Cloud
begin
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
receipt_no: receipt_no,auth_token:auth_token}.to_json,