kbzpay payment updated

This commit is contained in:
Zoey
2019-06-26 13:35:27 +06:30
parent 2e306a6339
commit 52a375f2a4
6 changed files with 35 additions and 17 deletions

View File

@@ -168,7 +168,7 @@ class Origami::PaymentsController < BaseOrigamiController
# salePayment = SalePayment.find(sale_payment_id) # salePayment = SalePayment.find(sale_payment_id)
# salePayment.process_kbz_payment(salePayment.sale_id, sale_data.grand_total, cash, 'paid') # salePayment.process_kbz_payment(salePayment.sale_id, sale_data.grand_total, cash, 'paid')
# else # else
# sp = SalePayment.where('sale_id=? and payment_method=? and payment_status=?', sale_id, 'kbzpay', 'paid').last sp = SalePayment.where('sale_id=? and payment_method=? and payment_status=?', sale_id, 'kbzpay', 'paid').last
if is_kbz == 'false' if is_kbz == 'false'
Rails.logger.info '################ CASH PAYMENT #################' Rails.logger.info '################ CASH PAYMENT #################'
sale_payment = SalePayment.new sale_payment = SalePayment.new
@@ -177,6 +177,8 @@ class Origami::PaymentsController < BaseOrigamiController
else else
sale_payment.process_payment(saleObj, current_user, cash, "cash") sale_payment.process_payment(saleObj, current_user, cash, "cash")
end end
else
sp.kbz_edit_sale_payment(sp.received_amount.to_f, current_user)
end end
# end # end

View File

@@ -177,6 +177,11 @@ class SalePayment < ApplicationRecord
end end
def kbz_edit_sale_payment(amt, action_by)
self.action_by = action_by
sale_update_payment_status(amt)
end
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token) def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
# Control for Paypar Cloud # Control for Paypar Cloud
begin begin
@@ -625,7 +630,7 @@ class SalePayment < ApplicationRecord
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
self.payment_status = "paid" self.payment_status = "paid"
payment_status = self.save! payment_status = self.save!
sale_update_payment_status(self.received_amount) # sale_update_payment_status(self.received_amount)
return payment_status return payment_status
end end

View File

@@ -157,6 +157,7 @@ class ShiftSale < ApplicationRecord
SUM(case when (sale_payments.payment_method='jcb') then (sale_payments.payment_amount) else 0 end) as jcb_amount, SUM(case when (sale_payments.payment_method='jcb') then (sale_payments.payment_amount) else 0 end) as jcb_amount,
SUM(case when (sale_payments.payment_method='unionpay') then (sale_payments.payment_amount) else 0 end) as unionpay_amount, SUM(case when (sale_payments.payment_method='unionpay') then (sale_payments.payment_amount) else 0 end) as unionpay_amount,
SUM(case when (sale_payments.payment_method='alipay') then (sale_payments.payment_amount) else 0 end) as alipay_amount, SUM(case when (sale_payments.payment_method='alipay') then (sale_payments.payment_amount) else 0 end) as alipay_amount,
SUM(case when (sale_payments.payment_method='KBZPay') then (sale_payments.payment_amount) else 0 end) as kbzpay_amount,
SUM(case when (sale_payments.payment_method='dinga') then (sale_payments.payment_amount) else 0 end) as dinga_amount, SUM(case when (sale_payments.payment_method='dinga') then (sale_payments.payment_amount) else 0 end) as dinga_amount,
SUM(case when (sale_payments.payment_method='giftvoucher') then (sale_payments.payment_amount) else 0 end) as giftvoucher_amount, SUM(case when (sale_payments.payment_method='giftvoucher') then (sale_payments.payment_amount) else 0 end) as giftvoucher_amount,
SUM(case when (sale_payments.payment_method='JunctionPay') then (sale_payments.payment_amount) else 0 end) as junctionpay_amount, SUM(case when (sale_payments.payment_method='JunctionPay') then (sale_payments.payment_amount) else 0 end) as junctionpay_amount,

View File

@@ -244,6 +244,16 @@ class CloseCashierPdf < Prawn::Document
end end
end end
if other.kbzpay_amount && other.kbzpay_amount.to_f > 0
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "KBZ Payment :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "#{ number_with_precision(other.kbzpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right
end
end
if other.junctionpay_amount && other.junctionpay_amount.to_f > 0 if other.junctionpay_amount && other.junctionpay_amount.to_f > 0
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do

View File

@@ -21,11 +21,11 @@ class ActionController::Base
end end
else else
# check for license file # check for license file
# if check_license if check_license
# current_license(ENV["SX_PROVISION_URL"]) current_license(ENV["SX_PROVISION_URL"])
# else else
# redirect_to activate_path redirect_to activate_path
# end end
end end
end end

View File

@@ -1,10 +1,10 @@
# 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!