diff --git a/pom.xml b/pom.xml
index c177b3c0f..cfb6e206d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
au.com.royalpay.payment
payment-parent
- 0.2.0
+ 0.2.0-dev
4.0.0
@@ -36,6 +36,10 @@
au.com.royalpay.payment
jd-core
+
+ au.com.royalpay.payment
+ rpay-core
+
com.github.stuxuhai
jpinyin
diff --git a/src/db/modify.sql b/src/db/modify.sql
index 50f6f75c6..929d90dc1 100644
--- a/src/db/modify.sql
+++ b/src/db/modify.sql
@@ -1,3 +1,14 @@
+CREATE TABLE `sys_rpay_merchant_apply` (
+ `merchant_app_id` varchar(50) NOT NULL,
+ `client_id` int(11) NOT NULL,
+ `merchant_shortname` varchar(20) NOT NULL,
+ `business_category` varchar(20) NOT NULL,
+ `sub_merchant_id` varchar(20) DEFAULT NULL,
+ `create_time` datetime NOT NULL,
+ `operator` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`merchant_app_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=244;
+
ALTER TABLE `pmt_refunds`
MODIFY COLUMN `refund_id` varchar(50) NOT NULL COMMENT '退款编号' FIRST ;
diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/beans/ato/AddressInfo.java b/src/main/java/au/com/royalpay/payment/manage/analysis/beans/ato/AddressInfo.java
index a59de68b0..02ac63210 100644
--- a/src/main/java/au/com/royalpay/payment/manage/analysis/beans/ato/AddressInfo.java
+++ b/src/main/java/au/com/royalpay/payment/manage/analysis/beans/ato/AddressInfo.java
@@ -13,15 +13,18 @@ public class AddressInfo {
public AddressInfo(String address, String suburb, String state, String postCode, String country) {
this.address = address;
this.suburb = suburb;
- this.state = state;
if (!postCode.matches("^\\d{4}$")) {
postCode = "9999";
country = "OTH";
+ state = "OTH";
}
- this.postCode = postCode;
if (country != null && country.length() != 3) {
country = "OTH";
+ state = "OTH";
+ postCode = "9999";
}
+ this.postCode = postCode;
+ this.state = state;
this.country = country;
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java
index 24ca4aad1..ad1da96e7 100644
--- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/MerchantLocationServiceImpl.java
@@ -31,10 +31,18 @@ import java.util.concurrent.TimeUnit;
@Service
public class MerchantLocationServiceImpl implements MerchantLocationService {
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ private static final String GOOGLE_MAPS_API = "https://maps.googleapis.com/maps/api/geocode/json";
+
+ private static final String GOOGLE_API_KEY = "AIzaSyDUu6qXRV-j24rSdbPOMfVdTN1-2OfC2o8";
+
+ private ThreadPoolExecutor pool = new ThreadPoolExecutor(5, 100, 5, TimeUnit.SECONDS, new LinkedBlockingQueue());
+
+ private Set failureSet = new ConcurrentSet<>();
@Resource
private ClientLocationsMapper clientLocationsMapper;
-
@Resource
private ClientManager clientManager;
@@ -45,22 +53,12 @@ public class MerchantLocationServiceImpl implements MerchantLocationService {
return clientLocationsMapper.getAllMerchantsLocations(params);
}
- private Logger logger = LoggerFactory.getLogger(getClass());
-
- private static final String GOOGLE_MAPS_API = "https://maps.googleapis.com/maps/api/geocode/json";
-
- // private static final String GOOGLE_API_KEY = "AIzaSyBbt7XV5PdXqB2aZeVFAZIzOTO0W6gn_YY";
- private static final String GOOGLE_API_KEY = "AIzaSyDUu6qXRV-j24rSdbPOMfVdTN1-2OfC2o8";
-
- private ThreadPoolExecutor pool = new ThreadPoolExecutor(5, 100, 5, TimeUnit.SECONDS, new LinkedBlockingQueue());
- private Set failureSet = new ConcurrentSet<>();
-
@Resource
private JdbcTemplate jdbcTemplate;
@Override
public void initClientLocations() throws InterruptedException {
- List
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ Sub Merchant Id
+ (当前使用){{id_apply.sub_merchant_id}}
+
+ -
+ Apply Time
+
+
+ -
+ Company Short Name
+ {{id_apply.merchant_shortname | cut:true:20:' ...'}}
+
+ -
+ Business Category
+ {{id_apply.business_category | partner_royalpay_industry}}
+
+ -
+ Operator
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/ui/static/templates/payment/payment.css b/src/main/ui/static/templates/payment/payment.css
index e32c60cf9..9d13e26d0 100644
--- a/src/main/ui/static/templates/payment/payment.css
+++ b/src/main/ui/static/templates/payment/payment.css
@@ -433,6 +433,9 @@ input.value:focus {
.keyboard-grids .key.paynow.alipay {
background: #108ee9;
}
+.keyboard-grids .key.paynow.rpay {
+ background: #FF2D55;
+}
.alipay {
color: #108ee9;
@@ -442,6 +445,10 @@ input.value:focus {
color: #09bb07;
}
+.rpay {
+ color: #FF2D55;
+}
+
.keyboard-grids .key.paynow > .label {
display: block;
position: absolute;
diff --git a/src/main/ui/static/templates/payment/v1/payment.css b/src/main/ui/static/templates/payment/v1/payment.css
index c61863f70..5c535ec04 100644
--- a/src/main/ui/static/templates/payment/v1/payment.css
+++ b/src/main/ui/static/templates/payment/v1/payment.css
@@ -366,6 +366,10 @@ input.value:focus {
background-color: #108ee9;
}
+.button_sp_area.alipay .paynow {
+ background-color: #FF2D55;
+}
+
.button_sp_area .remark-btn {
width: 35%;
background: #20C1ED
diff --git a/src/main/ui/static/templates/payment/v2/payment.css b/src/main/ui/static/templates/payment/v2/payment.css
index e2b39f2b5..9564c3027 100644
--- a/src/main/ui/static/templates/payment/v2/payment.css
+++ b/src/main/ui/static/templates/payment/v2/payment.css
@@ -431,6 +431,9 @@ input.value:focus {
.keyboard-grids .key.paynow.alipay {
background: #108ee9;
}
+.keyboard-grids .key.paynow.rpay {
+ background: #FF2D55;
+}
.alipay {
color: #108ee9;
diff --git a/src/main/ui/static/templates/rpay/v1/bill_retail_jsapi.js b/src/main/ui/static/templates/rpay/v1/bill_retail_jsapi.js
new file mode 100644
index 000000000..7e7290d52
--- /dev/null
+++ b/src/main/ui/static/templates/rpay/v1/bill_retail_jsapi.js
@@ -0,0 +1,79 @@
+/**
+ * Created by yixian on 2016-07-15.
+ */
+$(document).ready(function () {
+ 'use strict';
+ decode();
+ function decode() {
+ var redirect = window.redirect;
+ while(redirect.indexOf('://')<0){
+ redirect = decodeURIComponent(redirect);
+ if(redirect==window.redirect){
+ break;
+ }
+ window.redirect = redirect;
+ }
+ }
+ var dataCache = {paying: false};
+ $('#key_P').bind('touchstart', startPay);
+ function startPay() {
+ $('#wdiv').show();
+ if (dataCache.paying) {
+ return;
+ }
+ dataCache.paying = true;
+
+ $.ajax({
+ url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params',
+ method: 'GET',
+ dataType: 'json',
+ success: function (pay) {
+ if (pay.direct_paid) {
+ location.href = window.redirect;
+ return;
+ }
+ if (window.AlipayJSBridge) {
+ callPayment();
+ } else {
+ // 如果没有注入则监听注入的事件
+ document.addEventListener('AlipayJSBridgeReady', callPayment, false);
+ }
+
+ function callPayment() {
+ try {
+ AlipayJSBridge.call('tradePay', {
+ tradeNO: pay.trade_no
+ }, function (res) {
+ dataCache.paying = false;
+ if (res.resultCode == '9000') {
+ AlipayJSBridge.call('startApp', {
+ appId: '20000056',
+ param: {
+ actionType: 'showSuccPage',
+ payResult: res.result
+ },
+ closeCurrentApp: false
+ });
+ location.href = window.redirect;
+ } else {
+ alert(res.memo);
+ }
+ $('#wdiv').hide();
+ })
+ } catch (err) {
+ alert(err);
+ $('#wdiv').hide();
+ }
+ }
+ },
+ error: function (jqXhr) {
+ alert(jqXhr.responseJSON.message);
+ $('#wdiv').hide();
+ dataCache.paying = false;
+ }
+ })
+
+
+ }
+
+});
\ No newline at end of file
diff --git a/src/main/ui/static/templates/rpay/v1/gateway_jsapi.js b/src/main/ui/static/templates/rpay/v1/gateway_jsapi.js
new file mode 100644
index 000000000..9f876394f
--- /dev/null
+++ b/src/main/ui/static/templates/rpay/v1/gateway_jsapi.js
@@ -0,0 +1,139 @@
+/**
+ * Created by yixian on 2016-07-15.
+ */
+$(document).ready(function () {
+ 'use strict';
+ decode();
+
+ function decode() {
+ if (window.client_moniker == 'PINE') {
+ alert('debug:origin redirect:' + window.redirect);
+ }
+ var redirect = window.redirect;
+ while (redirect.indexOf('://') < 0) {
+ redirect = decodeURIComponent(redirect);
+ if (redirect == window.redirect) {
+ break;
+ }
+ window.redirect = redirect;
+ }
+
+ }
+
+ var dataCache = {paying: false};
+ $('#key_P').bind('touchstart', startPay);
+ if (window.tradeNo) {
+
+ if (window.AlipayJSBridge) {
+ callPayment(window.tradeNo);
+ } else {
+ // 如果没有注入则监听注入的事件
+ document.addEventListener('AlipayJSBridgeReady', function () {
+ callPayment(window.tradeNo);
+ }, false);
+ }
+ }
+
+ function startPay() {
+ $('#wdiv').show();
+ if (dataCache.paying) {
+ return;
+ }
+ dataCache.paying = true;
+
+ $.ajax({
+ url: './preorder',
+ method: 'GET',
+ dataType: 'json',
+ success: function (pay) {
+ if (pay.direct_paid) {
+ location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
+ return;
+ }
+ if (window.AlipayJSBridge) {
+ callPayment(pay.trade_no);
+ } else {
+ // 如果没有注入则监听注入的事件
+ document.addEventListener('AlipayJSBridgeReady', function () {
+ callPayment(pay.trade_no);
+ }, false);
+ }
+
+ },
+ error: function (jqXhr) {
+ alert(jqXhr.responseJSON.message);
+ $('#wdiv').hide();
+ dataCache.paying = false;
+ }
+ })
+
+
+ }
+
+ function callPayment(tradeNo) {
+ try {
+ if (window.client_moniker == 'PINE') {
+ alert('debug:trade no=' + tradeNo)
+ }
+ AlipayJSBridge.call('tradePay', {
+ tradeNO: tradeNo
+ }, function (res) {
+ dataCache.paying = false;
+ if (res.resultCode == '9000') {
+ AlipayJSBridge.call('startApp', {
+ appId: '20000056',
+ param: {
+ actionType: 'showSuccPage',
+ payResult: res.result
+ },
+ closeCurrentApp: false
+ });
+ startCheckOrder(window.client_moniker, window.merchant_orderid);
+ } else {
+ alert(res.memo);
+ if (window.tradeNo) {
+ location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=false';
+ }
+ }
+ $('#wdiv').hide();
+ })
+ } catch (err) {
+ alert(err);
+ $('#wdiv').hide();
+ }
+ }
+
+ 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);
+ client.connect({}, function () {
+ client.subscribe('/app/payment/orders/' + orderId, function (msg) {
+ var json = JSON.parse(msg.body);
+ var concat = '?';
+ if (window.redirect.indexOf('?') > 0) {
+ concat = '&';
+ }
+ location.href = window.redirect + concat + 'time=' + json.time + '&nonce_str=' + json.nonce_str + '&sign=' + json.sign + '&success=true';
+ })
+ })
+ }
+});
\ No newline at end of file
diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js
new file mode 100644
index 000000000..74397a9c1
--- /dev/null
+++ b/src/main/ui/static/templates/rpay/v1/payment.js
@@ -0,0 +1,472 @@
+/**
+ * Created by yixian on 2017-05-08
+ */
+$(function () {
+ 'use strict';
+ document.querySelector('body').addEventListener('touchmove', function (e) {
+ if (!document.querySelector('.coupons').contains(e.target)) {
+ e.preventDefault();
+ }
+ })
+ var dataCache = {price: '0', coupons: [], coupon_groups: {}};
+ var exchangeRate = parseFloat(window.exchange_rate);
+
+ if (window.AlipayJSBridge) {
+ AlipayJSBridge.call('hideOptionMenu');
+ } else {
+ document.addEventListener('AlipayJSBridgeReady', function () {
+ AlipayJSBridge.call('hideOptionMenu');
+ }, false);
+ }
+ dataCache.paying = false;
+ var ctrl = {};
+
+ $('.ff.key').bind('touchstart', function () {
+ if (dataCache.paying) {
+ return;
+ }
+ var char = $(this).attr('data-char');
+ appendChar(char);
+ });
+
+ $('.coupons .use-check').click(function () {
+ if ($(this).hasClass('disabled')) {
+ return;
+ }
+ var couponId = $(this).attr('data-coupon-id');
+ var couponGroup = $(this).attr('data-coupon-group');
+ if (couponGroup) {
+ var prevCouponId = dataCache.coupon_groups[couponGroup];
+ if (prevCouponId) {
+ var prevIdx = dataCache.coupons.indexOf(prevCouponId);
+ if (prevIdx >= 0) {
+ dataCache.coupons.splice(prevIdx, 1);
+ }
+ if (prevCouponId != couponId) {
+ $('.coupons .use-check[data-coupon-id="' + prevCouponId + '"]').removeClass('checked').addClass('unchecked');
+ dataCache.coupon_groups[couponGroup] = couponId;
+ } else {
+ dataCache.coupon_groups[couponGroup] = null;
+ }
+ } else {
+ dataCache.coupon_groups[couponGroup] = couponId;
+ }
+
+ }
+
+ if ($(this).is('.checked')) {
+ $(this).removeClass('checked').addClass('unchecked');
+ } else {
+ $(this).removeClass('unchecked').addClass('checked');
+ }
+ var checked = $(this).is('.checked');
+ if (checked) {
+ dataCache.coupons.push(couponId);
+ updatePrice();
+ } else {
+ var idx = dataCache.coupons.indexOf(couponId);
+ dataCache.coupons.splice(idx, 1);
+
+ }
+ });
+
+ $('#key_B').bind('touchstart', function () {
+ backspace();
+ });
+
+ function updatePoundage(price) {
+ if (window.extensions.indexOf('customerrate') >= 0 && window.rateValue != null) {
+ if (window.use_customised_rate) {
+ var rate = new Decimal(100).plus(window.rateValue).div(100);
+ var poundageValue = new Decimal(dataCache.price).mul(rate).sub(dataCache.price);
+ } else {
+ var rateRemain = new Decimal(100).sub(window.rateValue).div(100);
+ poundageValue = new Decimal(dataCache.price).div(rateRemain).sub(dataCache.price);
+ }
+ dataCache.poundageValue = poundageValue.toFixed(2, Decimal.ROUND_HALF_UP);
+ return poundageValue.plus(price).toFixed(2, Decimal.ROUND_HALF_UP);
+ }
+ return price;
+ }
+
+ function updatePrice() {
+ $('#audVal').html(dataCache.price);
+ var realPrice = dataCache.price;
+ $('#audValReal').html(realPrice);
+ var surchargeData = calculateSurcharge(realPrice);
+
+ var price = surchargeData.newPrice || realPrice;
+ var priceBeforeDiscount = price;
+ dataCache.discounts = [];
+ dataCache.tax = surchargeData.tax;
+ dataCache.surcharge = surchargeData.surcharge;
+
+ $(window.coupons).each(function () {
+ price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons);
+ });
+ dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP);
+ dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR);
+ var rate = 'CNY' == window.currency ? 1 : exchangeRate;
+ var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP);
+ $('#cnyVal').html(cnyVal);
+ dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount;
+ }
+
+ function updatePoundageStatus() {
+ $(window.coupons).each(function () {
+ var coupon = this;
+ var couponId = coupon.couponId();
+ if (coupon.isEnable(dataCache.currencyPrice || 0)) {
+ $('.coupons .use-check[data-coupon-id=' + couponId + ']').removeClass('disabled');
+ } else {
+ var dom = $('.coupons .use-check[data-coupon-id=' + couponId + ']').addClass('disabled');
+ var couponGroup = dom.attr('data-coupon-group');
+ if (couponGroup) {
+ if (dataCache.coupon_groups[couponGroup] == couponId) {
+ dataCache.coupon_groups[couponGroup] = null;
+ }
+ }
+ var idx = dataCache.coupons.indexOf(couponId);
+ if (idx >= 0) {
+ dataCache.coupons.splice(idx, 1);
+ }
+ dom.removeClass('checked').addClass('unchecked');
+ }
+ })
+ }
+
+ updatePoundageStatus();
+
+ function backspace() {
+ dataCache.price = dataCache.price.substring(0, dataCache.price.length - 1);
+ if (dataCache.price.length == 0) {
+ dataCache.price = '0';
+ }
+ updatePrice();
+ updatePoundageStatus();
+ }
+
+ function appendChar(char) {
+ var pointLocation = dataCache.price.indexOf('.');
+ if (pointLocation >= 0 || char == '.' || dataCache.price.length < 5) {
+ if (pointLocation >= 0 && char == '.') {
+ return;
+ }
+ if (pointLocation >= 0 && pointLocation <= dataCache.price.length - 3) {
+ return;
+ }
+ if (dataCache.price == '0' && char != '.') {
+ dataCache.price = '';
+ }
+ dataCache.price += char;
+ updatePrice();
+ updatePoundageStatus();
+ }
+ }
+
+ $('#coupon-box-toggle').click(function () {
+ $('.coupons-container').addClass('show');
+ });
+ $('.coupons-container>.coupons-mask,.coupons-container #close-coupon-box').click(function () {
+ $(this).parents('.coupons-container').removeClass('show');
+ });
+
+
+ $('.remark-btn').click(function () {
+ var cfg = {
+ title: '备注 Remark',
+ template: '',
+ initialize: function (dialog) {
+ $('').addClass('remark-input').attr('name', 'remark').val(dataCache.remark || '').appendTo($('.weui_dialog_bd', dialog));
+ },
+ confirm: function (dialog, chosen) {
+ if (chosen) {
+ var remark = $('textarea[name="remark"]', dialog).val();
+ if (remark) {
+ $('#remark-box').text('备注:' + remark).show()
+ } else {
+ $('#remark-box').text('').hide();
+ }
+ dataCache.remark = remark;
+ }
+
+ }
+ };
+ showWeuiDialog(cfg);
+ });
+
+ $('.paydetail').click(function () {
+ var config = {
+ title: 'Payment Detail',
+ template: '',
+ initialize: function (dialog) {
+ var bd = $('.weui_dialog_bd', dialog);
+ var currencySymbol = window.currency == 'AUD' ? '$' : '¥';
+ $('').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd);
+ if (parseFloat(dataCache.customSurcharge) > 0) {
+ $('').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.customSurcharge).appendTo(bd);
+ }
+ $(dataCache.discounts).each(function () {
+ $('').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd);
+ });
+ $('').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd);
+ }
+ };
+ showWeuiDialog(config);
+ });
+
+ $('#key_P').click(function () {
+ if (window.requireRemark) {
+ if (!dataCache.remark) {
+ var config = {
+ title: '请先输入备注',
+ template: ''
+ };
+ showWeuiDialog(config);
+ }
+
+ }
+ });
+
+ $('#key_P').bind('touchstart', function () {
+ if (window.requireRemark) {
+ if (!dataCache.remark) {
+ return;
+ }
+ }
+ $('#key_P').addClass('hidden');
+ $('#key_Loading').removeClass('hidden');
+ if (dataCache.paying) {
+ return;
+ }
+ dataCache.paying = true;
+ var data = {price: dataCache.price + '', original_number: true, currency: window.currency};
+ if (dataCache.remark) {
+ data.description = dataCache.remark;
+ }
+ if (window.extensions.indexOf('preauthorize') >= 0) {
+ data.preauthorize = true;
+ }
+ if (window.extensions.indexOf('qrcodemode') >= 0) {
+ data.qrmode = true;
+ }
+ if (window.extensions.indexOf('customerrate') >= 0) {
+ data.customerrate = true;
+ }
+ data.coupons = dataCache.coupons;
+ data.qrcodeVersion = window.qrcodeVersion;
+
+ dataCache.remark = '';
+
+ window.RPayPlus.send("showLoading", null, null);
+ $.ajax({
+ url: '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders',
+ method: 'POST',
+ data: JSON.stringify(data),
+ contentType: 'application/json',
+ dataType: 'json',
+ success: function (resp) {
+ window.RPayPlus.send("closeLoading", null, null);
+ pay(resp,function(data){
+ if(data == 'success'){
+ location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + resp.mch_order_id + '/result'
+ }else if(data == 'fail'){
+ alert('Oops,Network fluctuation,please try again later...');
+ }
+ $('#key_P').removeClass('hidden');
+ $('#key_Loading').addClass('hidden');
+ dataCache.paying = false;
+
+ });
+ // if (window.AlipayJSBridge) {
+ // callPayment();
+ // } else {
+ // // 如果没有注入则监听注入的事件
+ // document.addEventListener('AlipayJSBridgeReady', callPayment, false);
+ // }
+ //
+ // function callPayment() {
+ // try {
+ // AlipayJSBridge.call('tradePay', {
+ // tradeNO: pay.trade_no
+ // }, function (res) {
+ // dataCache.paying = false;
+ // if (res.resultCode == '9000') {
+ // AlipayJSBridge.call('startApp', {
+ // appId: '20000056',
+ // param: {
+ // actionType: 'showSuccPage',
+ // payResult: res.result
+ // },
+ // closeCurrentApp: false
+ // });
+ // startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result');
+ // } else if (res.resultCode == '6001') {
+ // //do nothing
+ // } else {
+ // if (res.memo) {
+ // weuiAlert(res.memo);
+ // }
+ // }
+ // $('#key_P').removeClass('hidden');
+ // $('#key_Loading').addClass('hidden');
+ // })
+ // } catch (err) {
+ // weuiAlert(err)
+ // }
+ // }
+ },
+ error: function (jqXhr) {
+ window.RPayPlus.send("closeLoading", null, null);
+ weuiAlert(jqXhr.responseJSON.message);
+ dataCache.paying = false;
+ $('#key_P').removeClass('hidden');
+ $('#key_Loading').addClass('hidden');
+ }
+ })
+ });
+
+ function startCheckOrder(orderId, url) {
+ function checkOrderStd() {
+ $.ajax({
+ url: '/api/v1.0/payment/orders/' + orderId + '/status',
+ method: 'GET',
+ dataType: 'json',
+ success: function (res) {
+ if (res.paid) {
+ location.href = url;
+ } else {
+ setTimeout(checkOrderStd, 500);
+ }
+ }
+ })
+ }
+
+ checkOrderStd();
+ }
+
+ function weuiAlert(msg) {
+ var config = {
+ template: msg
+ };
+ showWeuiDialog(config);
+ }
+
+ function showWeuiDialog(config) {
+ if (config.templateUrl) {
+ $.ajax({
+ url: config.templateUrl,
+ dataType: 'html',
+ success: function (template) {
+ buildDialog(template);
+ }
+ });
+ } else {
+ buildDialog(config.template);
+ }
+
+
+ function buildDialog(template) {
+ var defaultConfig = {backdrop: true};
+ config = $.extend({}, defaultConfig, config);
+ var dialog = $("", {class: 'weui_dialog_confirm'});
+ var mask = $('', {class: 'weui_mask'}).appendTo(dialog);
+ if (config.backdrop) {
+ mask.click(function () {
+ dialog.remove();
+ if ($.isFunction(config.dismiss)) {
+ config.dismiss();
+ }
+ })
+ }
+ var dialogBox = $("", {class: 'weui_dialog'}).appendTo(dialog);
+ if (config.title) {
+ $('', {class: 'weui_dialog_hd'}).append($('', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox);
+ }
+ var dialogBody = $("", {class: 'weui_dialog_bd'}).appendTo(dialogBox);
+ if (template) {
+ dialogBody.append(template);
+ }
+ if ($.isFunction(config.initialize)) {
+ config.initialize(dialog);
+ }
+ var ft = $('').appendTo(dialogBox);
+ if ($.isFunction(config.confirm)) {
+ var yes = $('', {
+ class: 'weui_btn_dialog primary',
+ text: 'OK',
+ style: 'background: #FF2D55;color: #fff;'
+ }).appendTo(ft);
+ yes.click(function () {
+ config.confirm(dialog, true);
+ dialog.remove();
+ });
+ var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft);
+ no.click(function () {
+ config.confirm(dialog, false);
+ dialog.remove();
+ })
+ } else {
+ var ok = $('', {
+ class: 'weui_btn_dialog primary',
+ text: 'OK',
+ style: 'background: #FF2D55;color: #fff;'
+ }).appendTo(ft);
+ ok.click(function () {
+ dialog.remove();
+ })
+ }
+ dialog.appendTo($('body'));
+ }
+
+ }
+
+
+ function getUserId(){
+ window.RPayPlus.send("getUserId", null, function(data){
+ window.Rpay.userInfo = data;
+ });
+ }
+
+ function pay(param,callback){
+ var order={
+ nonce_str:param.nonce_str,
+ rpay_order_id:param.rpay_order_id,
+ mch_order_id:param.mch_order_id
+ };
+ window.RPayPlus.send('pay', order, callback);
+ }
+
+ function back(){
+ window.RPayPlus.send("back", null, null);
+ }
+
+ function jsInvoke(){
+ window.RPayPlus.send("jsInvoke", 'Native Test', null);
+ }
+
+ function createOrder(msg){
+ alert('create order information='+JSON.stringify(msg));
+ }
+
+ function queryOrder(msg){
+ alert('query order information='+JSON.stringify(msg));
+
+ var order={
+ orderId:'00001',
+ amount:'$10.98',
+ title:'Balance Top-UP'
+ };
+ setTimeout("window.RPayPlus.onResult("+JSON.stringify(order)+");", 1500);
+ }
+
+ function registerJs(){
+ window.RPayPlus.register('createOrder', function(data){
+ createOrder(data);
+ });
+ window.RPayPlus.register('queryOrder', function(data){
+ queryOrder(data);
+ });
+ }
+ getUserId();
+});
\ No newline at end of file
diff --git a/src/main/ui/static/templates/rpay/v1/retail_jsapi.js b/src/main/ui/static/templates/rpay/v1/retail_jsapi.js
new file mode 100644
index 000000000..6b74c75cf
--- /dev/null
+++ b/src/main/ui/static/templates/rpay/v1/retail_jsapi.js
@@ -0,0 +1,97 @@
+/**
+ * Created by yixian on 2016-07-15.
+ */
+$(document).ready(function () {
+ 'use strict';
+ decode();
+ function decode() {
+ var redirect = window.redirect;
+ while(redirect.indexOf('://')<0){
+ redirect = decodeURIComponent(redirect);
+ if(redirect==window.redirect){
+ break;
+ }
+ window.redirect = redirect;
+ }
+ }
+ var dataCache = {paying: false};
+ $('#key_P').bind('touchstart', startPay);
+ function startPay() {
+ $('#wdiv').show();
+ if (dataCache.paying) {
+ return;
+ }
+ dataCache.paying = true;
+
+ $.ajax({
+ url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params',
+ method: 'GET',
+ dataType: 'json',
+ success: function (pay) {
+ if (pay.direct_paid) {
+ location.href = window.redirect;
+ return;
+ }
+ if (window.AlipayJSBridge) {
+ callPayment();
+ } else {
+ // 如果没有注入则监听注入的事件
+ document.addEventListener('AlipayJSBridgeReady', callPayment, false);
+ }
+
+ function callPayment() {
+ try {
+ AlipayJSBridge.call('tradePay', {
+ tradeNO: pay.trade_no
+ }, function (res) {
+ dataCache.paying = false;
+ if (res.resultCode == '9000') {
+ AlipayJSBridge.call('startApp', {
+ appId: '20000056',
+ param: {
+ actionType: 'showSuccPage',
+ payResult: res.result
+ },
+ closeCurrentApp: false
+ });
+ startCheckOrder(window.order_id, window.redirect);
+ } else {
+ alert(res.memo);
+ }
+ $('#wdiv').hide();
+ })
+ } catch (err) {
+ alert(err);
+ $('#wdiv').hide();
+ }
+ }
+ },
+ error: function (jqXhr) {
+ alert(jqXhr.responseJSON.message);
+ $('#wdiv').hide();
+ dataCache.paying = false;
+ }
+ })
+
+
+ }
+
+ function startCheckOrder(orderId, url) {
+ function checkOrderStd() {
+ $.ajax({
+ url: '/api/v1.0/payment/orders/' + orderId + '/status',
+ method: 'GET',
+ dataType: 'json',
+ success: function (res) {
+ if (res.paid) {
+ location.href = url;
+ } else {
+ setTimeout(checkOrderStd, 500);
+ }
+ }
+ })
+ }
+
+ checkOrderStd();
+ }
+});
\ No newline at end of file
diff --git a/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java b/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java
index fdf9c7290..6d1c6a9ae 100644
--- a/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java
+++ b/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java
@@ -617,6 +617,7 @@ public class CustomerImpressionImplTest {
}
return result;
+
}
@Test
diff --git a/src/test/java/au/com/royalpay/payment/manage/process/ato/ExportATOReport.java b/src/test/java/au/com/royalpay/payment/manage/process/ato/ExportATOReport.java
index eb195443f..0c17dd0c9 100644
--- a/src/test/java/au/com/royalpay/payment/manage/process/ato/ExportATOReport.java
+++ b/src/test/java/au/com/royalpay/payment/manage/process/ato/ExportATOReport.java
@@ -28,7 +28,7 @@ public class ExportATOReport {
@Test
public void export() throws IOException {
- String content = atoReportService.exportBTTPSFile(DateTime.parse("2017-07-01").toDate(), DateTime.parse("2017-07-31").toDate());
- FileUtils.write(new File("C:\\Users\\yixian\\Documents\\royalpay2017070120170731.bttps"), content, StandardCharsets.US_ASCII);
+ String content = atoReportService.exportBTTPSFile(DateTime.parse("2017-07-01").toDate(), DateTime.parse("2018-06-30").toDate());
+ FileUtils.write(new File("C:\\Users\\yixian\\Documents\\royalpay2017070120180630.bttps"), content, StandardCharsets.US_ASCII);
}
}