pos支付相关
This commit is contained in:
parent
e1470566c6
commit
38d3ad79c8
|
|
@ -25,6 +25,7 @@ import cn.pluss.platform.sxf.pay.SxfPayService;
|
|||
import cn.pluss.platform.user.impl.GeneralPushUtil;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
import cn.pluss.platform.util.StringUtil;
|
||||
import cn.pluss.platform.util.TokenUtil;
|
||||
import cn.pluss.platform.vo.MemberScanVO;
|
||||
import cn.pluss.platform.vo.MerchantOrderVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
|
@ -424,6 +425,33 @@ public class MerchantOrderController {
|
|||
return ResultGenerator.genFailResult(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 博实结pos机反扫支付
|
||||
* @param merchantOrderDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/posScanPay")
|
||||
public Result<Object> posScanPay(@RequestBody MerChantOrderDTO merchantOrderDTO) {
|
||||
//首先验签
|
||||
Map<String, String> token = TokenUtil.getToken(merchantOrderDTO.getTimestamp(), merchantOrderDTO.getRequestId());
|
||||
boolean sign = token.get("TOKEN").equals(merchantOrderDTO.getToken());
|
||||
System.out.println(token);
|
||||
MsgException.check(!sign,"签名错误");
|
||||
//通过后进行支付操作
|
||||
UserApp tokenUa = userAppService.queryUserAppByToken();
|
||||
merchantOrderDTO.setMerchantCode(tokenUa.getMerchantCode());
|
||||
//校验金额
|
||||
if (!StringUtil.isMoney(String.valueOf(merchantOrderDTO.getConsumeFee()))){
|
||||
MsgException.throwException("金额异常");
|
||||
}
|
||||
try {
|
||||
return merchantOrderService.toActivePay(merchantOrderDTO);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return ResultGenerator.genFailResult(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主扫会员支付
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public class TokenRegistryInterceptor extends HandlerInterceptorAdapter {
|
|||
limitUri.add("/api/callback/");
|
||||
limitUri.add("/api/open/login");
|
||||
limitUri.add("/api/index.html");
|
||||
limitUri.add("/api/merchantOrder/posScanPay");
|
||||
boolean passFlag = limitUri.stream().anyMatch(s -> s.equals(requestUri) || requestUri.startsWith(s));
|
||||
if (passFlag) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class TokenUtil {
|
|||
* @param requestId 请求ID,自定义
|
||||
* @return
|
||||
*/
|
||||
private static Map<String, String> getToken(String timestamp, String requestId) {
|
||||
public static Map<String, String> getToken(String timestamp, String requestId) {
|
||||
String token = "";
|
||||
String encode = "";
|
||||
SortedMap<String, Object> map = new TreeMap();
|
||||
|
|
@ -51,8 +51,15 @@ public class TokenUtil {
|
|||
Map<String, String> finalMap = new HashMap<>();
|
||||
finalMap.put("ENCODE",encode);
|
||||
System.out.println(token + APP_SECRET);
|
||||
finalMap.put("TOKEN", MD5Util.md5(token + APP_SECRET));
|
||||
finalMap.put("TOKEN", MD5Util.md5(token + APP_SECRET).toUpperCase());
|
||||
return finalMap;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(System.currentTimeMillis());
|
||||
System.out.println(UUID.randomUUID().toString());
|
||||
Map<String, String> token = getToken("1679974421445", "704b7ccf-216b-4c8b-9bba-b1b131e88858");
|
||||
System.out.println(token);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,26 @@ public class MerChantOrderDTO {
|
|||
* @date: 2021/12/22 16:01
|
||||
*/
|
||||
private String deviceNo;
|
||||
/**
|
||||
* timestamp时间戳(pos机)
|
||||
*/
|
||||
private String timestamp;
|
||||
/**
|
||||
* 唯一识别码(pos机)
|
||||
*/
|
||||
private String appId;
|
||||
/**
|
||||
* 签名(pos)
|
||||
*/
|
||||
private String token;
|
||||
/**
|
||||
* 请求标识,用于唯一标识当前请求(pos,uuid)
|
||||
*/
|
||||
private String requestId;
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ public class YsAuditServiceImpl extends AbstractYsResultService {
|
|||
param.put(YsConstant.CONTACTS_NAME, account.getIdcard().getCertName());
|
||||
UserInfo ui = uiService.getById(userId);
|
||||
param.put(YsConstant.CONTACTS_PHONE, ui.getPhone().substring(0, 11));
|
||||
param.put(YsConstant.CONTACTS_EMAIL, "18062761507@163.com");
|
||||
param.put(YsConstant.CONTACTS_EMAIL, "chaozhanggui2023@163.com");
|
||||
param.put(YsConstant.WECHAT_SIGN_RATE, "0.38");
|
||||
param.put(YsConstant.WECHAT_SIGN_MIN, "1");
|
||||
param.put(YsConstant.ALIPAY_SIGN_RATE, "0.38");
|
||||
|
|
@ -318,7 +318,7 @@ public class YsAuditServiceImpl extends AbstractYsResultService {
|
|||
} else {
|
||||
param.put(YsConstant.BALANCE_ACC_TYPE, "11");
|
||||
}
|
||||
param.put(YsConstant.EXPANDING_MANAGER, "收银呗");
|
||||
param.put(YsConstant.EXPANDING_MANAGER, "快银收银");
|
||||
|
||||
// 这里在进件之前再加一次校验
|
||||
preCheck(userId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue