fixed confiixed for print
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -194,4 +194,135 @@ function deleteReceiptNoInFirstBillData(receipt_no) {
|
||||
localStorage.setItem("receipt_lists",JSON.stringify(json_data));
|
||||
}
|
||||
}
|
||||
/* end check first bill or not funs: */
|
||||
/* end check first bill or not funs: */
|
||||
|
||||
//start CB ECR integration
|
||||
//set CB com port data
|
||||
function setCommPorts(comPortLists) {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
$('#com_port_name').html("");
|
||||
var jsonPortLists = $.parseJSON(comPortLists);
|
||||
// alert(jsonPortLists);
|
||||
if((jsonPortLists!=undefined && jsonPortLists!='') && (jsonPortLists.length > 0)){
|
||||
$.each(jsonPortLists,function(key,value){
|
||||
$('#com_port_name').append("<option value='"+value+"'>"+value+"</option>");
|
||||
});
|
||||
}
|
||||
else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: 'Payment device has been disconnected! Please plug it in.',
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** pay with CB bank **/
|
||||
function pay_withBank(cmd_type, payment_type, bnk_bill_amount,sale_id,receipt_no) {
|
||||
$("#loading_wrapper").show();
|
||||
var com_port = $("#com_port_name").val();
|
||||
reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, receipt_no, com_port);
|
||||
}
|
||||
|
||||
//add req data to card_sale_trans table
|
||||
function reqCardSaleTrans(cmd_type, payment_type, bnk_bill_amount, sale_id, receipt_no, com_port) {
|
||||
var jobj = {"cmd_type" : cmd_type, "payment_type" : "CARD", "amt" : bnk_bill_amount, "sale_id" : sale_id, "inv_no" : receipt_no, "com_port" : com_port};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/bank_integration/sale_trans",
|
||||
data: {type:"request", data: jobj},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status == "success"){
|
||||
card_sale_trans_id = data.card_sale_trans_id;
|
||||
resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amount, sale_id, receipt_no,com_port);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//add res data to card_sale_trans table
|
||||
function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amount, sale_id, receipt_no,com_port) {
|
||||
|
||||
var resMsg = "";
|
||||
var card_payment_type="";
|
||||
if($("#loading_wrapper").is(":visible")){
|
||||
if(payment_type=="mpu" || payment_type=="visa" || payment_type=="master" || payment_type=="jcb" || payment_type=="unionpay"){
|
||||
card_payment_type = "CARD";
|
||||
}
|
||||
else if(payment_type == "alipay"){
|
||||
card_payment_type = "EWALLET";
|
||||
}
|
||||
|
||||
bnk_bill_amount = parseFloat(bnk_bill_amount);
|
||||
|
||||
resMsg = code2lab.reqBankPayment(cmd_type,card_payment_type,bnk_bill_amount,receipt_no,com_port);
|
||||
}
|
||||
|
||||
if(resMsg.includes("STATUS")){
|
||||
var jobj = $.parseJSON(resMsg);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/bank_integration/sale_trans",
|
||||
data: {type:"response", card_sale_trans_id: card_sale_trans_id, data: jobj},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == "success"){
|
||||
resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$("#loading_wrapper").hide();
|
||||
swal ( "Oops" , resMsg.toString() , "error" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amount,sale_id,receipt_no,com_port) {
|
||||
$("#loading_wrapper").hide();
|
||||
var jobj = $.parseJSON(resMsg);
|
||||
if(jobj.STATUS == "Approved"){
|
||||
$.ajax({type: "POST",
|
||||
url: "/origami/payment/"+payment_type,
|
||||
data: "amount="+ bnk_bill_amount + "&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 + "/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
if(payment_type!="master"){
|
||||
payment_type = payment_type.toUpperCase();
|
||||
}
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: "Transaction is " + (jobj.STATUS).toLowerCase(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment/"+payment_type;
|
||||
});
|
||||
}
|
||||
}
|
||||
//end CB ECR integration
|
||||
3
app/assets/javascripts/origami/bank_integration.coffee
Normal file
3
app/assets/javascripts/origami/bank_integration.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/javascripts/origami/unionpay.coffee
Normal file
3
app/assets/javascripts/origami/unionpay.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the app/controllers/origami/BankIntegration controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/origami/bank_integration.scss
Normal file
3
app/assets/stylesheets/origami/bank_integration.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/BankIntegration controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/origami/unionpay.scss
Normal file
3
app/assets/stylesheets/origami/unionpay.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/unionpay controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
Reference in New Issue
Block a user