Limit paid amount for JCB, Visa and Master Card

This commit is contained in:
Phyo
2017-06-14 17:13:43 +06:30
parent af623cb474
commit 3b99016f80
11 changed files with 264 additions and 48 deletions

View File

@@ -2,6 +2,21 @@ class Origami::JcbController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
# limit jcb_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
@jcbcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "jcb"
@jcbcount = @jcbcount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_jcb = total - @jcbcount - others
end
def create