diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index ca021430..715a9fe1 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -361,6 +361,7 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port,cashier_type) { $("#loading_wrapper").hide(); var jobj = $.parseJSON(resMsg); + $("#reference_no").val(jobj.REFNUM); if(jobj.STATUS == "Approved"){ $.ajax({type: "POST", url: "/origami/payment/"+payment_type, diff --git a/app/views/origami/alipay/index.html.erb b/app/views/origami/alipay/index.html.erb index abd065fb..5552d3f8 100755 --- a/app/views/origami/alipay/index.html.erb +++ b/app/views/origami/alipay/index.html.erb @@ -204,8 +204,7 @@ var bank_integration = "<%= @bank_integration %>"; var cashier_type = "<%= @cashier_type %>"; $("#reference_no_Err").html(""); - if(reference_no.length > 0){ - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ $(this).off("click"); //start member discount 5% by pay card // var sub_total = $('#sub-total').text(); @@ -244,15 +243,12 @@ }); } - }else{ - if (amount>0) { - swal ( "Oops" , "Paid Amount is over!" , "error" ); - }else{ - swal ( "Oops" , "Enter Amount!" , "error" ); - } - } - }else{ - $("#reference_no_Err").html("can't be blank"); + }else{ + if (amount>0) { + swal ( "Oops" , "Paid Amount is over!" , "error" ); + }else{ + swal ( "Oops" , "Enter Amount!" , "error" ); + } } }) diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb index 51481148..28d6a4d8 100755 --- a/app/views/origami/jcb/index.html.erb +++ b/app/views/origami/jcb/index.html.erb @@ -200,8 +200,7 @@ $('#jcb_pay').on('click',function(){ var receipt_no = "<%= @receipt_no %>"; var bank_integration = "<%= @bank_integration %>"; $("#reference_no_Err").html(""); - if(reference_no.length > 0){ - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ $(this).off("click"); //start member discount 5% by pay card // var sub_total = $('#sub-total').text(); @@ -247,8 +246,5 @@ $('#jcb_pay').on('click',function(){ swal ( "Oops" , "Enter Amount!" , "error" ); } } - }else{ - $("#reference_no_Err").html("can't be blank"); - } }) diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb index 38237f1a..301452b8 100755 --- a/app/views/origami/master/index.html.erb +++ b/app/views/origami/master/index.html.erb @@ -198,7 +198,6 @@ var receipt_no = "<%= @receipt_no %>"; var bank_integration = "<%= @bank_integration %>"; $("#reference_no_Err").html(""); - if(reference_no.length > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ $(this).off("click"); @@ -245,8 +244,5 @@ swal ( "Oops" , "Enter Amount!" , "error" ); } } - }else{ - $("#reference_no_Err").html("can't be blank"); - } }) diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb index f0115c0e..3edb1f7a 100755 --- a/app/views/origami/mpu/index.html.erb +++ b/app/views/origami/mpu/index.html.erb @@ -204,9 +204,8 @@ var bank_integration = "<%= @bank_integration %>"; var cashier_type = "<%= @cashier_type %>"; $("#reference_no_Err").html(""); - if(reference_no.length > 0){ - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ - $(this).off("click"); + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + $(this).off("click"); //start member discount 5% by pay card // var sub_total = $('#sub-total').text(); // var member_id = $('#membership_id').text(); @@ -244,15 +243,12 @@ }); } - }else{ - if (amount>0) { - swal ( "Oops" , "Paid Amount is over!" , "error" ); - }else{ - swal ( "Oops" , "Enter Amount!" , "error" ); - } - } - }else{ - $("#reference_no_Err").html("can't be blank"); + }else{ + if (amount>0) { + swal ( "Oops" , "Paid Amount is over!" , "error" ); + }else{ + swal ( "Oops" , "Enter Amount!" , "error" ); + } } }) diff --git a/app/views/origami/unionpay/index.html.erb b/app/views/origami/unionpay/index.html.erb index 250f97d1..73b7001c 100755 --- a/app/views/origami/unionpay/index.html.erb +++ b/app/views/origami/unionpay/index.html.erb @@ -202,7 +202,6 @@ var receipt_no = "<%= @receipt_no %>"; $("#reference_no_Err").html(""); - if(reference_no.length > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ $(this).off("click"); //start member discount 5% by pay card @@ -250,8 +249,5 @@ swal ( "Oops" , "Enter Amount!" , "error" ); } } - }else{ - $("#reference_no_Err").html("can't be blank"); - } }) diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb index 52d14c4b..a03a886b 100755 --- a/app/views/origami/visa/index.html.erb +++ b/app/views/origami/visa/index.html.erb @@ -201,9 +201,8 @@ var receipt_no = "<%= @receipt_no %>"; console.log(amount); console.log($("#validamount").attr("value")); - $("#reference_no_Err").html(""); - if(reference_no.length > 0){ - if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ + $("#reference_no_Err").html(""); + if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ $(this).off("click"); //start member discount 5% by pay card // var sub_total = $('#sub-total').text(); @@ -244,14 +243,11 @@ }); } }else{ - if (amount>0) { - swal ( "Oops" , "Paid Amount is over!" , "error" ); - }else{ - swal ( "Oops" , "Enter Amount!" , "error" ); - } + if (amount>0) { + swal ( "Oops" , "Paid Amount is over!" , "error" ); + }else{ + swal ( "Oops" , "Enter Amount!" , "error" ); } - }else{ - $("#reference_no_Err").html("can't be blank"); } });