card payment
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -67,3 +67,8 @@ config/shops.json
|
|||||||
|
|
||||||
#Seed Generator Backup File
|
#Seed Generator Backup File
|
||||||
/app/models/seed_generator_bk.rb
|
/app/models/seed_generator_bk.rb
|
||||||
|
|
||||||
|
# crt and key
|
||||||
|
*.crt
|
||||||
|
*.key
|
||||||
|
*.pid
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Api::Restaurant::MenuController < Api::ApiController
|
|||||||
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
|
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
|
||||||
|
|
||||||
shop_code = params[:shop_code]
|
shop_code = params[:shop_code]
|
||||||
all_menu = Menu.where('shop_id=?',shop_code).active.all
|
all_menu = Menu.where('shop_code=?',shop_code).active.all
|
||||||
@request_url = ''
|
@request_url = ''
|
||||||
if ENV["SERVER_MODE"] == "cloud"
|
if ENV["SERVER_MODE"] == "cloud"
|
||||||
@request_url = request.base_url
|
@request_url = request.base_url
|
||||||
@@ -17,20 +17,20 @@ class Api::Restaurant::MenuController < Api::ApiController
|
|||||||
# to hash
|
# to hash
|
||||||
menu_array = []
|
menu_array = []
|
||||||
all_menu.each do |m|
|
all_menu.each do |m|
|
||||||
menu_array.push(m.to_json(:include => {:menu_categories =>
|
menu_array.push(m.to_json(:include => {:menu_categories =>
|
||||||
{ :include => { :menu_items =>
|
{ :include => { :menu_items =>
|
||||||
{ :include => [:menu_item_sets, :menu_item_instances =>
|
{ :include => [:menu_item_sets, :menu_item_instances =>
|
||||||
{ :include => :menu_instance_item_sets}]} } }}))
|
{ :include => :menu_instance_item_sets}]} } }}))
|
||||||
end
|
end
|
||||||
|
|
||||||
#export Checksum file generate by md5
|
#export Checksum file generate by md5
|
||||||
menu_checksum = Digest::MD5.hexdigest(menu_array.to_json)
|
menu_checksum = Digest::MD5.hexdigest(menu_array.to_json)
|
||||||
|
|
||||||
if menu_checksum != param_checksum
|
if menu_checksum != param_checksum
|
||||||
response.headers['CHECKSUM'] = menu_checksum
|
response.headers['CHECKSUM'] = menu_checksum
|
||||||
@menus = all_menu
|
@menus = all_menu
|
||||||
end
|
end
|
||||||
# @current_menu = Menu.current_menu
|
# @current_menu = Menu.current_menu
|
||||||
end
|
end
|
||||||
|
|
||||||
#Description
|
#Description
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Api::VerificationsController < ActionController::API
|
class Api::VerificationsController < ActionController::API
|
||||||
|
|
||||||
def new
|
def new
|
||||||
phone_number = params[:phone_number]
|
phone_number = params[:phone_number]
|
||||||
|
|
||||||
#TODO - user generate
|
#TODO - user generate
|
||||||
@@ -10,9 +10,9 @@ class Api::VerificationsController < ActionController::API
|
|||||||
VerifyNumber.send_message(phone_number, @cus.pin_code)
|
VerifyNumber.send_message(phone_number, @cus.pin_code)
|
||||||
@result = true
|
@result = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
phone_number = params[:phone_number]
|
phone_number = params[:phone_number]
|
||||||
pin_code = params[:pin_code]
|
pin_code = params[:pin_code]
|
||||||
@cus = Customer.find_by_contact_no(phone_number)
|
@cus = Customer.find_by_contact_no(phone_number)
|
||||||
@@ -23,4 +23,4 @@ class Api::VerificationsController < ActionController::API
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module LoginVerification
|
|||||||
|
|
||||||
def current_shop
|
def current_shop
|
||||||
begin
|
begin
|
||||||
shop_code ='262'
|
shop_code ='263'
|
||||||
@shop =Shop.find_by_shop_code(shop_code)
|
@shop =Shop.find_by_shop_code(shop_code)
|
||||||
return @shop
|
return @shop
|
||||||
rescue
|
rescue
|
||||||
@@ -42,7 +42,7 @@ module LoginVerification
|
|||||||
|
|
||||||
#Shop Name in Navbor
|
#Shop Name in Navbor
|
||||||
def shop_detail
|
def shop_detail
|
||||||
shop_code ='262'
|
shop_code ='263'
|
||||||
@shop = Shop.find_by_shop_code(shop_code)
|
@shop = Shop.find_by_shop_code(shop_code)
|
||||||
return @shop
|
return @shop
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Origami::BankIntegrationController < ApplicationController #BaseOrigamiController
|
class Origami::BankIntegrationController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def settle_trans
|
def settle_trans
|
||||||
if(params[:type] == 'request')
|
if(params[:type] == 'request')
|
||||||
card_settle_trans = CardSettleTran.new()
|
card_settle_trans = CardSettleTran.new()
|
||||||
@@ -35,7 +35,7 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
|
|||||||
card_settle_trans.save()
|
card_settle_trans.save()
|
||||||
response = {status: 'success'}
|
response = {status: 'success'}
|
||||||
end
|
end
|
||||||
render json: response
|
render json: response
|
||||||
end
|
end
|
||||||
|
|
||||||
def sale_trans
|
def sale_trans
|
||||||
@@ -93,7 +93,7 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
|
|||||||
|
|
||||||
response = {status: 'success'}
|
response = {status: 'success'}
|
||||||
end
|
end
|
||||||
render json: response
|
render json: response
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ class Origami::FoodCourtController < ApplicationController
|
|||||||
# @menus = Menu.all
|
# @menus = Menu.all
|
||||||
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||||
# end
|
# end
|
||||||
@zone = Zone.all
|
@zone = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true")
|
||||||
@customer = Customer.all
|
@customer = Customer.all
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
|
||||||
@cashier_type = "food_court"
|
@cashier_type = "food_court"
|
||||||
#checked quick_service only
|
#checked quick_service only
|
||||||
@quick_service_only = true
|
@quick_service_only = true
|
||||||
lookup_dine_in = Lookup.collection_of('dinein_cashier')
|
lookup_dine_in = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('dinein_cashier')
|
||||||
if !lookup_dine_in.empty?
|
if !lookup_dine_in.empty?
|
||||||
lookup_dine_in.each do |dine_in|
|
lookup_dine_in.each do |dine_in|
|
||||||
if dine_in[0].downcase == "dineincashier"
|
if dine_in[0].downcase == "dineincashier"
|
||||||
@@ -156,7 +156,7 @@ class Origami::FoodCourtController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_all_product()
|
def get_all_product()
|
||||||
@product = Product.all
|
@product = Product..where("shop_code='#{@shop.shop_code}'")
|
||||||
end
|
end
|
||||||
|
|
||||||
# render json for http status code
|
# render json for http status code
|
||||||
@@ -186,12 +186,6 @@ class Origami::FoodCourtController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_user
|
|
||||||
if current_user.nil?
|
|
||||||
redirect_to root_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# this can always true
|
# this can always true
|
||||||
def check_order_with_booking(booking)
|
def check_order_with_booking(booking)
|
||||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ class Origami::PaymalController < BaseOrigamiController
|
|||||||
if customer_data
|
if customer_data
|
||||||
@membership_id = customer_data.membership_id
|
@membership_id = customer_data.membership_id
|
||||||
if !@membership_id.nil?
|
if !@membership_id.nil?
|
||||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",@shop.shop_code)
|
||||||
if membership_setting.gateway_url
|
if membership_setting.gateway_url
|
||||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
|
member_actions =MembershipAction.find_by_membership_type_and_shop_code("get_account_balance",@shop.shop_code)
|
||||||
if member_actions.gateway_url
|
if member_actions.gateway_url
|
||||||
@campaign_type_id = nil
|
@campaign_type_id = nil
|
||||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||||
@@ -72,7 +72,6 @@ def create
|
|||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
transaction_ref = params[:transaction_ref]
|
transaction_ref = params[:transaction_ref]
|
||||||
account_no = params[:account_no]
|
account_no = params[:account_no]
|
||||||
puts params.to_json
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
# shop_details = Shop.first
|
# shop_details = Shop.first
|
||||||
@@ -87,6 +86,7 @@ def create
|
|||||||
# saleObj = Sale.find(sale_id)
|
# saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
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
|
if status == true && @membership_data["status"] == true
|
||||||
@out = true, "Success!"
|
@out = true, "Success!"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Settings::PaymentMethodSettingsController < ApplicationController
|
|||||||
# POST /settings/payment_method_settings.json
|
# POST /settings/payment_method_settings.json
|
||||||
def create
|
def create
|
||||||
@settings_payment_method_setting = PaymentMethodSetting.new(settings_payment_method_setting_params)
|
@settings_payment_method_setting = PaymentMethodSetting.new(settings_payment_method_setting_params)
|
||||||
@settings_payment_method_settings.shop_code = @shop.shop_code
|
@settings_payment_method_setting.shop_code = @shop.shop_code
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_payment_method_setting.save
|
if @settings_payment_method_setting.save
|
||||||
format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully created.' }
|
format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully created.' }
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Customer < ApplicationRecord
|
|||||||
cus.save
|
cus.save
|
||||||
return cus
|
return cus
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_member_account(customer)
|
def self.get_member_account(customer)
|
||||||
membership = MembershipSetting.active.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.active.find_by_membership_type("paypar_url")
|
||||||
@@ -44,7 +44,7 @@ class Customer < ApplicationRecord
|
|||||||
# urltest =self.url_exist?(url)
|
# urltest =self.url_exist?(url)
|
||||||
if !membership.nil? && !memberaction.nil?
|
if !membership.nil? && !memberaction.nil?
|
||||||
begin
|
begin
|
||||||
response = HTTParty.get(url, :body => {
|
response = HTTParty.get(url, :body => {
|
||||||
membership_id: customer.membership_id,
|
membership_id: customer.membership_id,
|
||||||
merchant_uid:merchant_uid,
|
merchant_uid:merchant_uid,
|
||||||
type: "summary",
|
type: "summary",
|
||||||
@@ -57,7 +57,7 @@ class Customer < ApplicationRecord
|
|||||||
:timeout => 10)
|
:timeout => 10)
|
||||||
rescue HTTParty::Error
|
rescue HTTParty::Error
|
||||||
response = {status: false, message: "Server Error"}
|
response = {status: false, message: "Server Error"}
|
||||||
|
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false , message: "Server Time out"}
|
response = { status: false , message: "Server Time out"}
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ class Customer < ApplicationRecord
|
|||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
|
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
|
||||||
|
|
||||||
@customers.each do |customer|
|
@customers.each do |customer|
|
||||||
member_params = { name: customer.name,phone: customer.contact_no,
|
member_params = { name: customer.name,phone: customer.contact_no,
|
||||||
@@ -143,7 +143,7 @@ class Customer < ApplicationRecord
|
|||||||
paypar_account_no: customer.paypar_account_no,
|
paypar_account_no: customer.paypar_account_no,
|
||||||
card_no:customer.card_no,member_group_id: customer.membership_type,
|
card_no:customer.card_no,member_group_id: customer.membership_type,
|
||||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
|
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
@@ -154,7 +154,7 @@ class Customer < ApplicationRecord
|
|||||||
})
|
})
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false, message: "Server Time out" }
|
response = { status: false, message: "Server Time out" }
|
||||||
|
|
||||||
rescue OpenURI::HTTPError
|
rescue OpenURI::HTTPError
|
||||||
response = { status: false, message: "Can't connect server"}
|
response = { status: false, message: "Can't connect server"}
|
||||||
|
|
||||||
@@ -172,12 +172,12 @@ class Customer < ApplicationRecord
|
|||||||
def self.update_rebate
|
def self.update_rebate
|
||||||
sales = Sale.where("rebate_status = 'false'")
|
sales = Sale.where("rebate_status = 'false'")
|
||||||
sales.each do |sale|
|
sales.each do |sale|
|
||||||
if sale.customer.membership_id
|
if sale.customer.membership_id
|
||||||
response = self.rebat(Sale.find(sale.sale_id))
|
response = self.rebat(Sale.find(sale.sale_id))
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
if !response.nil?
|
if !response.nil?
|
||||||
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.amount_received} "
|
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.amount_received} "
|
||||||
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, 1)
|
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, 1)
|
||||||
end
|
end
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
status = sale.update_attributes(rebate_status: "true")
|
status = sale.update_attributes(rebate_status: "true")
|
||||||
@@ -190,7 +190,7 @@ class Customer < ApplicationRecord
|
|||||||
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
||||||
generic_customer_id = sObj.customer.membership_id
|
generic_customer_id = sObj.customer.membership_id
|
||||||
|
|
||||||
|
|
||||||
if generic_customer_id.present?
|
if generic_customer_id.present?
|
||||||
paypar = sObj.sale_payments
|
paypar = sObj.sale_payments
|
||||||
payparcost = 0
|
payparcost = 0
|
||||||
@@ -207,7 +207,7 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||||
overall_dis = sObj.total_discount
|
overall_dis = sObj.total_discount
|
||||||
|
|
||||||
if credit != 1
|
if credit != 1
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
|
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
|
||||||
@@ -218,8 +218,8 @@ class Customer < ApplicationRecord
|
|||||||
|
|
||||||
# Control for Paypar Cloud
|
# Control for Paypar Cloud
|
||||||
begin
|
begin
|
||||||
response = HTTParty.get(url,
|
response = HTTParty.get(url,
|
||||||
:body => {
|
:body => {
|
||||||
member_group_id:sObj.customer.membership_type,
|
member_group_id:sObj.customer.membership_type,
|
||||||
merchant_uid:merchant_uid,
|
merchant_uid:merchant_uid,
|
||||||
campaign_type_id: campaign_type_id,
|
campaign_type_id: campaign_type_id,
|
||||||
@@ -233,7 +233,7 @@ class Customer < ApplicationRecord
|
|||||||
response = { "status": false , "message": "Connect To" }
|
response = { "status": false , "message": "Connect To" }
|
||||||
rescue OpenURI::HTTPError
|
rescue OpenURI::HTTPError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
end
|
end
|
||||||
@@ -250,7 +250,7 @@ class Customer < ApplicationRecord
|
|||||||
response["membership_campaign_data"].each do |a|
|
response["membership_campaign_data"].each do |a|
|
||||||
data = {:type => a["rules_type"], :percentage => a["change_unit"].to_i * a["base_unit"].to_i}
|
data = {:type => a["rules_type"], :percentage => a["change_unit"].to_i * a["base_unit"].to_i}
|
||||||
total_percentage = total_percentage + a["change_unit"].to_i * a["base_unit"].to_i
|
total_percentage = total_percentage + a["change_unit"].to_i * a["base_unit"].to_i
|
||||||
|
|
||||||
type_arr.push(data)
|
type_arr.push(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -267,7 +267,7 @@ class Customer < ApplicationRecord
|
|||||||
actual = a[:amount] - amount
|
actual = a[:amount] - amount
|
||||||
data[:amount] = actual
|
data[:amount] = actual
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rebate_arr.push(data)
|
rebate_arr.push(data)
|
||||||
@@ -290,8 +290,8 @@ class Customer < ApplicationRecord
|
|||||||
|
|
||||||
# Control for Paypar Cloud
|
# Control for Paypar Cloud
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => {
|
:body => {
|
||||||
generic_customer_id:generic_customer_id ,
|
generic_customer_id:generic_customer_id ,
|
||||||
total_sale_transaction_amount: sObj.grand_total,
|
total_sale_transaction_amount: sObj.grand_total,
|
||||||
merchant_uid:merchant_uid,
|
merchant_uid:merchant_uid,
|
||||||
@@ -309,7 +309,7 @@ class Customer < ApplicationRecord
|
|||||||
response = { "status": false , "message": "Connect To" }
|
response = { "status": false , "message": "Connect To" }
|
||||||
rescue OpenURI::HTTPError
|
rescue OpenURI::HTTPError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
|
|
||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
end
|
end
|
||||||
@@ -320,7 +320,7 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts "no Response"
|
puts "no Response"
|
||||||
response = { "status": "no_member", "message": "Not membership"}
|
response = { "status": "no_member", "message": "Not membership"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -331,8 +331,8 @@ class Customer < ApplicationRecord
|
|||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
begin
|
begin
|
||||||
response = HTTParty.get(url,
|
response = HTTParty.get(url,
|
||||||
:body => { paypar_account_no:account_no,
|
:body => { paypar_account_no:account_no,
|
||||||
merchant_uid:merchant_uid,
|
merchant_uid:merchant_uid,
|
||||||
auth_token:auth_token
|
auth_token:auth_token
|
||||||
}.to_json,
|
}.to_json,
|
||||||
|
|||||||
@@ -171,7 +171,8 @@ class SalePayment < ApplicationRecord
|
|||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "Payment failed - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
remark = "Payment failed - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||||
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by.name)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by.name)
|
||||||
return false, "Payment failed"
|
# return false, "Payment failed"
|
||||||
|
return false, self.save,membership_data
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
@@ -303,8 +304,8 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
def self.create_payment(paypar_url,payment_type,membership_id,received_amount,sale_id)
|
def self.create_payment(paypar_url,payment_type,membership_id,received_amount,sale_id)
|
||||||
# membership_actions_data = MembershipAction.find_by_membership_type("create_payment");
|
# membership_actions_data = MembershipAction.find_by_membership_type("create_payment");
|
||||||
membership_actions_data = PaymentMethodSetting.find_by_payment_method(payment_type)
|
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
|
membership_actions_data = PaymentMethodSetting.find_by_payment_method_and_shop_code(payment_type,sale_data.shop_code)
|
||||||
customer_data = Customer.find_by_customer_id(sale_data.customer_id)
|
customer_data = Customer.find_by_customer_id(sale_data.customer_id)
|
||||||
if !membership_actions_data.nil?
|
if !membership_actions_data.nil?
|
||||||
|
|
||||||
@@ -543,7 +544,7 @@ class SalePayment < ApplicationRecord
|
|||||||
# if account_no.to_i <= 0
|
# if account_no.to_i <= 0
|
||||||
# account_no = customer_data.membership_id
|
# account_no = customer_data.membership_id
|
||||||
# end
|
# end
|
||||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",self.sale.shop_code)
|
||||||
membership_data = SalePayment.create_payment(membership_setting.gateway_url,"PAYMAL",account_no,self.received_amount,self.sale.sale_id)
|
membership_data = SalePayment.create_payment(membership_setting.gateway_url,"PAYMAL",account_no,self.received_amount,self.sale.sale_id)
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
@@ -686,7 +687,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
|
|
||||||
if MembershipSetting.find_by_rebate(1) && is_foc == 0 && is_credit == 0
|
if MembershipSetting.find_by_rebate_and_shop_code(1,self.sale.shop_code) && is_foc == 0 && is_credit == 0
|
||||||
response = rebat(sObj)
|
response = rebat(sObj)
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
@@ -845,8 +846,8 @@ class SalePayment < ApplicationRecord
|
|||||||
overall_dis = sObj.total_discount
|
overall_dis = sObj.total_discount
|
||||||
|
|
||||||
if credit != 1
|
if credit != 1
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sObj.shop_code)
|
||||||
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
|
memberaction = MembershipAction.find_by_membership_type_and_shop_code("get_member_campaign",sObj.shop_code)
|
||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
@@ -930,8 +931,8 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
if total_amount >= 0
|
if total_amount >= 0
|
||||||
receipt_no = sObj.receipt_no
|
receipt_no = sObj.receipt_no
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sObj.shop_code)
|
||||||
memberaction = MembershipAction.find_by_membership_type("rebate")
|
memberaction = MembershipAction.find_by_membership_type_and_shop_code("rebate",sObj.shop_code)
|
||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
@@ -962,7 +963,7 @@ class SalePayment < ApplicationRecord
|
|||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { "status": false, "message": "Can't connect server"}
|
response = { "status": false, "message": "Can't connect server"}
|
||||||
end
|
end
|
||||||
Rails.logger.debug "Rebage Response"
|
Rails.logger.debug "Rebate Response"
|
||||||
Rails.logger.debug response.to_json
|
Rails.logger.debug response.to_json
|
||||||
return response
|
return response
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ if @status == true
|
|||||||
json.id @order.id
|
json.id @order.id
|
||||||
json.booking_id @booking.id
|
json.booking_id @booking.id
|
||||||
json.order_items do
|
json.order_items do
|
||||||
json.array! @order.order_items, :item_code, :item_name, :qty, :options, :remark
|
json.array! @order.order_items, :item_code, :item_name, :qty, :options, :remark,:price
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
json.status :error
|
json.status :error
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
if @result && @cus
|
if @result && @cus
|
||||||
json.status true
|
json.status true
|
||||||
json.sent_pin true
|
json.sent_pin true
|
||||||
else
|
else
|
||||||
json.status false
|
json.status false
|
||||||
json.message "Customer Not Found"
|
json.message "Customer Not Found"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,7 +23,17 @@ module SXRestaurants
|
|||||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :sidekiq
|
||||||
config.time_zone = 'Asia/Rangoon'
|
config.time_zone = 'Asia/Rangoon'
|
||||||
|
|
||||||
|
config.middleware.insert_before ActionDispatch::Static, Rack::Cors do
|
||||||
|
allow do
|
||||||
|
origins '*'
|
||||||
|
resource(
|
||||||
|
'*',
|
||||||
|
headers: :any,
|
||||||
|
methods: [:get, :patch, :put, :delete, :post, :options]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
application_path="#{File.expand_path("../..", __FILE__)}"
|
# application_path="#{File.expand_path("../..", __FILE__)}"
|
||||||
directory application_path
|
# directory application_path
|
||||||
#environment ENV.fetch("RAILS_ENV") { "production" }
|
# #environment ENV.fetch("RAILS_ENV") { "production" }
|
||||||
environment "production"
|
# environment "production"
|
||||||
pidfile "#{application_path}/tmp/puma/pid"
|
# pidfile "#{application_path}/tmp/puma/pid"
|
||||||
state_path "#{application_path}/tmp/puma/state"
|
# state_path "#{application_path}/tmp/puma/state"
|
||||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||||
port ENV.fetch("PORT") { 62158 }
|
# port ENV.fetch("PORT") { 62158 }
|
||||||
workers 2
|
# workers 2
|
||||||
preload_app!
|
# preload_app!
|
||||||
threads 1,1
|
# threads 1,1
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddShopCodeMembershipAction < ActiveRecord::Migration[5.1]
|
||||||
|
def change
|
||||||
|
add_column :membership_actions, :shop_code, :string, :default => '262'
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user