Fixed conflict
This commit is contained in:
@@ -318,6 +318,7 @@ settings/lookups => { type:customer_type, name: Staff, value:Staff }
|
||||
For FoodCourt Cashier role
|
||||
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
|
||||
@@ -283,5 +287,4 @@ class Api::OrdersController < Api::ApiController
|
||||
|
||||
return from
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -22,166 +22,146 @@ 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
|
||||
@paid_amount = sale.grand_total
|
||||
current_shift = ShiftSale.current_shift
|
||||
current_login_employee =Employee.find(current_shift.employee_id)
|
||||
@shop =Shop.find_by_shop_code(sale.shop_code)
|
||||
@status,@message,@balance =check_security_code(sale,params)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
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])
|
||||
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 && @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,current_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", :paid_amount => sale.grand_total})
|
||||
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
|
||||
|
||||
@@ -222,6 +202,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)
|
||||
|
||||
|
||||
@@ -3,19 +3,19 @@ module MultiTenancy
|
||||
|
||||
included do
|
||||
set_current_tenant_through_filter if respond_to? :set_current_tenant_through_filter
|
||||
before_action :find_shop_by_subdomain_or_frist if respond_to? :before_action
|
||||
before_action :set_current_tenant_by_subdomain_or_frist if respond_to? :before_action
|
||||
helper_method :current_shop if respond_to? :helper_method
|
||||
end
|
||||
|
||||
private
|
||||
def find_shop_by_subdomain_or_frist
|
||||
if request.subdomains.last
|
||||
set_current_tenant(Shop.find_by(shop_code: request.subdomains.last.partition('-').last))
|
||||
def set_current_tenant_by_subdomain_or_frist
|
||||
if request.subdomains.last && request.subdomains.last != 'www'
|
||||
set_current_tenant(Shop.find_by(subdomain: request.subdomains.last))
|
||||
end
|
||||
current_shop
|
||||
set_current_tenant(Shop.first) if current_tenant.nil?
|
||||
end
|
||||
|
||||
def current_shop
|
||||
@shop ||= Shop.current_shop
|
||||
ActsAsTenant.current_tenant
|
||||
end
|
||||
end
|
||||
|
||||
@@ -192,7 +192,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
#card_balance amount for Paymal payment
|
||||
<<<<<<< HEAD
|
||||
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
|
||||
=======
|
||||
card_balance_amount, transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
|
||||
>>>>>>> 60af9124bb181c662358624e1e6fbee1be36a2bb
|
||||
|
||||
# get printer info
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
@@ -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: "online_order")
|
||||
tax_ids =[]
|
||||
tax_profiles.each {|tax| tax_ids << "#{tax.id}"}
|
||||
self.tax_profiles = tax_ids
|
||||
self.save
|
||||
return self
|
||||
else
|
||||
@@ -389,6 +393,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")
|
||||
|
||||
@@ -458,7 +458,7 @@ class Sale < ApplicationRecord
|
||||
if order_source.to_s == "emenu"
|
||||
order_source = "cashier"
|
||||
elsif order_source.to_s == "app"
|
||||
order_source = "food_court"
|
||||
order_source = "online_order"
|
||||
end
|
||||
|
||||
tax_profiles = unique_tax_profiles(order_source, self.customer_id)
|
||||
@@ -592,6 +592,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 = "online_order"
|
||||
end
|
||||
|
||||
# tax_data = TaxProfile.unscope(:order).where("group_type=?",order_source).pluck(:id)
|
||||
@@ -2024,6 +2026,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
|
||||
|
||||
@@ -217,7 +217,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
|
||||
@@ -331,7 +331,7 @@ class SalePayment < ApplicationRecord
|
||||
:body => params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
'Accept' => 'application/json; version=4'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -970,7 +970,6 @@ class SalePayment < ApplicationRecord
|
||||
.merge(SalePayment.where.not(payment_method: 'creditnote')
|
||||
.or(SalePayment.where.not(SalePayment.arel_table[:payment_amount].lteq(sale_data.sale_payments.joins(:sale_audit).sum(:payment_amount)))))
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
if self.sale_payment_id.nil?
|
||||
|
||||
@@ -12,6 +12,6 @@ class Shop < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.current_shop
|
||||
RequestStore["current_shop"] ||= ActsAsTenant.current_tenant || Shop.first
|
||||
ActsAsTenant.current_tenant
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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,4 @@
|
||||
json.status @status
|
||||
json.message @message
|
||||
json.balance_amount @balance
|
||||
json.paid_amount @paid_amount
|
||||
|
||||
@@ -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 ------------#
|
||||
|
||||
13
db/migrate/20200111044418_add_shopcode.rb
Normal file
13
db/migrate/20200111044418_add_shopcode.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class AddShopcode < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :dining_charges, :shop_code, :string, :default => '262'
|
||||
add_column :order_items, :shop_code, :string, :default => '262'
|
||||
add_column :promotion_products, :shop_code, :string, :default => '262'
|
||||
add_column :sale_audits, :shop_code, :string, :default => '262'
|
||||
add_column :sale_items, :shop_code, :string, :default => '262'
|
||||
add_column :sale_payments, :shop_code, :string, :default => '262'
|
||||
add_column :sale_taxes, :shop_code, :string, :default => '262'
|
||||
add_column :menu_item_instances, :shop_code, :string, :default => '262'
|
||||
add_column :menu_items, :shop_code, :string, :default => '262'
|
||||
end
|
||||
end
|
||||
103
db/migrate/20200112075013_add_remove_indexs.rb
Normal file
103
db/migrate/20200112075013_add_remove_indexs.rb
Normal file
@@ -0,0 +1,103 @@
|
||||
class AddRemoveIndexs < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
remove_index "menu_items", name: "index_item_code"
|
||||
add_index :menu_items, [:shop_code, :item_code]
|
||||
|
||||
remove_index "orders", name: "index_source"
|
||||
remove_index "orders", name: "index_date"
|
||||
remove_index "orders", name: "index_status"
|
||||
add_index :orders, [:shop_code, :status]
|
||||
add_index :orders, [:shop_code, :source]
|
||||
add_index :orders, [:shop_code, :date]
|
||||
add_index :orders, [:shop_code, :source, :status, :date], name: "index_orders_on_source_status"
|
||||
|
||||
remove_index "order_items", name: "index_order_id"
|
||||
|
||||
remove_index "dining_facilities", name: "index_status"
|
||||
remove_index "dining_facilities", name: "index_type"
|
||||
remove_index "dining_facilities", name: "index_is_active"
|
||||
remove_index "dining_facilities", name: "index_status_type_is_active"
|
||||
add_index :dining_facilities, [:shop_code, :is_active]
|
||||
add_index :dining_facilities, [:shop_code, :status]
|
||||
add_index :dining_facilities, [:shop_code, :type]
|
||||
add_index :dining_facilities, [:shop_code, :is_active, :status], name: 'index_dining_facilities_on_active_status'
|
||||
|
||||
remove_index "sale_items", name: "index_sale_items"
|
||||
remove_index "sale_items", name: "index_sale_id"
|
||||
remove_index "sale_items", name: "index_account_id"
|
||||
remove_index "sale_items", name: "index_status"
|
||||
remove_index "sale_items", name: "index_remark"
|
||||
remove_index "sale_items", name: "index_qty"
|
||||
remove_index "sale_items", name: "index_unit_ptice"
|
||||
remove_index "sale_items", name: "index_taxable_price"
|
||||
remove_index "sale_items", name: "index_ptice"
|
||||
remove_index "sale_items", name: "index_is_taxable"
|
||||
add_index :sale_items, [:shop_code, :status]
|
||||
|
||||
remove_index "sale_taxes", name: "index_sale_id"
|
||||
|
||||
remove_index "sale_payments", name: "index_sale_id"
|
||||
remove_index "sale_payments", name: "index_payment_method"
|
||||
remove_index "sale_payments", name: "index_sale_id_payment_method"
|
||||
add_index :sale_payments, [:shop_code, :payment_method]
|
||||
|
||||
remove_index "sale_orders", name: "index_sale_id"
|
||||
remove_index "sale_orders", name: "index_order_id"
|
||||
|
||||
remove_index "sale_audits", name: "index_sale_audits"
|
||||
|
||||
remove_index "lookups", name: "index_lookup_type"
|
||||
add_index :lookups, [:shop_code, :lookup_type]
|
||||
|
||||
remove_index "bookings", name: "index_bookings"
|
||||
remove_index "bookings", name: "index_checkin_at"
|
||||
remove_index "bookings", name: "index_checkout_by"
|
||||
remove_index "bookings", name: "index_reserved_by"
|
||||
remove_index "bookings", name: "index_booking_status"
|
||||
add_index :bookings, [:shop_code, :booking_status]
|
||||
|
||||
remove_index "seed_generators", name: "index_seed_model"
|
||||
add_index :seed_generators, [:shop_code, :model]
|
||||
|
||||
remove_index "assigned_order_items", name: "index_assigned_order_items"
|
||||
remove_index "assigned_order_items", name: "index_item_code"
|
||||
remove_index "assigned_order_items", name: "index_instance_code"
|
||||
remove_index "assigned_order_items", name: "index_order_queue_station_id"
|
||||
remove_index "assigned_order_items", name: "index_delivery_status"
|
||||
remove_index "assigned_order_items", name: "index_created_at"
|
||||
add_index :assigned_order_items, [:shop_code, :item_code]
|
||||
add_index :assigned_order_items, [:shop_code, :instance_code]
|
||||
add_index :assigned_order_items, [:shop_code, :item_code, :instance_code],name:'index_assigned_items_on_codes'
|
||||
|
||||
remove_index "booking_orders", name: "index_booking_id"
|
||||
remove_index "booking_orders", name: "index_order_id"
|
||||
|
||||
remove_index "customers", name: "index_membership_id"
|
||||
remove_index "customers", name: "index_customer_type"
|
||||
add_index :customers, [:shop_code, :customer_type]
|
||||
|
||||
remove_index "shift_sales", name: "index_shift_started_at"
|
||||
remove_index "shift_sales", name: "index_shift_closed_at"
|
||||
remove_index "shift_sales", name: "index_shift_started_at_closed_at"
|
||||
add_index :shift_sales, [:shop_code, :shift_started_at, :shift_closed_at],name:'index_shifts_on_time'
|
||||
|
||||
remove_index "print_settings", name: "index_unique_code"
|
||||
add_index :print_settings, [:shop_code, :unique_code]
|
||||
|
||||
remove_index "sales", name: "index_sales"
|
||||
remove_index "sales", name: "index_receipt_date"
|
||||
remove_index "sales", name: "index_payment_status"
|
||||
remove_index "sales", name: "index_sale_status"
|
||||
remove_index "sales", name: "index_sale_shift_sale_id"
|
||||
add_index :sales, [:shop_code, :sale_status]
|
||||
add_index :sales, [:shop_code, :payment_status]
|
||||
add_index :sales, [:shop_code, :sale_status, :payment_status]
|
||||
|
||||
remove_index "promotions", name: "index_promotions"
|
||||
remove_index "promotions", name: "index_promo_start_date"
|
||||
remove_index "promotions", name: "index_promo_end_date"
|
||||
remove_index "promotions", name: "index_promo_start_hour"
|
||||
remove_index "promotions", name: "index_promo_end_hour"
|
||||
add_index :promotions, [:shop_code, :promo_start_date, :promo_end_date, :promo_start_hour, :promo_end_hour], name: 'index_promotions_on_time'
|
||||
end
|
||||
end
|
||||
5
db/migrate/20200113100120_addcolumnsubdomain_shop.rb
Normal file
5
db/migrate/20200113100120_addcolumnsubdomain_shop.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddcolumnsubdomainShop < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :shops, :subdomain, :string
|
||||
end
|
||||
end
|
||||
167
lib/tasks/add_shopcode.rake
Normal file
167
lib/tasks/add_shopcode.rake
Normal file
@@ -0,0 +1,167 @@
|
||||
task :add_manual_data, [:shop_code] do |task, args|
|
||||
puts args[:shop_code]
|
||||
# shop_code= args[:var]
|
||||
puts "#{args[:shop_code]}"
|
||||
gateway_communication_type = Lookup.create([{lookup_type:'gateway_communication_type',name: 'API',value: 'api',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'gateway_communication_type',name: 'USB',value: 'usb',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
payment_methods = Lookup.create([{lookup_type:'payment_methods',name: 'Cash',value: 'cash',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'CreditNote',value: 'creditnote',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'Card - VISA',value: 'visa',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'Card - MASTER',value: 'master',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'Card - JCB',value: 'jcb',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'Card - UnionPay',value: 'unionpay',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'Card - MPU',value: 'jcb',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'Vochure',value: 'vochure',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_methods',name: 'Giftcard',value: 'gift',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
payment_status = Lookup.create([{lookup_type:'payment_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_status',name: 'paid',value: 'paid',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_status',name: 'Fail',value: 'fail',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'payment_status',name: 'Outstanding',value: 'outstanding',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
sales_status = Lookup.create([{lookup_type:'sales_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'sales_status',name: 'Void',value: 'void',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'sales_status',name: 'Completed',value: 'completed',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
order_status = Lookup.create([{lookup_type:'order_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_status',name: 'Completed',value: 'completed',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
order_item_status = Lookup.create([{lookup_type:'order_item_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_item_status',name: 'Processing',value: 'processing',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_item_status',name: 'Served',value: 'served',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_item_status',name: 'BIlled',value: 'billed',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#order_source [tablet,order_station,emenu,api]
|
||||
order_source = Lookup.create([{lookup_type:'order_source',name: 'API',value: 'api',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_source',name: 'Tablet',value: 'tablet',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_source',name: 'EMenu',value: 'emenu',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_source',name: 'Order Station',value: 'order_station',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#order_type [dine-in,takeaway,delivery]
|
||||
order_type = Lookup.create([{lookup_type:'order_type',name: 'Dine-in',value: 'dine-in',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_type',name: 'Takeaway',value: 'takeaway',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'order_type',name: 'Delivery',value: 'delivery',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#menu_item_type:[simple| set| DIY]
|
||||
menu_item_type = Lookup.create([{lookup_type:'menu_item_type',name: 'SIMPLE',value: 'simpleItem',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'menu_item_type',name: 'Set Menu',value: 'setMenu',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'menu_item_type',name: 'DIY',value: 'diy',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
member_group_type = Lookup.create([{lookup_type:'member_group_type',name: 'Normal',value: '1',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'member_group_type',name: 'Platinum',value: '5',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'member_group_type',name: 'Silver',value: '4',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'member_group_type',name: 'Gold',value: '3',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#menu_item_attribute:[size|]
|
||||
menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type',name: 'Size',value: 'size',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#Employee Roles
|
||||
employee_roles = Lookup.create([{lookup_type:'employee_roles',name: 'Cashier',value: 'cashier',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'employee_roles',name: 'Waiter',value: 'waiter',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'employee_roles',name: 'Supervisor',value: 'supervisor',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'employee_roles',name: 'Manager',value: 'manager',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'employee_roles',name: 'Accountant',value: 'account',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'employee_roles',name: 'Administrator',value: 'administrator',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'employee_roles',name: 'FoodCourt Cashier',value: 'foodcourt_cashier',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#booking_status
|
||||
booking_status = Lookup.create([{lookup_type:'booking_status',name: 'Available',value: 'available',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'booking_status',name: 'Reserved',value: 'reserved',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'booking_status',name: 'Occupied',value: 'occupied',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'booking_status',name: 'Cleaning',value: 'cleaning',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'booking_status',name: 'Moved',value: 'moved',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#booking_status
|
||||
account_type = Lookup.create([{lookup_type:'account_type',name: 'Income',value: '0',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'account_type',name: 'Expense',value: '1',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
# sale void reason
|
||||
void_reason = Lookup.create([{lookup_type:'void_reason',name: 'Approve By Manager',value: 'Approve By Manager',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'void_reason',name: 'Customer Mistake',value: 'Customer Mistake',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'void_reason',name: 'Cashier Mistake',value: 'Cashier Mistake',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'void_reason',name: 'Waiter Mistake',value: 'Waiter Mistake',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
# sale void reason
|
||||
float_value = Lookup.create([{lookup_type:'float_value',name: '500',value: '500',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'float_value',name: '1000',value: '1000',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'float_value',name: '5000',value: '5000',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'float_value',name: '10000',value: '10000',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
# customer type
|
||||
customer_type = Lookup.create([{lookup_type:'customer_type',name: 'Dinein',value: 'Dinein',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'customer_type',name: 'FoodCourt',value: 'FoodCourt',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'customer_type',name: 'Takeaway',value: 'Takeaway',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'customer_type',name: 'Delivery',value: 'Delivery',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
#unit
|
||||
units = Lookup.create([{lookup_type:'unit',name: 'PCS',value: 'pcs',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'unit',name: 'KG',value: 'kg',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
|
||||
# Country
|
||||
countries = Lookup.create({lookup_type:'country',name: 'Japan',value: 'Japan',shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
# number formats
|
||||
number_formats = Lookup.create([{lookup_type: 'number_format',name: 'precision',value: '2',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type: 'number_format',name: 'delimiter',value:',',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type: 'number_format',name: 'strip_insignificant_zeros',value:'0',shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
# tax_profiles
|
||||
tax_profiles = Lookup.create([{lookup_type:'tax_profiles',name: 'Cashier',value: 'cashier',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'tax_profiles',name: 'FoodCourt',value: 'food_court',shop_code: "#{args[:shop_code]}"},
|
||||
{lookup_type:'tax_profiles',name: 'Online Order',value: 'online_order',shop_code: "#{args[:shop_code]}"}])
|
||||
#foodcourt use
|
||||
foodcourt = Lookup.create([{lookup_type:'food_court',name: 'FoodCourt',value: '1',shop_code: "#{args[:shop_code]}"}])
|
||||
# Default CUSTOMER
|
||||
customer = Customer.create({name:"WALK-IN",email: "cus1@customer.com",contact_no:"000000000",card_no:"000",customer_type:"Dinein",tax_profiles:["2","1"],shop_code: "#{args[:shop_code]}"})
|
||||
customer2 = Customer.create({name:"TAKEAWAY",email: "cus2@customer.com",contact_no:"111111111",card_no:"111",customer_type:"Takeaway",tax_profiles:["1"],shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
# Tax Profile FoodCourt
|
||||
commercial_taxes_online_order = TaxProfile.create({name: "Commercial Tax",group_type: "food_court",rate:5.0,order_by:2,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
service_charges_online_order = TaxProfile.create({name: "Service Charges",group_type: "food_court",rate:0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
#Tax Profile Online Order
|
||||
commercial_taxes_online_order = TaxProfile.create({name: "Commercial Tax",group_type: "online_order",rate:5.0,order_by:2,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
service_charges_online_order = TaxProfile.create({name: "Service Charges",group_type: "online_order",rate:0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
convenience_charges_online_order= TaxProfile.create({name: "Convenience Charges",group_type: "online_order",rate:5.0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
#Create Adminstrator employee
|
||||
admin_employee = Employee.create({name: "Administrator",role: "administrator",password: "99999",emp_id:"999",created_by: "SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
foodcourt_employee = Employee.create({name: "Cashier",role: "cashier",password: "22222",emp_id:"221",created_by: "SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
|
||||
order_item_printer=PrintSetting.create({name: "OrderItemPdf",unique_code: "OrderItemPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
|
||||
order_summary_printer=PrintSetting.create({name: "Order Summary",unique_code: "OrderSummaryPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
|
||||
request_bill_printer=PrintSetting.create({name: "Receipt Bill",unique_code: "ReceiptBillPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
|
||||
close_cashier_printer=PrintSetting.create({name: "Close Cashier",unique_code: "CloseCashierPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
|
||||
crm_order_printer=PrintSetting.create({name: "CRM Order",unique_code: "CrmOrderPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
|
||||
queue_no_printer=PrintSetting.create({name: "Queue No",unique_code: "QueueNoPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
zone = Zone.create({id:1,name: "H1",is_active:true,created_by: "SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "https://staging.membership.paymal.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
member_actions= MembershipAction.create([{membership_type:"get_account_balance",is_active:1,gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"redeem",is_active:1,gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"create_membership_customer",is_active:1,gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"update_membership_customer",is_active:1,gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"get_all_member_group",is_active:1,gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"rebate",is_active:1,gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"get_all_member_account",is_active:1,gateway_url:"/api/generic_customer/get_member_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"get_member_transactions",is_active:1,gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"member_discount",is_active:1,gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"get_member_campaign",is_active:1,gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"search_paypar_account_no",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
|
||||
{membership_type:"search_paypar_security_code",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_security_code",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"}])
|
||||
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "/api/membership_campaigns/redeem",merchant_account_id:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"})
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"PAYMAL",gateway_url: "/api/create_payment",merchant_account_id:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"})
|
||||
|
||||
puts " Finished System Default Set Up Data"
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user