search account no,security code check,find order,payment create
This commit is contained in:
@@ -314,6 +314,10 @@ settings/lookups => { type:customer_type, name: Staff, value:Staff }
|
||||
For FoodCourt Cashier role
|
||||
settings/lookups => { type:employee_roles, name: FoodCourt Cashier, value:foodcourt_cashier }
|
||||
|
||||
For Search Paypar security_code
|
||||
settings/lookups => { type:employee_roles, name: FoodCourt Cashier, value:foodcourt_cashier }
|
||||
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Migration
|
||||
|
||||
@@ -4,11 +4,15 @@ class Api::OrdersController < Api::ApiController
|
||||
# This API show current order details
|
||||
# Input Params - order_id
|
||||
def show
|
||||
order = Order.find(params[:order_id])
|
||||
order.order_items
|
||||
if params[:id]
|
||||
order = Order.find_by_order_id(params[:id])
|
||||
if order
|
||||
@order_items=order.order_items
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_order
|
||||
def get_order
|
||||
order = Order.find(params[:order_id])
|
||||
order.order_items
|
||||
end
|
||||
@@ -286,5 +290,4 @@ class Api::OrdersController < Api::ApiController
|
||||
|
||||
return from
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -22,167 +22,145 @@ class Api::PaymentsController < Api::ApiController
|
||||
|
||||
#create paymal payment for cashier app
|
||||
def paymal_payment
|
||||
if params[:sale_id] && params[:card_no]
|
||||
if params[:account_no] && params[:key] && params[:token] && params[:sale_id]
|
||||
sale = Sale.find_by_sale_id(params[:sale_id])
|
||||
sale_id=sale.sale_id
|
||||
if !sale.nil?
|
||||
sale_id =sale.sale_id
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
current_shift = ShiftSale.current_shift
|
||||
current_login_employee =Employee.find(current_shift.employee_id)
|
||||
@shop =Shop.find_by_shop_code(sale.shop_code)
|
||||
if sale.sale_status == "new"
|
||||
if !params[:card_no].empty?
|
||||
current_shift = ShiftSale.current_shift
|
||||
current_login_employee =Employee.find(current_shift.employee_id)
|
||||
@status, @message = send_account_paymal(sale.grand_total, params[:card_no], sale.receipt_no,current_login_employee)
|
||||
if @status
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale, @membership_data = sale_payment.process_payment(sale, current_login_employee, sale.grand_total, "paymal",params[:card_no])
|
||||
@status,@message,@balance =check_security_code(sale,params)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
if @status
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale, @membership_data = sale_payment.process_payment(sale, current_login_employee, sale.grand_total, "paymal",params[:account_no])
|
||||
if status == true && @membership_data["status"] == true
|
||||
sale_payment = SalePayment.new
|
||||
status = sale_payment.process_payment(sale, current_login_employee, 0, "cash")
|
||||
#card_balance amount for Paymal payment
|
||||
card_balance_amount, transaction_ref = SaleAudit.getCardBalanceAmount(params[:sale_id])
|
||||
rebate_amount = nil
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.find_by_sale_id(sale_id)
|
||||
|
||||
if status == true && @membership_data["status"] == true
|
||||
sale_payment = SalePayment.new
|
||||
status = sale_payment.process_payment(sale, current_login_employee, 0, "cash")
|
||||
#card_balance amount for Paymal payment
|
||||
card_balance_amount, transaction_ref = SaleAudit.getCardBalanceAmount(params[:sale_id])
|
||||
shift = ShiftSale.current_open_shift(current_login_employee)
|
||||
if !shift.nil?
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
else
|
||||
if bookings.dining_facility_id.to_i > 0
|
||||
table = DiningFacility.find(bookings.dining_facility_id)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
|
||||
|
||||
rebate_amount = nil
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.find_by_sale_id(sale_id)
|
||||
|
||||
shift = ShiftSale.current_open_shift(current_login_employee)
|
||||
if !shift.nil?
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
else
|
||||
if bookings.dining_facility_id.to_i > 0
|
||||
table = DiningFacility.find(bookings.dining_facility_id)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
|
||||
type = 'payment'
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
else
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
end
|
||||
|
||||
# For Print
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillPdf"
|
||||
print_settings = PrintSetting.all
|
||||
if !print_settings.nil?
|
||||
print_settings.each do |setting|
|
||||
if setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code = "ReceiptBillPdf"
|
||||
elsif setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code = "ReceiptBillStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
customer= Customer.find(sale.customer_id)
|
||||
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
if member_info["status"] == true
|
||||
rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
#orders print out
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
if booking.dining_facility_id.to_i>0
|
||||
table_id = booking.dining_facility_id
|
||||
else
|
||||
table_id = 0
|
||||
end
|
||||
|
||||
latest_order = booking.booking_orders.order("order_id DESC").limit(1).first()
|
||||
if !latest_order.nil?
|
||||
latest_order_no = latest_order.order_id
|
||||
end
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
# Order.pay_process_order_queue(order.order_id, table_id)
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.pay_process_order_queue(order.order_id, table_id)
|
||||
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||
end
|
||||
|
||||
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
card_no = cash_sale_trans.pan.last(4)
|
||||
card_no = card_no.rjust(19,"**** **** **** ")
|
||||
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
||||
end
|
||||
end
|
||||
|
||||
#card_balance amount for Paymal payment
|
||||
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,params[:card_no], item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
|
||||
|
||||
render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no,:order_no => latest_order_no, :message => "Payment successful."})
|
||||
type = 'payment'
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
else
|
||||
if @membership_data
|
||||
if @membership_data["card_balance_amount"] != "null"
|
||||
render json: JSON.generate({:status => true, :balance_amount => @membership_data["card_balance_amount"], :error_message => @membership_data["message"]})
|
||||
else
|
||||
render json: JSON.generate({:status => true, :error_message => @membership_data["message"]})
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
end
|
||||
|
||||
# For Print
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillPdf"
|
||||
print_settings = PrintSetting.all
|
||||
if !print_settings.nil?
|
||||
print_settings.each do |setting|
|
||||
if setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code = "ReceiptBillPdf"
|
||||
elsif setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code = "ReceiptBillStarPdf"
|
||||
end
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Payment failed!"})
|
||||
end
|
||||
end
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => @message})
|
||||
end
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Card No is required!"})
|
||||
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
customer= Customer.find(sale.customer_id)
|
||||
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
if member_info["status"] == true
|
||||
rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
#orders print out
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
if booking.dining_facility_id.to_i>0
|
||||
table_id = booking.dining_facility_id
|
||||
else
|
||||
table_id = 0
|
||||
end
|
||||
|
||||
latest_order = booking.booking_orders.order("order_id DESC").limit(1).first()
|
||||
if !latest_order.nil?
|
||||
latest_order_no = latest_order.order_id
|
||||
end
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
# Order.pay_process_order_queue(order.order_id, table_id)
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.pay_process_order_queue(order.order_id, table_id)
|
||||
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order.order_id)
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||
end
|
||||
|
||||
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
if !card_sale_trans_ref_no.nil?
|
||||
card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
card_no = cash_sale_trans.pan.last(4)
|
||||
card_no = card_no.rjust(19,"**** **** **** ")
|
||||
card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
||||
end
|
||||
end
|
||||
|
||||
#card_balance amount for Paymal payment
|
||||
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,params[:card_no], item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
|
||||
render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no,:order_no => latest_order_no, :message => "complete"})
|
||||
end
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Already paid for '#{params[:sale_id]}'!"})
|
||||
end
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "There is no sale for '#{params[:sale_id]}'!"})
|
||||
@status = false
|
||||
@message = "Invalid sale_id!"
|
||||
end
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Parameters missing! #{params[:sale_id]} #{params[:card_no]}"})
|
||||
@status=false
|
||||
@message = "Invalid account no and security code"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -223,6 +201,84 @@ class Api::PaymentsController < Api::ApiController
|
||||
|
||||
#create paymal payment for cashier app
|
||||
|
||||
#check paymal card
|
||||
def search_paypar_account_no
|
||||
if params[:sale_id] && params[:account_no]
|
||||
sale = Sale.find_by_sale_id(params[:sale_id])
|
||||
if !sale.nil?
|
||||
@shop =Shop.find_by_shop_code(sale.shop_code)
|
||||
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sale.shop_code)
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type_and_shop_code("search_paypar_account_no",sale.shop_code)
|
||||
if member_actions.gateway_url
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
merchant_uid= member_actions.merchant_account_id
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
membership_data = Customer.check_paymalcard(url,membership_setting.auth_token,merchant_uid,auth_token,params[:account_no])
|
||||
@status = membership_data["status"]
|
||||
@message = membership_data["message"]
|
||||
else
|
||||
@status = false
|
||||
@message = "Invalid gateway url!"
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@message = "Invalid gateway url!"
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@message = "Invalid sale_id"
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@message = "Invalid sale_id or card_no"
|
||||
end
|
||||
end
|
||||
def check_security_code(sale,params)
|
||||
current_shift = ShiftSale.current_shift
|
||||
current_login_employee =Employee.find(current_shift.employee_id)
|
||||
@shop =Shop.find_by_shop_code(sale.shop_code)
|
||||
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sale.shop_code)
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type_and_shop_code("search_paypar_security_code",sale.shop_code)
|
||||
if member_actions.gateway_url
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
merchant_uid= member_actions.merchant_account_id
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
membership_data = Customer.check_security_code(url,membership_setting.auth_token,merchant_uid,auth_token,params[:account_no])
|
||||
@status = membership_data["status"]
|
||||
# @message = membership_data["message"]
|
||||
if @status
|
||||
security_code =membership_data["account_data"]["security_code"]
|
||||
string ="card_no=#{params[:account_no]}passcode=#{membership_data["account_data"]["security_code"]}token=#{params[:token]}"
|
||||
hash =Digest::SHA256.hexdigest string
|
||||
if hash ==params[:key]
|
||||
if membership_data["account_data"]["available_balance"].to_i >sale.grand_total
|
||||
@status = true
|
||||
@message = "complete"
|
||||
@balance = membership_data["account_data"]["available_balance"]
|
||||
else
|
||||
@status = false
|
||||
@message = "insufficient"
|
||||
@balance = membership_data["account_data"]["available_balance"]
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@message = "incorrect"
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@message = "Invalid gateway url!"
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@message = "Invalid gateway url!"
|
||||
end
|
||||
return @status,@message,@balance
|
||||
end
|
||||
private
|
||||
def handle_payment(sale_payment)
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ class Customer < ApplicationRecord
|
||||
self.email = pin.to_s + "@gmail.com"
|
||||
self.pin_code = pin.to_s
|
||||
self.pin_sent_at = Time.now
|
||||
tax_profiles=TaxProfile.where(group_type: "food_court")
|
||||
tax_ids =[]
|
||||
tax_profiles.each {|tax| tax_ids << "#{tax.id}"}
|
||||
self.tax_profiles = tax_ids
|
||||
self.save
|
||||
return self
|
||||
else
|
||||
@@ -381,6 +385,57 @@ class Customer < ApplicationRecord
|
||||
WALKIN = "CUS-000000000001"
|
||||
TAKEAWAY = "CUS-000000000002"
|
||||
|
||||
def self.check_paymalcard(url,token,merchant_uid,auth_token,account_no)
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.get(url,
|
||||
:body => { merchant_uid:merchant_uid,auth_token:auth_token,paypar_account_no: account_no}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=4'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = { "status" => false, "message" => "Can't open membership server"}
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status" => false, "message" => "No internet connection " }
|
||||
rescue OpenURI::HTTPError
|
||||
response = { "status" => false, "message" => "No internet connection "}
|
||||
rescue SocketError
|
||||
response = { "status" => false, "message" => "No internet connection "}
|
||||
end
|
||||
Rails.logger.debug "search_paypar_account_no"
|
||||
Rails.logger.debug response.to_json
|
||||
if response["status"]
|
||||
response = { "status" => true, "message" => "Success"}
|
||||
else
|
||||
response = { "status" => false, "message" => response["message"]}
|
||||
end
|
||||
return response
|
||||
end
|
||||
def self.check_security_code(url,token,merchant_uid,auth_token,account_no)
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.get(url,
|
||||
:body => { merchant_uid:merchant_uid,auth_token:auth_token,paypar_account_no: account_no}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=4'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = { "status" => false, "message" => "Can't open membership server"}
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status" => false, "message" => "No internet connection " }
|
||||
rescue OpenURI::HTTPError
|
||||
response = { "status" => false, "message" => "No internet connection "}
|
||||
rescue SocketError
|
||||
response = { "status" => false, "message" => "No internet connection "}
|
||||
end
|
||||
Rails.logger.debug "search_paypar_account_no"
|
||||
Rails.logger.debug response.to_json
|
||||
return response
|
||||
end
|
||||
private
|
||||
def generate_custom_id
|
||||
self.customer_id = SeedGenerator.generate_id(self.class.name, "CUS")
|
||||
|
||||
@@ -649,6 +649,8 @@ class Sale < ApplicationRecord
|
||||
# tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
if order_source.to_s == "emenu"
|
||||
order_source = "cashier"
|
||||
elsif order_source.to_s == "app"
|
||||
order_source = "food_court"
|
||||
end
|
||||
|
||||
# tax_data = TaxProfile.unscope(:order).where("group_type=?",order_source).pluck(:id)
|
||||
@@ -2129,6 +2131,7 @@ def self.get_sale_data_for_other_payment_credit(sale_id)
|
||||
end
|
||||
|
||||
def unique_tax_profiles(order_source, customer_id)
|
||||
puts "unique_tax_profiles unique_tax_profiles"
|
||||
tax_data = TaxProfile.where(group_type: order_source)
|
||||
customer_tax_profiles = Customer.select(:tax_profiles).where(customer_id: customer_id).first
|
||||
if customer_tax_profiles.present?
|
||||
|
||||
@@ -222,7 +222,7 @@ class SalePayment < ApplicationRecord
|
||||
account_no: account_no, amount: amount}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
'Accept' => 'application/json; version=4'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Errno::ECONNREFUSED
|
||||
@@ -336,7 +336,7 @@ class SalePayment < ApplicationRecord
|
||||
:body => params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
'Accept' => 'application/json; version=4'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -1043,7 +1043,6 @@ class SalePayment < ApplicationRecord
|
||||
.group("sale_payments.sale_payment_id")
|
||||
return query
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
if self.sale_payment_id.nil?
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
if @order_items
|
||||
json.status true
|
||||
json.order_items @order_items
|
||||
else
|
||||
json.status false
|
||||
json.message "Invalid order_id"
|
||||
end
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
json.status @status
|
||||
json.message @message
|
||||
json.balance_amount @balance
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
json.status @status
|
||||
json.message @message
|
||||
@@ -133,6 +133,10 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
post "get_daily_sale_data" => "load_data#get_daily_sale_data"
|
||||
post "get_check_sale_data" => "load_data#get_check_sale_data"
|
||||
end
|
||||
|
||||
#for foodcourt app
|
||||
get "search_paypar_account_no" => "payments#search_paypar_account_no"
|
||||
# get "check_security_code" => "payments#check_security_code"
|
||||
end
|
||||
|
||||
#--------- Cashier ------------#
|
||||
|
||||
Reference in New Issue
Block a user