fix foodcourt sales transaction
This commit is contained in:
@@ -1,19 +1,37 @@
|
||||
class Foodcourt::PaymalController < BaseFoodcourtController
|
||||
|
||||
def create
|
||||
cash = params[:payment_amount]
|
||||
sale_id = params[:sale_id]
|
||||
transaction_ref = params[:transaction_ref]
|
||||
account_no = params[:account_no]
|
||||
if(Sale.exists?(sale_id))
|
||||
cash = params[:payment_amount]
|
||||
sale_id = params[:sale_id]
|
||||
transaction_ref = params[:transaction_ref]
|
||||
account_no = params[:account_no]
|
||||
if(Sale.exists?(sale_id))
|
||||
Sale.transaction do
|
||||
saleObj = Sale.find(sale_id)
|
||||
booking = saleObj.booking
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale, @membership_data = sale_payment.process_payment(saleObj, current_user, cash, "paymal",account_no)
|
||||
status, @sale, @membership_data = sale_payment.process_payment(saleObj, current_user, cash, "paymal", account_no)
|
||||
|
||||
if status == true && @membership_data["status"] == true
|
||||
PrintOrderQueueJob.perform_later(current_shop.shop_code, booking.booking_id)
|
||||
PrintReceiptJob.perform_later(current_shop.shop_code, sale_id)
|
||||
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out = false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def getCloudDomain
|
||||
from = ""
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain.to_s + "." + request.domain.to_s
|
||||
end
|
||||
|
||||
return from
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user