1.代客下单 创建订单增加锁
2.代客下单 主扫支付
This commit is contained in:
@@ -2,6 +2,8 @@ package cn.ysk.cashier.thirdpay.service;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
|
||||
import cn.ysk.cashier.mybatis.vo.pay.MainScanReq;
|
||||
import cn.ysk.cashier.mybatis.vo.pay.MainScanResp;
|
||||
import cn.ysk.cashier.thirdpay.constants.SignTypeEnum;
|
||||
import cn.ysk.cashier.thirdpay.req.OrderRefundReq;
|
||||
import cn.ysk.cashier.thirdpay.req.OrderReturnQueryReq;
|
||||
@@ -11,6 +13,7 @@ import cn.ysk.cashier.thirdpay.resp.OrderReturnResp;
|
||||
import cn.ysk.cashier.thirdpay.resp.OrderStatusQueryResp;
|
||||
import cn.ysk.cashier.thirdpay.resp.PublicResp;
|
||||
import cn.ysk.cashier.utils.JSONUtil;
|
||||
import cn.ysk.cashier.utils.MD5Util;
|
||||
import cn.ysk.cashier.utils.MD5Utils;
|
||||
import com.dianguang.cloud.ossservice.model.DateUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -25,6 +28,13 @@ import java.util.LinkedHashMap;
|
||||
@Slf4j
|
||||
public class ThirdPayService {
|
||||
|
||||
private static String micropay="/api/open/payment/micropay";
|
||||
|
||||
private static String ltpay="/api/open/payment/ltpay";
|
||||
|
||||
|
||||
private static String refund="/api/open/order/refund";
|
||||
|
||||
|
||||
private static String trade="/api/open/query/trade";
|
||||
|
||||
@@ -197,6 +207,45 @@ public class ThirdPayService {
|
||||
return map;
|
||||
}
|
||||
|
||||
public PublicResp<MainScanResp> mainScan(String url, String appId, String subject, String body, Long amount, String subAppId, String authCode, String orderNo, String storeId, String notifyUrl,
|
||||
String key
|
||||
) {
|
||||
MainScanReq mainScanReq=null;
|
||||
if("66bab943ae82f63b50ae3cff".equals(appId)){
|
||||
|
||||
mainScanReq = new MainScanReq(subject, body, amount, subAppId, "cny", authCode, orderNo, storeId, notifyUrl,1,"TA1824003985261588482",null);
|
||||
url="https://paymentweb.sxczgkj.cn";
|
||||
}else {
|
||||
mainScanReq = new MainScanReq(subject, body, amount, subAppId, "cny", authCode, orderNo, storeId, notifyUrl,0,null,null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
PublicParam param = new PublicParam(appId, "", SignTypeEnum.MD5.getValue(), null, cn.ysk.cashier.utils.DateUtils.getSdfTimes(), "1.0", String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
|
||||
try {
|
||||
String str = JSONUtil.toJSONString(sortFields(mainScanReq));
|
||||
param.setBizData(str);
|
||||
String tt = sortFieldsAndPrint(param);
|
||||
String MD5 = tt.concat("appSecret=" + key);
|
||||
log.info("加签原传:{}", MD5);
|
||||
String sign = MD5Util.encrypt(MD5);
|
||||
param.setSign(sign);
|
||||
String reqbody = JSONUtil.toJSONString(param);
|
||||
log.info("请求参数:{}", reqbody);
|
||||
String response = HttpRequest.post(url.concat(micropay)).body(reqbody).execute().body();
|
||||
log.info("返回结果:{}", response);
|
||||
PublicResp<MainScanResp> resp =JSONUtil.parseJSONStr2T(response,PublicResp.class);
|
||||
|
||||
resp.setObjData(JSONUtil.parseJSONStr2T(resp.getBizData(),MainScanResp.class));
|
||||
return resp;
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user