This commit is contained in:
liuyingfang
2023-06-12 16:14:05 +08:00
5 changed files with 83 additions and 6 deletions

View File

@@ -255,7 +255,70 @@ public class LkLPayServiceImpl implements PayService {
@Override
public Map<String, Object> refundPay(MerchantOrder order, String mchNo) {
return null;
QueryWrapper<MerchantBaseInfo> baseQueyWrapper = new QueryWrapper<>();
baseQueyWrapper.eq("merchantCode", mchNo);
MerchantBaseInfo baseInfo = merchantBaseInfoMapper.selectOne(baseQueyWrapper);
MsgException.checkNull(baseInfo, "商户基本信息错误");
QueryWrapper<MerchantBackLkl> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("merchant_code", mchNo);
queryWrapper.eq("channel", "5");
queryWrapper.eq("user_no", LaKalaInterfaceImpl.userNo);
MerchantBackLkl merchantBackLkl = merchantBackLklMapper.selectOne(queryWrapper);
MsgException.checkNull(merchantBackLkl, "进件信息不存在");
String req_time = DateUtils.getSdfTimes();
Long order_amt = changeY2F(order.getConsumeFee());
String refundNo = "LKLR" + StringUtil.getBillno();
String body="{\n" +
" \"req_time\":\""+req_time+"\",\n" +
" \"version\":\"3.0\",\n" +
" \"out_org_code\":\""+lakalaConfig.getAppid()+"\",\n" +
" \"req_data\":{\n" +
" \"merchant_no\":\""+merchantBackLkl.getExternalCustomerNo()+"\",\n" +
" \"term_no\":\""+merchantBackLkl.getTermNos()+"\",\n" +
" \"out_trade_no\":\""+refundNo+"\",\n" +
" \"refund_amount\":\""+order_amt+"\",\n" +
" \"refund_reason\":\"退款\",\n" +
" \"origin_out_trade_no\":\""+order.getOrderNumber()+"\",\n" +
" \"location_info\":{\n" +
" \"request_ip\":\""+order.getIp()+"\",\n" +
" \"location\":\"+37.123456789,-121.123456789\"\n" +
" }\n" +
" }\n" +
"}\n" +
"\n";
Map<String, Object> result = new HashMap<>(4);
result.put("refundNo", refundNo);
result.put("status", "3");
result.put("code", ResultCode.FAIL.code());
String response = lklPayService.req(body, "api/v3/labs/relation/refund");
if(ObjectUtil.isNotEmpty(response)){
JSONObject object=JSONObject.parseObject(response);
if(object.containsKey("code")&&"BBS00000".equals(object.getString("code"))){
result.put("msg", "退款成功!");
result.put("data", object.getJSONObject("resp_data"));
result.put("status", "1");
result.put("code", ResultCode.SUCCESS.code());
return result;
}else {
result.put("msg", object.getString("msg"));
return result;
}
}
result.put("msg", "退款失败!");
return result;
}
@Override

View File

@@ -1541,7 +1541,11 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
resultMap = ryxPayService.refundPay(order, channel.getMerchantId());
} else if (channel.getChannel() == 4) {
resultMap = ysPayOldService.refundPay(order, channel.getMerchantId());
}else {
}else if(channel.getChannel()==5){
resultMap = lkLPayServiceImpl.refundPay(order,channel.getMerchantCode());
}
else {
MsgException.throwException("未知通道!");
}
if (ResultCode.SUCCESS.code() != (Integer) resultMap.get("code")) {