separate foodcourt module

This commit is contained in:
Myat Zin Wai Maw
2019-12-02 16:10:51 +06:30
parent 09e7650452
commit cac6994ccb
113 changed files with 14365 additions and 193 deletions

View File

@@ -0,0 +1,32 @@
class Foodcourt::PayparPaymentsController < BaseFoodcourtController
def create
sale_id = params[:sale_id]
@cashier_type = params[:type]
redeem_amount = params[:redeem_amount]
membership_id = params[:membership_id]
payment_method = "paypar"
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
# shop_details = Shop.first
# rounding adjustment
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
sale_payment = SalePayment.new
status,msg =sale_payment.process_payment(saleObj, current_user, redeem_amount,payment_method)
if status == true
@out = true, "Success!"
else
@out =false, "Please try again payment!"
end
else
@out = false, "There has no sale record!"
end
end
end