Pull from master

This commit is contained in:
San Wai Lwin
2018-06-07 11:05:19 +06:30
parent fb0e832ea6
commit a5c59640d6
15 changed files with 484 additions and 298 deletions

View File

@@ -6,8 +6,8 @@ $(function() {
//click menu sidebar menu category //click menu sidebar menu category
$(".product").on("click", function(){ $(".product").on("click", function(){
var url = $(this).attr('data-ref'); // /var url = $(this).attr('data-ref');
show_product_list(url); // /show_product_list(url);
}); });
//show menu item list when click menu category //show menu item list when click menu category
function show_product_list(url_item){ function show_product_list(url_item){
@@ -24,6 +24,7 @@ $(function() {
if (type ==-1 && modify_order == -1){ if (type ==-1 && modify_order == -1){
url_item = url_item url_item = url_item
} }
console.log(url_item)
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
type: "GET", type: "GET",
@@ -56,16 +57,17 @@ $(function() {
image_path = "/image/logo.png"; image_path = "/image/logo.png";
} }
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">' row = '<div class="col-md-3">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">' +'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
+'<div class="col-md-10">'+ product[field].name +'</div>' +'<div class="col-md-10">'+ product[field].name +'</div>'
+"<div class='col-md-2 menu_item_box' data-item-code='" +"<div class='col-md-2 menu_item_box' data-item-code='"
+ product[field].item_code +"' data-instance = '" + product[field].item_code +"' data-instance = '"
+JSON.stringify(item_attributes)+"' data-id = '" +JSON.stringify(item_attributes)+"' data-id = '"
+JSON.stringify(item_attributes)+"' data-item = '" +JSON.stringify(item_attributes)+"' data-item = '"
+JSON.stringify(item_attributes)+"' data-option = '" +JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(product[field].options)+"'data-opt = '" +JSON.stringify(options)+"'data-opt = '"
+JSON.stringify(product[field].options)+"' data-item-sets = '" +JSON.stringify(options)+"' data-item-sets = '"
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>" +JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
+"<i class='fa fa-bars material-icons m-l--10'>" +"<i class='fa fa-bars material-icons m-l--10'>"
+'view_list</i>' +'view_list</i>'
@@ -78,8 +80,8 @@ $(function() {
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '" + product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '" + product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '" + JSON.stringify(item_attributes) +"' data-options = '"
+ JSON.stringify(product[field].options) +"' data-opt = '" + JSON.stringify(options) +"' data-opt = '"
+ JSON.stringify(product[field].options) +"' data-image='"+image_path+"'>" + JSON.stringify(options) +"' data-image='"+image_path+"'>"
// +"<div class='card-block custom-card-block'>" // +"<div class='card-block custom-card-block'>"
// +"<img id='logo' height='125px' src='"+image_path+"'>" // +"<img id='logo' height='125px' src='"+image_path+"'>"
@@ -88,6 +90,7 @@ $(function() {
+'<div class="card-footer custom-card-footer">' +'<div class="card-footer custom-card-footer">'
+'<span>'+ product[field].unit_price +'</span>' +'<span>'+ product[field].unit_price +'</span>'
+'</div>' +'</div>'
+'</div>'
+'</div>'; +'</div>';
$('.menu_items_list').append(row); $('.menu_items_list').append(row);
} }
@@ -500,6 +503,7 @@ $(function() {
//click item row for add order //click item row for add order
$(document).on('click', '.menu_item_box', function(event){ $(document).on('click', '.menu_item_box', function(event){
$('.attributes-list').empty(); $('.attributes-list').empty();
$('.options-list').empty(); $('.options-list').empty();
$('#modal_box_img').empty(); $('#modal_box_img').empty();
@@ -515,7 +519,6 @@ $(function() {
$('.add_to_order').removeAttr('data-options'); $('.add_to_order').removeAttr('data-options');
$('#count').val(1); $('#count').val(1);
change_qty_plus_minus("count","plus","minus"); change_qty_plus_minus("count","plus","minus");
// data = $(this).parent().children().children('.add_icon'); // data = $(this).parent().children().children('.add_icon');

View File

@@ -168,4 +168,4 @@ function audioPlayBackground(shop_code,audio){
audio.play(); audio.play();
// },10000); // },10000);
} }
/* end order reservation function */ /* end order reservation function */

View File

@@ -1,3 +1,5 @@
//= require custom.js
$(function() { $(function() {
$("#discount").hide(); $("#discount").hide();
$(".expected_time").hide(); $(".expected_time").hide();
@@ -307,8 +309,8 @@ function show_order_detail(url,sr_no){
item_price = items[i].unit_price; item_price = items[i].unit_price;
} }
var total = items[i].qty * item_price; var total = items[i].qty * item_price;
if(items[i].options!='[]'){ if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){
row = '<tr>' row = '<tr>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name +'<td width ="70%" class="body-td align-left">'+items[i].item_name
+' <br>' +' <br>'
+' <i><span class="font-12">'+items[i].options+'</span></i><br>'+ +' <i><span class="font-12">'+items[i].options+'</span></i><br>'+

View File

@@ -15,7 +15,6 @@
//= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/turbolink_admin.js
//= require BSBMaterial/demo.js //= require BSBMaterial/demo.js
//= require custom.js //= require custom.js
//= require order_reservation.js
/* Constant Varaibles */ /* Constant Varaibles */
_CREDIT_PAYMENTS_ = "/&nbsp;&nbsp;&nbsp;CREDIT PAYMENTS"; _CREDIT_PAYMENTS_ = "/&nbsp;&nbsp;&nbsp;CREDIT PAYMENTS";

View File

@@ -14,14 +14,20 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
end end
if status if status
check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal') if params[:customer_id] && !params[:customer_id].nil?
if !check_customer.nil? customer = OrderReservation.addCustomer(params)
customer_id = check_customer.customer_id customer_id = customer.customer_id
else else
customer = OrderReservation.addCustomer(params) check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal')
customer_id = customer.id if !check_customer.nil?
customer_id = check_customer.customer_id
else
customer = OrderReservation.addCustomer(params)
customer_id = customer.customer_id
end
end end
if !customer_id.nil?
if customer_id.nil?
render :json => { :status => false, :message => "email and customer are already existed!" } render :json => { :status => false, :message => "email and customer are already existed!" }
else else
render :json => { :status => true, :data => { :customer_id => customer_id} } render :json => { :status => true, :data => { :customer_id => customer_id} }

View File

@@ -98,14 +98,154 @@ class Crm::CustomersController < BaseCrmController
# POST /crm/customers.json # POST /crm/customers.json
def create def create
# Remove "" default first # Remove "" default first
params[:customer][:tax_profiles].delete_at(0) params[:customer][:tax_profiles].delete_at(0)
@crm_customers = Customer.new(customer_params) @checked_contact = Customer.find_by_contact_no(customer_params[:contact_no])
if @checked_contact.nil?
respond_to do |format|
@crm_customers = Customer.new(customer_params)
respond_to do |format| if @crm_customers.save
if @crm_customers.save # update tax profile
# update tax profile customer = Customer.find(@crm_customers.customer_id)
customer = Customer.find(@crm_customers.customer_id) customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles]) name = customer_params[:name]
phone = customer_params[:contact_no]
email = customer_params[:email]
dob = customer_params[:date_of_birth]
address = customer_params[:address]
nrc = customer_params[:nrc_no]
card_no = customer_params[:card_no]
paypar_account_no = customer_params[:paypar_account_no]
member_group_id = params[:member_group_id]
if member_group_id.present?
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
rescue HTTParty::Error
response = {"status" => false, "message" => "Can't open membership server "}
rescue Net::OpenTimeout
response = {"status" => false, "message" => "Can't open membership server "}
rescue OpenURI::HTTPError
response = {"status" => false, "message" => "Can't open membership server "}
rescue SocketError
response = {"status" => false, "message" => "Can't open membership server "}
end
Rails.logger.debug "--------------Create Member---------"
Rails.logger.debug response.to_json
if response["status"] == true
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' }
else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
end
# format.json { render :index, status: :created, location: @crm_customers }
else
customer = Customer.find(@crm_customers.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
# When paypar account no not exist in paypar
if response["message"] == "Account has not exist."
customer.destroy
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer cannot created.' + response["message"]}
else
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
end
end
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' + response["message"]}
else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response["message"] }
end
end
else
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created. noted'}
else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
end
end
else
if params[:sale_id]
flash[:errors] = @crm_customers.errors
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page]}
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
else
flash[:errors] = @crm_customers.errors
format.html { redirect_to crm_customers_path}
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
end
end
end
else
flash[:errors] = {"contact_no":["has already been taken"]}
respond_to do |format|
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page]}
else
format.html { redirect_to crm_customers_path}
end
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
end
end #end of contact no checked
end
# PATCH/PUT /crm/customers/1
# PATCH/PUT /crm/customers/1.json
def update
# Remove "" default first
params[:customer][:tax_profiles].delete_at(0)
@checked_contact = nil
@existed_contact = Customer.find_by_customer_id_and_contact_no(customer_params[:id], customer_params[:contact_no])
if @existed_contact.nil?
@checked_contact = Customer.find_by_contact_no(customer_params[:contact_no])
end
if !@existed_contact.nil? || @checked_contact.nil?
respond_to do |format|
if @crm_customer.update(customer_params)
# update tax profile
@crm_customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
name = customer_params[:name] name = customer_params[:name]
phone = customer_params[:contact_no] phone = customer_params[:contact_no]
email = customer_params[:email] email = customer_params[:email]
@@ -114,9 +254,10 @@ class Crm::CustomersController < BaseCrmController
nrc = customer_params[:nrc_no] nrc = customer_params[:nrc_no]
card_no = customer_params[:card_no] card_no = customer_params[:card_no]
paypar_account_no = customer_params[:paypar_account_no] paypar_account_no = customer_params[:paypar_account_no]
member_group_id = params[:member_group_id] id = @crm_customer.membership_id
member_group_id = params[:member_group_id]
if member_group_id.present? if !id.present? && !member_group_id.nil?
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer") memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s merchant_uid = memberaction.merchant_account_id.to_s
@@ -124,255 +265,139 @@ class Crm::CustomersController < BaseCrmController
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email, member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id, member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists # Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != '' # if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present? if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email, member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no, dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no, paypar_account_no: paypar_account_no,
member_group_id: member_group_id, member_group_id: member_group_id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json id:id,
end merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin begin
response = HTTParty.post(url, response = HTTParty.post(url,
:body => member_params, :body => member_params,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3' 'Accept' => 'application/json; version=3'
}, },
:timeout => 10 :timeout => 10
) )
rescue Net::OpenTimeout
response = { status: false }
rescue HTTParty::Error rescue OpenURI::HTTPError
response = {"status" => false, "message" => "Can't open membership server "} response = { status: false}
rescue Net::OpenTimeout rescue SocketError
response = {"status" => false, "message" => "Can't open membership server "} response = { status: false}
rescue OpenURI::HTTPError
response = {"status" => false, "message" => "Can't open membership server "}
rescue SocketError
response = {"status" => false, "message" => "Can't open membership server "}
end end
Rails.logger.debug "--------------Create Member---------" customer = Customer.find(@crm_customer.customer_id)
Rails.logger.debug "--------Update Member response -------"
Rails.logger.debug response.to_json Rails.logger.debug response.to_json
if response["status"] == true if response["status"] == true
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id ) status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
if params[:sale_id] format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' }
else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
end
# format.json { render :index, status: :created, location: @crm_customers }
else else
customer = Customer.find(@crm_customers.customer_id) # Check membership id and bind to user
if response["membership_id"] != nil
# Check membership id and bind to user status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
# When paypar account no not exist in paypar
if response["message"] == "Account has not exist."
customer.destroy
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer cannot created.' + response["message"]}
else
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
end
end
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created.' + response["message"]}
else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response["message"] }
end
end
else
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page], notice: 'Customer was successfully created. noted'}
else else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' } status = customer.update_attributes(membership_type:member_group_id)
end end
end
else
if params[:sale_id] format.html { redirect_to crm_customers_path, notice: response["error"] }
flash[:errors] = @crm_customers.errors end
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page]}
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
else else
flash[:errors] = @crm_customers.errors membership = MembershipSetting.find_by_membership_type("paypar_url")
format.html { redirect_to crm_customers_path} memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
format.json { render json: @crm_customers.errors, status: :unprocessable_entity } merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError
response = { status: false}
end
Rails.logger.debug "--------Update Member response -------"
Rails.logger.debug response.to_json
if response["status"] == true
customer = Customer.find(@crm_customer.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
else
customer = Customer.find(@crm_customer.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: response["message"] }
end
end end
end
end
end
# PATCH/PUT /crm/customers/1
# PATCH/PUT /crm/customers/1.json
def update
# Remove "" default first
params[:customer][:tax_profiles].delete_at(0)
respond_to do |format|
if @crm_customer.update(customer_params)
# update tax profile
@crm_customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
name = customer_params[:name]
phone = customer_params[:contact_no]
email = customer_params[:email]
dob = customer_params[:date_of_birth]
address = customer_params[:address]
nrc = customer_params[:nrc_no]
card_no = customer_params[:card_no]
paypar_account_no = customer_params[:paypar_account_no]
id = @crm_customer.membership_id
member_group_id = params[:member_group_id]
if !id.present? && !member_group_id.nil?
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError
response = { status: false}
end
customer = Customer.find(@crm_customer.customer_id)
Rails.logger.debug "--------Update Member response -------"
Rails.logger.debug response.to_json
if response["status"] == true
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
else
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
format.html { redirect_to crm_customers_path, notice: response["error"] }
end
else else
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError
response = { status: false}
end
Rails.logger.debug "--------Update Member response -------"
Rails.logger.debug response.to_json
if response["status"] == true
customer = Customer.find(@crm_customer.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
else
customer = Customer.find(@crm_customer.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: response["message"] }
end
flash[:errors] = @crm_customer.errors
format.html { redirect_to crm_customers_path}
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
end end
else
flash[:errors] = @crm_customer.errors
format.html { redirect_to crm_customers_path}
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
end end
else
flash[:errors] = {"contact_no":["has already been taken"]}
respond_to do |format|
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/'+params[:type]+'/customers/'+params[:page]}
else
format.html { redirect_to crm_customers_path}
end
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
end
end end
end end

View File

@@ -67,7 +67,7 @@ class HomeController < ApplicationController
redirect_to origami_root_path redirect_to origami_root_path
elsif @employee.role == "waiter" elsif @employee.role == "waiter"
session[:session_token] = @employee.token_session session[:session_token] = @employee.token_session
redirect_to origami_dashboard_path route_by_role(@employee)
elsif @employee.role == "account" elsif @employee.role == "account"
session[:session_token] = @employee.token_session session[:session_token] = @employee.token_session
redirect_to reports_dailysale_index_path redirect_to reports_dailysale_index_path

View File

@@ -25,15 +25,18 @@ class Origami::DashboardController < BaseOrigamiController
@sale_data = Array.new @sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(today,current_user) @total_payment_methods = Sale.total_payment_methods(today,current_user)
if !@total_payment_methods.nil?
@total_payment_methods.each do |payment| @total_payment_methods.each do |payment|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
pay = Sale.payment_sale('card', today, current_user) pay = Sale.payment_sale('card', today, current_user)
@sale_data.push({'card' => pay.payment_amount}) @sale_data.push({'card' => pay.payment_amount})
else else
pay = Sale.payment_sale(payment.payment_method, today, current_user) pay = Sale.payment_sale(payment.payment_method, today, current_user)
@sale_data.push({payment.payment_method => pay.payment_amount}) @sale_data.push({payment.payment_method => pay.payment_amount})
end end
end
else
@sale_data = nil
end end
@summ_sale = Sale.summary_sale_receipt(today,current_user) @summ_sale = Sale.summary_sale_receipt(today,current_user)
@total_customer = Sale.total_customer(today,current_user) @total_customer = Sale.total_customer(today,current_user)
@@ -45,12 +48,16 @@ class Origami::DashboardController < BaseOrigamiController
@total_order = Sale.total_order(today,current_user) @total_order = Sale.total_order(today,current_user)
@total_accounts = Sale.total_account(today,current_user) @total_accounts = Sale.total_account(today,current_user)
@account_data = Array.new @account_data = Array.new
@total_accounts.each do |account| if !@total_accounts.nil?
acc = Sale.account_data(account.account_id, today,current_user) @total_accounts.each do |account|
if !acc.nil? acc = Sale.account_data(account.account_id, today,current_user)
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc}) if !acc.nil?
end @account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end end
end
else
@account_data = nil
end
@top_items = Sale.top_items(today,current_user) @top_items = Sale.top_items(today,current_user)
@total_foc_items = Sale.total_foc_items(today,current_user) @total_foc_items = Sale.total_foc_items(today,current_user)

View File

@@ -10,7 +10,7 @@ class Customer < ApplicationRecord
has_many :sales has_many :sales
validates_presence_of :name, :contact_no, :email #,:card_no validates_presence_of :name, :contact_no, :email #,:card_no
validates :contact_no, uniqueness: true, numericality: true validates :contact_no, numericality: true #uniqueness: true,
validates :email, uniqueness: true,format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create } validates :email, uniqueness: true,format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
# validates :card_no, uniqueness: true # validates :card_no, uniqueness: true
# validates :paypar_account_no, uniqueness: true # validates :paypar_account_no, uniqueness: true

View File

@@ -57,9 +57,15 @@ class MenuCategory < ApplicationRecord
to = 24 to = 24
to = to * 3600 + to_t.min* 60 + to_t.sec to = to * 3600 + to_t.min* 60 + to_t.sec
else else
h += 24 h += 24
to = h*3600 + to_t.min* 60 + to_t.sec to = h*3600 + to_t.min* 60 + to_t.sec
c = current_t.hour
if c < 12
c +=24
current = c*3600 + current_t.min* 60 + current_t.sec
end
end end
else # (after) noon else # (after) noon
if h > 12 if h > 12
@@ -72,6 +78,7 @@ class MenuCategory < ApplicationRecord
day = Date.today.wday day = Date.today.wday
dayresult = menu.valid_days.include?(day.to_s) dayresult = menu.valid_days.include?(day.to_s)
if current.between?(from, to) && menu.valid_days.include?(day.to_s) if current.between?(from, to) && menu.valid_days.include?(day.to_s)
return true return true
else else
@@ -108,3 +115,7 @@ class MenuCategory < ApplicationRecord
end end
end end

View File

@@ -22,7 +22,11 @@ class OrderReservation < ApplicationRecord
else else
gender = "Male" gender = "Male"
end end
customer = Customer.new if params[:customer_id] && !params[:customer_id].nil?
customer = Customer.find(params[:customer_id])
else
customer = Customer.new
end
customer.name = params[:name] customer.name = params[:name]
customer.email = params[:email] customer.email = params[:email]
customer.contact_no = params[:contact_no] ? params[:contact_no] : '' customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
@@ -33,7 +37,6 @@ class OrderReservation < ApplicationRecord
customer.customer_type = "Doemal" customer.customer_type = "Doemal"
customer.tax_profiles = ["2"] customer.tax_profiles = ["2"]
customer.save customer.save
# unless customer.valid? # unless customer.valid?
# render json: { # render json: {
# status: 422, # status: 422,
@@ -319,13 +322,10 @@ class OrderReservation < ApplicationRecord
if order_reservation.length > 0 if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud' if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain from = request.subdomain + "." + request.domain
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code,from:from
else else
from = "" from = ""
end end
# if ENV["SERVER_MODE"] == 'cloud' ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code,from:from
# ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
# end
end end
end end
@@ -340,13 +340,10 @@ class OrderReservation < ApplicationRecord
if order_reservation.length > 0 if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud' if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain from = request.subdomain + "." + request.domain
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code,from:from
else else
from = "" from = ""
end end
# if ENV["SERVER_MODE"] == 'cloud' ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code,from:from
# ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
# end
end end
end end
@@ -361,10 +358,10 @@ class OrderReservation < ApplicationRecord
if order_reservation.length > 0 if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud' if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain from = request.subdomain + "." + request.domain
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code,from:from
else else
from = "" from = ""
end end
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code,from:from
end end
end end

View File

@@ -870,9 +870,9 @@ def self.get_item_query(type)
elsif type == "discount" elsif type == "discount"
sale_type = "i.status = 'Discount'" sale_type = "i.status = 'Discount'"
elsif type == "foc" elsif type == "foc"
sale_type = "i.status = 'foc' and i.qty > 0" sale_type = "i.status = 'foc' and i.item_instance_code IS NOT NULL and i.qty > 0"
elsif type == "void" elsif type == "void"
sale_type = "i.status = 'void' and i.qty > 0" sale_type = "i.status = 'void' and i.item_instance_code IS NOT NULL and i.qty > 0"
elsif type == "other" elsif type == "other"
sale_type = "i.item_instance_code IS NULL" sale_type = "i.item_instance_code IS NULL"
end end
@@ -907,12 +907,8 @@ end
def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type) def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
# date_type_selection = get_sql_function_for_report_type(report_type) # date_type_selection = get_sql_function_for_report_type(report_type)
if type == "other"
other_charges = self.get_other_charges() query = self.get_item_query(type)
query = self.get_item_query(type)
else
query = self.get_item_query(type)
end
discount_query = 0 discount_query = 0
total_card_amount = 0 total_card_amount = 0
@@ -921,12 +917,16 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
total_foc_amount = 0 total_foc_amount = 0
total_grand_total = 0 total_grand_total = 0
other_charges = self.get_other_charges() if type.nil? || type == 'all' || type == "other"
other_charges = self.get_other_charges()
end
product = self.get_product_sale() product = self.get_product_sale()
if shift.present? if shift.present?
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a) query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a) if type.nil? || type == 'all' || type == "other"
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
end
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a) product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
@@ -947,7 +947,9 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
### => get all sales range in shift_sales ### => get all sales range in shift_sales
elsif shift_sale_range.present? elsif shift_sale_range.present?
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a) query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a) if type.nil? || type == 'all' || type == "other"
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
end
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a) product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount) discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed) change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
@@ -968,7 +970,9 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
else else
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to) query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to) if type.nil? || type == 'all' || type == "other"
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
end
product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to) product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount) discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed) change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)

