Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -54,8 +54,8 @@ class SalePayment < ApplicationRecord
|
||||
#record an payment in sale-audit
|
||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||
|
||||
return true, self.sale
|
||||
|
||||
return true, self.save
|
||||
else
|
||||
#record an payment in sale-audit
|
||||
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||
@@ -84,12 +84,15 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||
membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
||||
|
||||
if !membership_actions_data.nil?
|
||||
|
||||
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||
merchant_uid = membership_actions_data.merchant_account_id
|
||||
auth_token = membership_actions_data.auth_token
|
||||
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
|
||||
begin
|
||||
@@ -199,6 +202,10 @@ class SalePayment < ApplicationRecord
|
||||
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||
puts 'mmmmmmmmmmmmmmmmmmmmmmmmmmm'
|
||||
puts membership_data.to_json
|
||||
puts "amountttttttttttttttttttttt"
|
||||
puts self.received_amount
|
||||
if membership_data["status"]==true
|
||||
self.payment_method = "paypar"
|
||||
self.payment_amount = self.received_amount
|
||||
@@ -259,7 +266,7 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
def rebat(sObj)
|
||||
rebate_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
||||
puts "rebate_prices"
|
||||
puts "eeeeeeeeeeeeeeeeeeeeeeee"
|
||||
puts rebate_prices
|
||||
generic_customer_id = sObj.customer.membership_id
|
||||
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
||||
@@ -294,8 +301,8 @@ class SalePayment < ApplicationRecord
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
# puts response.to_json
|
||||
return response
|
||||
# puts response.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user