-
This commit is contained in:
@@ -21,6 +21,7 @@ class Api::ApiController < ActionController::API
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(current_token)
|
||||
puts @employee.to_json
|
||||
end
|
||||
|
||||
# def lookup_domain
|
||||
|
||||
@@ -43,7 +43,7 @@ class Api::BillController < Api::ApiController
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, cashier, order.source)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, cashier, order.source,params[:current_checkin_induties_count])
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
else
|
||||
@status = true
|
||||
@@ -177,7 +177,7 @@ class Api::BillController < Api::ApiController
|
||||
|
||||
if @booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(@booking.booking_id, current_login_employee, cashier, order.source)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(@booking.booking_id, current_login_employee, cashier, order.source,params[:current_checkin_induties_count])
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
else
|
||||
@status = true
|
||||
|
||||
60
app/controllers/api/payment/mobilepayment_controller.rb
Normal file
60
app/controllers/api/payment/mobilepayment_controller.rb
Normal file
@@ -0,0 +1,60 @@
|
||||
class Api::Payment::MobilepaymentController < Api::ApiController
|
||||
|
||||
# skip_before_action :authenticate
|
||||
|
||||
def cash
|
||||
|
||||
cash = params[:cash]
|
||||
sale_id = params[:sale_id]
|
||||
cashier_id = params[:cashier_id]
|
||||
|
||||
current_user = Employee.find(cashier_id)
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
shop_detail = Shop.first
|
||||
|
||||
# rounding adjustment
|
||||
if !path.include? ("credit_payment")
|
||||
if shop_detail.is_rounding_adj
|
||||
a = saleObj.grand_total % 25 # Modulus
|
||||
b = saleObj.grand_total / 25 # Division
|
||||
#not calculate rounding if modulus is 0 and division is even
|
||||
#calculate rounding if modulus is zero or not zero and division are not even
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
|
||||
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
|
||||
end
|
||||
end
|
||||
# end rounding adjustment
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
|
||||
sale_payment =sale_payment.process_payment(saleObj, current_user, cash, "cash")
|
||||
if sale_payment[0]
|
||||
@cash ={"change_amount"=>sale_payment[3],"balance_amount"=>sale_payment[4] ,"receipt_url"=>''}
|
||||
end
|
||||
@out = true,@cash
|
||||
|
||||
else
|
||||
@out =false,"Something wrong!"
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment = sale_payment.process_payment(saleObj, current_user, cash, "cash")
|
||||
if sale_payment[0]
|
||||
@cash = {"change_amount"=>sale_payment[3],"balance_amount"=>sale_payment[4] ,"receipt_url"=>''}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def kbz_pay
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -13,5 +13,8 @@ class Api::SyncController < Api::ApiController
|
||||
ShiftSale.sync_shift_sale_records(params[:shift_sales])
|
||||
Booking.sync_booking_records(params[:bookings])
|
||||
AssignedOrderItem.sync_assigned_order_item_records(params[:assigned_order_items])
|
||||
SeedGenerator.sync_seed_generator_records(params[:seed_generators])
|
||||
|
||||
# render :json => { :status => true, :message => "Hello!" }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user