This commit is contained in:
Dev Team
2025-06-02 17:18:11 +06:30
parent 1a373f0d2a
commit 174a232421
10 changed files with 72 additions and 176 deletions

View File

@@ -13,11 +13,11 @@ module MultiTenancy
end
def find_tenant_by_subdomain_or_name
if request.subdomains.first && request.subdomains.first != "www"
set_current_tenant(Shop.find_by(subdomain: request.subdomains.first))
elsif Shop.count == 1
set_current_tenant(Shop.first)
end
# if request.subdomains.first && request.subdomains.first != "www"
# set_current_tenant(Shop.find_by(subdomain: request.subdomains.first))
# elsif Shop.count == 1
set_current_tenant(Shop.last)
# end
end
def not_found

View File

@@ -87,6 +87,7 @@ class Foodcourt::AddordersController < BaseFoodcourtController
end
def create
byebug
if params[:booking_id].present?
booking = Booking.find(params[:booking_id])
end

View File

@@ -230,6 +230,8 @@ class Foodcourt::QrpayController < BaseFoodcourtController
def create
sale_id = params[:sale_id]
response_body = params[:response_body]
receipt_no = Sale.find_by(sale_id: sale_id).receipt_no
unless current_login_employee
render json: { status: false, message: "User not authenticated or employee context missing." }, status: :unauthorized
@@ -239,6 +241,17 @@ class Foodcourt::QrpayController < BaseFoodcourtController
qrpayment_service = QrPaymentService.new(sale_id, current_login_employee)
result = qrpayment_service.process
PaymentGatewayAuditJob.perform_later({
receipt_no: receipt_no,
gateway_name: "MMQR",
endpoint_url: nil,
event_type: "kbz.payment.success",
request_body: nil,
response_body: response_body.to_json,
request_method: "POST",
shop_code: Shop.current_shop.shop_code
})
if result[:status]
render json: result, status: :ok
else
@@ -273,7 +286,7 @@ class Foodcourt::QrpayController < BaseFoodcourtController
if response[:data]['code'] == '0'
case response[:data]['trade_status']
when 'PAY_SUCCESS'
render json: { status: 'PAY_SUCCESS' }
render json: { status: response[:data][:trade_status], data: response[:data] }
else
render json: { status: response[:data]['trade_status'] || 'PENDING' }
end