View File

@@ -35,7 +35,11 @@
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<strong>Customer :</strong> <strong>Customer :</strong>
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button> <% if @cashier_type == 'quick_service' %>
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button>
<% else %>
<span id="customer_name"><%= @sale_data.customer.name%></span>
<% end %>
<span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
<span class="hidden" id="member_discount"><%= @member_discount%></span></div> <span class="hidden" id="member_discount"><%= @member_discount%></span></div>
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %> <div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>

View File

@@ -169,14 +169,79 @@
<!-- Column Three --> <!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2"> <div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button> <button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button> <button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
<% if current_user.role != "waiter" %> <% if current_user.role != "waiter" %>
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button> <% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button> <% if current_user.role == "cashier" %>
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button> <a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<% end %>
<% end %>
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
<script> <script>
var cashier_type = "quick_service"; var cashier_type = "quick_service";
@@ -209,7 +274,70 @@ $(document).ready(function(){
$('#cash_out').on('click',function(){ $('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs'; window.location.href = '/origami/quick_service/cash_outs';
}) });
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
var remark = $("#remark").val();
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/quick_service';
}
});
}
});
}else{
swal("Opps","You are not authorized for void","warning")
}
});
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
}); });
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
// console.log(result);
if (result.status == true) {
createAccessCode(code);
if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script> </script>

View File

@@ -197,7 +197,7 @@ scope "(:locale)", locale: /en|mm/ do
post 'payment/voucher' => 'voucher_payments#create' post 'payment/voucher' => 'voucher_payments#create'
post 'payment/paymal' => 'paymal#create' post 'payment/paymal' => 'paymal#create'
post 'payment/alipay' => 'alipay#create' post 'payment/alipay' => 'alipay#create'
post 'payment/junctionpay' => 'junctionpay#create' post 'payment/junctionpay' => 'junction_pay#create'
post 'payment/dinga' => 'dinga#create' post 'payment/dinga' => 'dinga#create'
post 'payment/gift_voucher' => 'gift_voucher#create' post 'payment/gift_voucher' => 'gift_voucher#create'