Authored by tanling

订单

... ... @@ -34,11 +34,6 @@ public interface OrderConstant {
String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* 调用银联接口,商户订单号 以银联分配的4位系统编号作为订单号的前四位
*/
String ORDER_CODE_PRE = "3194";
String EMPTY_ADDRESS_CODE = "000000";
String SPLIT_STR = "_";
... ...
... ... @@ -34,6 +34,10 @@ public abstract class AbstractOrderPaymentService {
@Value("${unionpay.pay.msgSrc}")
private String msgSrc;
@Value("${unionpay.pay.msgSrcId}")
private String msgSrcId;
@Value("${unionpay.pay.mid}")
private String mid;
... ... @@ -182,6 +186,11 @@ public abstract class AbstractOrderPaymentService {
public JSONObject buildPrepayData(PaymentRequest request, Payment payment, BigDecimal amount) {
JSONObject requestData = buildCommOrderData(request, payment);
if (payment == Payment.WECHAT){
requestData.put("tradeType", "APP");
}
requestData.put("notifyUrl", callbackUrl);
// 单位分 存在点,则签名失败,不支持1.0这种
requestData.put("totalAmount", amount.multiply(new BigDecimal(100)).setScale( 0, BigDecimal.ROUND_DOWN ).longValue());
... ... @@ -194,7 +203,7 @@ public abstract class AbstractOrderPaymentService {
private String getPayOrderCode(long orderCode, Payment payment){
StringBuilder sb = new StringBuilder();
sb.append(OrderConstant.ORDER_CODE_PRE);
sb.append(msgSrcId);
sb.append(orderCode);
sb.append(OrderConstant.SPLIT_STR);
sb.append(payment.getCode());
... ...
... ... @@ -70,10 +70,12 @@ env.machineId=0
unionpay.pay.callbackUrl=http://testapi.yohops.com/payment/weixin_notify
unionpay.pay.url=https://qr-test2.chinaums.com/netpay-route-server/api/
unionpay.pay.msgSrc=WWW.TEST.COM
unionpay.pay.msgSrcId=3194
unionpay.pay.mid=898310148160568
unionpay.pay.tid=00000001
unionPay.pay.signKey=fcAmtnx7MwismjWNhNKdHC44mNXtnEQeJkRrhKJwyrW2ysRR
redis.readonly.proxy.address=192.168.102.45
redis.readonly.proxy.auth=redis9646
redis.readonly.proxy.port=6379
... ...