From 0e7db08bfc59c3e7fe1c0e098dbc6e6a9acf3d5f Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 7 Aug 2018 16:27:32 +0630 Subject: [PATCH] update process payment for current user --- app/controllers/api/payments_controller.rb | 24 +++++++++---------- app/controllers/origami/alipay_controller.rb | 2 +- .../origami/credit_payments_controller.rb | 2 +- app/controllers/origami/dinga_controller.rb | 2 +- .../origami/gift_voucher_controller.rb | 2 +- app/controllers/origami/jcb_controller.rb | 2 +- .../origami/junction_pay_controller.rb | 2 +- app/controllers/origami/master_controller.rb | 2 +- app/controllers/origami/mpu_controller.rb | 2 +- app/controllers/origami/paymal_controller.rb | 2 +- .../origami/payments_controller.rb | 2 +- .../origami/paypar_payments_controller.rb | 2 +- .../origami/unionpay_controller.rb | 2 +- app/controllers/origami/visa_controller.rb | 2 +- app/controllers/origami/voucher_controller.rb | 2 +- app/models/order_reservation.rb | 2 +- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb index 459589ed..53c1fba2 100755 --- a/app/controllers/api/payments_controller.rb +++ b/app/controllers/api/payments_controller.rb @@ -33,68 +33,68 @@ class Api::PaymentsController < ActionController::API when "cash" sale_payment.payment_method = "cash" sale_payment.received_amount = params[:amount] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "creditnote" sale_payment.payment_method = "creditnote" sale_payment.received_amount = params[:amount] sale_payment.customer_id = params[:customer_id] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "visa" sale_payment.payment_method = "visa" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "master" sale_payment.payment_method = "master" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "jcb" sale_payment.payment_method = "jcb" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "mpu" sale_payment.payment_method = "mpu" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "unionpay" sale_payment.payment_method = "unionpay" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "vochure" sale_payment.payment_method = "vochure" sale_payment.received_amount = params[:amount] sale_payment.customer_id = params[:customer_id] sale_payment.payment_reference = params[:vochure_no] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "giftcard" sale_payment.payment_method = "giftcard" sale_payment.received_amount = params[:amount] sale_payment.customer_id = params[:customer_id] sale_payment.payment_reference = params[:giftcard_no] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "paypar" sale_payment.payment_method = "paypar" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] #TODO: implement paypar implementation - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "JunctionPay" sale_payment.payment_method = "JunctionPay" sale_payment.received_amount = params[:amount] sale_payment.customer_id = params[:customer_id] sale_payment.payment_reference = params[:vochure_no] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) when "alipay" sale_payment.payment_method = "alipay" sale_payment.received_amount = params[:amount] sale_payment.payment_reference = params[:payment_reference] - @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name) + @status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee) end end end diff --git a/app/controllers/origami/alipay_controller.rb b/app/controllers/origami/alipay_controller.rb index 1d2e01ae..8c5f4884 100644 --- a/app/controllers/origami/alipay_controller.rb +++ b/app/controllers/origami/alipay_controller.rb @@ -81,7 +81,7 @@ class Origami::AlipayController < BaseOrigamiController end sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "alipay",ref_no,payment_for) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "alipay",ref_no,payment_for) end end diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index ba67093f..6a885f7b 100755 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -44,7 +44,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController saleObj = Sale.find(sale_id) remark = "credit payment for Receipt No #{saleObj.receipt_no}" sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "creditnote",remark) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "creditnote",remark) end end diff --git a/app/controllers/origami/dinga_controller.rb b/app/controllers/origami/dinga_controller.rb index c10b9630..be35a5c1 100644 --- a/app/controllers/origami/dinga_controller.rb +++ b/app/controllers/origami/dinga_controller.rb @@ -86,7 +86,7 @@ def create # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - status, @sale,@membership_data = sale_payment.process_payment(saleObj, current_user.name, cash, "dinga",account_no) + status, @sale,@membership_data = sale_payment.process_payment(saleObj, current_user, cash, "dinga",account_no) if status == true && @membership_data["status"] == true @out = true, "Success!" diff --git a/app/controllers/origami/gift_voucher_controller.rb b/app/controllers/origami/gift_voucher_controller.rb index 25c6f988..572e248e 100644 --- a/app/controllers/origami/gift_voucher_controller.rb +++ b/app/controllers/origami/gift_voucher_controller.rb @@ -59,7 +59,7 @@ class Origami::GiftVoucherController < BaseOrigamiController # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "GiftVoucher",ref_no) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "GiftVoucher",ref_no) end end diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index dea16cef..1f979adc 100644 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -82,7 +82,7 @@ class Origami::JcbController < BaseOrigamiController payment_for = true end sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "jcb",ref_no,payment_for) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "jcb",ref_no,payment_for) end end diff --git a/app/controllers/origami/junction_pay_controller.rb b/app/controllers/origami/junction_pay_controller.rb index 67695603..c77c2655 100644 --- a/app/controllers/origami/junction_pay_controller.rb +++ b/app/controllers/origami/junction_pay_controller.rb @@ -63,7 +63,7 @@ class Origami::JunctionPayController < BaseOrigamiController # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "JunctionPay", remarks) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "JunctionPay", remarks) end end diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index 48221d0a..15edb703 100644 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -79,7 +79,7 @@ class Origami::MasterController < BaseOrigamiController payment_for = true end sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "master",ref_no,payment_for) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "master",ref_no,payment_for) end end diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index 8301ee59..220219c3 100644 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -80,7 +80,7 @@ class Origami::MpuController < BaseOrigamiController payment_for = true end sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "mpu",ref_no,payment_for) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "mpu",ref_no,payment_for) end end diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb index e9d3cb6c..911d5a24 100644 --- a/app/controllers/origami/paymal_controller.rb +++ b/app/controllers/origami/paymal_controller.rb @@ -88,7 +88,7 @@ def create # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - status, @sale,@membership_data = sale_payment.process_payment(saleObj, @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 @out = true, "Success!" else diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index e6bb4811..a01e30df 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -537,7 +537,7 @@ class Origami::PaymentsController < BaseOrigamiController saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0) sale_payment = SalePayment.new - sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark) + sale_payment.process_payment(saleObj, current_user, cash, "foc" ,remark) bookings = Booking.where("sale_id='#{sale_id}'") if bookings[0].dining_facility_id.to_i > 0 diff --git a/app/controllers/origami/paypar_payments_controller.rb b/app/controllers/origami/paypar_payments_controller.rb index aa90bb59..fbcd348c 100755 --- a/app/controllers/origami/paypar_payments_controller.rb +++ b/app/controllers/origami/paypar_payments_controller.rb @@ -17,7 +17,7 @@ class Origami::PayparPaymentsController < BaseOrigamiController end sale_payment = SalePayment.new - status,msg =sale_payment.process_payment(saleObj, current_user.name, redeem_amount,payment_method) + status,msg =sale_payment.process_payment(saleObj, current_user, redeem_amount,payment_method) if status == true @out = true, "Success!" else diff --git a/app/controllers/origami/unionpay_controller.rb b/app/controllers/origami/unionpay_controller.rb index 8ab0fcd0..b351d40a 100644 --- a/app/controllers/origami/unionpay_controller.rb +++ b/app/controllers/origami/unionpay_controller.rb @@ -78,7 +78,7 @@ class Origami::UnionpayController < BaseOrigamiController payment_for = true end sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "unionpay",ref_no,payment_for) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "unionpay",ref_no,payment_for) end end diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index cb0652f0..c50339e4 100644 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -78,7 +78,7 @@ class Origami::VisaController < BaseOrigamiController payment_for = true end sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "visa",ref_no,payment_for) + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "visa",ref_no,payment_for) end end diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index c03bd198..74b35b3c 100755 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -73,7 +73,7 @@ class Origami::VoucherController < BaseOrigamiController if( response["status"]==true ) saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, current_user.name, cash, "voucher") + @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "voucher") end end end diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb index 9fbc7e4d..ae874c72 100644 --- a/app/models/order_reservation.rb +++ b/app/models/order_reservation.rb @@ -161,7 +161,7 @@ class OrderReservation < ApplicationRecord #end rounding adjustment sale_payment = SalePayment.new - sale_payment.process_payment(saleObj, current_user.name, saleObj.grand_total, "cash") + sale_payment.process_payment(saleObj, current_user, saleObj.grand_total, "cash") #order status send to doemal callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED)