Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -60,7 +60,7 @@ class SalePayment < ApplicationRecord
|
||||
#record an payment in sale-audit
|
||||
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by)
|
||||
|
||||
|
||||
return false, "No outstanding Amount"
|
||||
end
|
||||
|
||||
@@ -217,7 +217,7 @@ class SalePayment < ApplicationRecord
|
||||
self.sale.sale_status = "completed"
|
||||
self.sale.save!
|
||||
table_update_status(sObj)
|
||||
rebat()
|
||||
rebat(sObj)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -233,8 +233,24 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def rebat
|
||||
def rebat(sObj)
|
||||
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
||||
generic_customer_id = sObj.customer.membership_id
|
||||
total_amount = food_prices
|
||||
receipt_no = sObj.receipt_no
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("rebate")
|
||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||
app_token = membership.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||
receipt_no: receipt_no}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
})
|
||||
|
||||
puts response.to_json
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user