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,20 @@ class Origami::VisaController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
# limit visa_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
@visacount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "visa"
@visacount = @visacount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_visa = total - @visacount - others
end
def create