From 9f0bef732eb530afa2a3912a1f14b6947fb4b1db Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 14:23:23 +0630 Subject: [PATCH 01/16] update change version v3 for api paymal --- app/controllers/crm/customers_controller.rb | 6 +++--- app/controllers/origami/discounts_controller.rb | 2 +- app/controllers/origami/payments_controller.rb | 6 +++--- app/controllers/origami/voucher_controller.rb | 2 +- app/models/customer.rb | 12 ++++++------ app/models/sale_payment.rb | 11 ++++++----- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 83a437a2..55eed487 100755 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -143,7 +143,7 @@ class Crm::CustomersController < BaseCrmController :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -269,7 +269,7 @@ end :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -328,7 +328,7 @@ end :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 24b2c83f..0c2fbef5 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -273,7 +273,7 @@ class Origami::DiscountsController < BaseOrigamiController auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue HTTParty::Error response = {"status": false, "message": "Can't open membership server " } diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 563decfe..a5a96e43 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -63,9 +63,9 @@ class Origami::PaymentsController < BaseOrigamiController # get member information rebate = MembershipSetting.find_by_rebate(1) if customer.membership_id != nil && rebate - member_info = Customer.get_member_account(customer) - current_balance = SaleAudit.paymal_search(sale_id) - # current_balance = 0 + # member_info = Customer.get_member_account(customer) + # current_balance = SaleAudit.paymal_search(sale_id) + current_balance = 0 end # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index 750189df..c0a9e96d 100755 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -54,7 +54,7 @@ class Origami::VoucherController < BaseOrigamiController }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) rescue Net::OpenTimeout diff --git a/app/models/customer.rb b/app/models/customer.rb index fcdd7f31..59ab8841 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -31,7 +31,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue HTTParty::Error @@ -68,7 +68,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -121,7 +121,7 @@ class Customer < ApplicationRecord :body => member_params, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }) rescue Net::OpenTimeout response = { status: false, message: "Server Time out" } @@ -198,7 +198,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": "Connect To" } @@ -274,7 +274,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": "Connect To" } @@ -309,7 +309,7 @@ class Customer < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 1866a630..5809dc0f 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -85,7 +85,7 @@ class SalePayment < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) rescue Net::OpenTimeout @@ -133,7 +133,7 @@ class SalePayment < ApplicationRecord auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10 ) @@ -455,7 +455,7 @@ class SalePayment < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": " Connection timeout" } @@ -500,7 +500,8 @@ class SalePayment < ApplicationRecord end rebate_arr.push(data) end - + Rails.logger.debug "Rebage Response" + Rails.logger.debug rebate_arr.to_json total_amount = rebate_prices - payparcost - overall_dis if credit == 1 @@ -531,7 +532,7 @@ class SalePayment < ApplicationRecord }.to_json, :headers => { 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=2' + 'Accept' => 'application/json; version=3' }, :timeout => 10) rescue Net::OpenTimeout response = { "status": false , "message": "Connect To" } From a95fc4d07a30da09dad8c80131471f080103b922 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 14:43:58 +0630 Subject: [PATCH 02/16] update payment controller if member --- app/controllers/origami/payments_controller.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index a5a96e43..79c084a6 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -152,8 +152,17 @@ class Origami::PaymentsController < BaseOrigamiController if customer.membership_id != nil && rebate && credit_data.nil? member_info = Customer.get_member_account(customer) - rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) - current_balance = SaleAudit.paymal_search(sale_id) + puts member_info["status"] + if member_info["status"] == true + rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + current_balance = SaleAudit.paymal_search(sale_id) + else + rebate_amount = 0 + current_balance = 0 + member_info =nil + end + # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) + # current_balance = SaleAudit.paymal_search(sale_id) end #for card sale data From bf1b7ecb561334405c8601bdeb9206965604ea8b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 14:59:23 +0630 Subject: [PATCH 03/16] update payment controller if member --- app/controllers/origami/payments_controller.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 79c084a6..4508c582 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -152,17 +152,10 @@ class Origami::PaymentsController < BaseOrigamiController if customer.membership_id != nil && rebate && credit_data.nil? member_info = Customer.get_member_account(customer) - puts member_info["status"] if member_info["status"] == true rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) current_balance = SaleAudit.paymal_search(sale_id) - else - rebate_amount = 0 - current_balance = 0 - member_info =nil end - # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) - # current_balance = SaleAudit.paymal_search(sale_id) end #for card sale data From 44389d485a4ac3ec4866e7546f523ed51b129eea Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Mar 2018 17:38:25 +0630 Subject: [PATCH 04/16] update request bill reload in quick service --- app/controllers/origami/request_bills_controller.rb | 8 +++++--- app/views/origami/pending_order/show.html.erb | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 409177fe..f6dd4e14 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -8,9 +8,7 @@ class Origami::RequestBillsController < ApplicationController if !ShiftSale.current_shift.nil? order_id = params[:id] # order_id bk_order = BookingOrder.find_by_order_id(order_id) - puts params[:id] - puts bk_order - puts bk_order.booking_id + order = Order.find(order_id) check_booking = Booking.find_by_booking_id(bk_order.booking_id) if check_booking.sale_id.nil? @@ -29,6 +27,10 @@ class Origami::RequestBillsController < ApplicationController # Promotion Activation Promotion.promo_activate(@sale) + if order.source == "quick_service" + result = {:status=> @status, :data => @sale.sale_id } + render :json => result.to_json + end else @status = false @error_message = "No Current Open Shift for This Employee" diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb index fade7ccb..d7c929f7 100644 --- a/app/views/origami/pending_order/show.html.erb +++ b/app/views/origami/pending_order/show.html.erb @@ -203,11 +203,12 @@ $(document).ready(function(){ url: ajax_url, // data: 'order_id='+ order_id, success: function (result) { + console.log(result) if (!result.status) { swal("Information!", result.error_message); } else { - location.reload(); + window.location.href = '../pending_order/'+ result.data; } } }); From b836bffb90b6d0d9cf00e6957a31d3961d12268e Mon Sep 17 00:00:00 2001 From: phyusin Date: Wed, 14 Mar 2018 12:15:56 +0630 Subject: [PATCH 05/16] change payment member UI --- app/views/origami/payments/show.html.erb | 23 +++++-------------- .../20170628103624_create_print_settings.rb | 4 ++-- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index ee006c3a..46c7b2ba 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -424,27 +424,16 @@