update dinga and paymal

This commit is contained in:
Aung Myo
2018-04-18 14:40:53 +06:30
parent de5bbb27f7
commit 5816a48d32
7 changed files with 64 additions and 44 deletions

View File

@@ -46,6 +46,8 @@
</div>
</div>
</div>
<p class="hidden" name="sale_id" id="sale_id" ><%=@sale_id %></p>
<p class="hidden" name="receipt_no" id="receipt_no" ><%=@sale_data.receipt_no %></p>
<!-- <% if @payparcount > 0 %>
<p class="">Last time rebate amount is <%= @payparcount %></p>
<% end %>
@@ -116,7 +118,7 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="paypar_account_no" id="paypar_account_no" value="1011002923682533" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
@@ -239,15 +241,15 @@
var membership_id = '';
var membership_type = '';
var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").text() || 0;
var customer_mamber_card_no = 0;
$("#is_paymemberModal").hide();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
// $("#is_paymemberModal").hide();
// $("#sxModal").show();
// setTimeout(function(){
// getCardNo();
// $("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
@@ -255,6 +257,7 @@
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
console.log(data)
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val(parseFloat(valid_amount));
@@ -262,8 +265,9 @@
$.ajax({
type: "POST",
url: "<%=origami_payment_dinga_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no :customer_mamber_card_no},
success: function(result){
console.log(result)
if(result.status == true){
swal({
title: "Information!",
@@ -273,7 +277,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
@@ -291,14 +295,14 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
});
}
}
});
}
},100);
// },100);
});
// Read NFC card no from java
@@ -316,13 +320,13 @@
// QR Code Reader
$(".btn_qr_code").on('click', function(e){
$("#is_memberModal").hide();
var code = "";
var code = "1011002923682533";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
setTimeout(function(){
code=getQRCode();
// setTimeout(function(){
// code=getQRCode();
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
@@ -337,7 +341,7 @@
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no : code},
success: function(result){
if(result.status == true){
swal({
@@ -372,7 +376,7 @@
}
});
}
},100);
// },100);
});
// Read qrcode from java