add junctionpay(vaap)
This commit is contained in:
@@ -202,32 +202,48 @@ $('#junction_pay').on('click',function(){
|
||||
//end member discount
|
||||
$("#loading_wrapper").show();
|
||||
var com_port = '/dev/' + $("#com_port_name").val();
|
||||
var is_rebate=false;
|
||||
//alert(cashier_id + amount + com_port);
|
||||
code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port);
|
||||
|
||||
resJunctionPayUpdate(function(totalBillAmount , finalBillAmt,giftCardAmount,voucherAmount,voucherNumber,receiptNumber){
|
||||
code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port);
|
||||
resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount, voucherAmount,voucherNumber,receiptNumber){
|
||||
$("#loading_wrapper").hide();
|
||||
$.ajax({type: "POST",
|
||||
url: "/origami/payment/junctionpay",
|
||||
data: "amount="+ totalBillAmount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Payment Successfully",
|
||||
html: true,
|
||||
|
||||
var voucher_no = voucherNumber;
|
||||
if (voucher_no == ''){
|
||||
voucher_no = reference_no;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_junctionpay_path %>",
|
||||
data: "gift_amount="+ giftCardAmount + "&voucher_amount=" + voucherAmount +
|
||||
"&voucher_no=" + voucher_no + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
var desc = 'Payment Successfully';
|
||||
// is_rebate get from resJunctionPay and if member
|
||||
if(is_rebate){ desc = desc + ". And You get Rebate!"}
|
||||
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: desc,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// resJunctionPay(function(memberno,transactionNo,finalBillingAmt){
|
||||
resJunctionPay = function(memberno,transactionNo,finalBillingAmt){
|
||||
if(memberno != ''){ is_rebate = true; }
|
||||
};
|
||||
|
||||
|
||||
// $("#loading_wrapper").hide();
|
||||
// $.ajax({type: "POST",
|
||||
// url: "/origami/payment/"+payment_type,
|
||||
@@ -249,11 +265,36 @@ $('#junction_pay').on('click',function(){
|
||||
// });
|
||||
// });
|
||||
|
||||
resError(function(message){
|
||||
$("#loading_wrapper").hide();
|
||||
swal ( "Oops" , message , "error" );
|
||||
});
|
||||
// var resError = function(message){
|
||||
// console.log(message);
|
||||
// $("#loading_wrapper").hide();
|
||||
// swal ( "Oops" , message , "error" );
|
||||
// };
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// var resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount,voucherAmount, voucherNumber,receiptNumber){
|
||||
// $("#loading_wrapper").hide();
|
||||
// // alert(voucherNumber + ' ' + totalBillAmount + ' ' + receiptNumber + ' ' + giftCardAmount);
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "<%= origami_payment_junctionpay_path %>",
|
||||
// data: "amount="+ totalBillAmount + "&sale_id="+ sale_id,
|
||||
// success:function(result){
|
||||
// if(result){
|
||||
// swal({
|
||||
// title: "Information!",
|
||||
// text: "Payment Successfully",
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function () {
|
||||
// window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user