Merge branch 'hotfix20180131invoice'

master
yixian 7 years ago
commit 75e6778591

@ -115,7 +115,7 @@ public class TradeLogServiceImpl implements TradeLogService {
// @Value("classpath:/jasper/trans_flow.jasper")
// @Value("classpath:/jasper/trans_flow_new.jasper")
@Value("classpath:/jasper/partner_invoice.jasper")
@Value("classpath:/jasper/partner_invoice_gst.jasper")
private org.springframework.core.io.Resource trans_flow;
@Value("classpath:/jasper/royalpay_logo.png")
private org.springframework.core.io.Resource logo;

@ -4,6 +4,7 @@
$(document).ready(function () {
'use strict';
decode();
function decode() {
var redirect = window.redirect;
while (redirect.indexOf('://') < 0) {
@ -14,6 +15,7 @@ $(document).ready(function () {
window.redirect = redirect;
}
}
var dataCache = {paying: false};
$('#key_P').bind('touchstart', startPay);
if (window.paydata) {
@ -21,6 +23,7 @@ $(document).ready(function () {
invokePay(window.paydata);
})
}
function startPay() {
$('#wdiv').show();
if (dataCache.paying) {
@ -67,7 +70,7 @@ $(document).ready(function () {
}, function (res) {
dataCache.paying = false;
if (res.err_msg == 'get_brand_wcpay_request:ok') {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
startCheckOrder(window.client_moniker, window.merchant_orderid);
} else {
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
alert('WeChat Error:' + res.err_msg);
@ -81,6 +84,25 @@ $(document).ready(function () {
})
}
function startCheckOrder(clientMoniker, merchantOrderId) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/clients/' + clientMoniker + '/orders/' + merchantOrderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
function waitForPaymentSuccess(orderId) {
var sock = new SockJS('/register');
var client = Stomp.over(sock);

@ -256,7 +256,7 @@ $(function () {
return;
}
if (pay.direct_paid) {
window.location = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + pay.order_id;
location.href = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + pay.order_id;
return;
}
var paydata = pay.jsapi;
@ -270,7 +270,8 @@ $(function () {
}, function (res) {
dataCache.paying = false;
if (res.err_msg == 'get_brand_wcpay_request:ok') {
window.location = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + pay.order_id;
startCheckOrder(pay.order_id);
} else {
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
weuiAlert('WeChat Error:' + res.err_msg);
@ -289,6 +290,24 @@ $(function () {
})
});
function startCheckOrder(orderId) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + orderId;
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
function weuiAlert(msg) {
var config = {
template: msg
@ -343,7 +362,11 @@ $(function () {
}
var ft = $('<div class="weui_dialog_ft"></div>').appendTo(dialogBox);
if ($.isFunction(config.confirm)) {
var yes = $('<a></a>', {class: 'weui_btn_dialog primary', text: 'OK',style:'background: #0bb20c;color: #fff;'}).appendTo(ft);
var yes = $('<a></a>', {
class: 'weui_btn_dialog primary',
text: 'OK',
style: 'background: #0bb20c;color: #fff;'
}).appendTo(ft);
yes.click(function () {
config.confirm(dialog, true);
dialog.remove();
@ -354,7 +377,11 @@ $(function () {
dialog.remove();
})
} else {
var ok = $('<a></a>', {class: 'weui_btn_dialog primary', text: 'OK',style:'background: #0bb20c;color: #fff;'}).appendTo(ft);
var ok = $('<a></a>', {
class: 'weui_btn_dialog primary',
text: 'OK',
style: 'background: #0bb20c;color: #fff;'
}).appendTo(ft);
ok.click(function () {
dialog.remove();
})

@ -56,7 +56,7 @@ $(document).ready(function () {
}, function (res) {
dataCache.paying = false;
if (res.err_msg == 'get_brand_wcpay_request:ok') {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
startCheckOrder(window.order_id)
} else {
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
alert('WeChat Error:' + res.err_msg);
@ -69,4 +69,22 @@ $(document).ready(function () {
$('#wdiv').hide();
})
}
function startCheckOrder(orderId) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
});
Loading…
Cancel
Save