Commit f7ac74f6 authored by terrfly's avatar terrfly
Browse files

商户私钥 变更为商户应用私钥;

parent 252369f9
...@@ -127,7 +127,7 @@ public class ChannelNoticeController extends AbstractCtrl { ...@@ -127,7 +127,7 @@ public class ChannelNoticeController extends AbstractCtrl {
//包含通知地址时 //包含通知地址时
if(hasReturnUrl){ if(hasReturnUrl){
// 重定向 // 重定向
response.sendRedirect(payMchNotifyService.createReturnUrl(payOrder, mchAppConfigContext.getMchInfo().getPrivateKey())); response.sendRedirect(payMchNotifyService.createReturnUrl(payOrder, mchAppConfigContext.getMchApp().getAppSecret()));
return null; return null;
}else{ }else{
......
...@@ -42,8 +42,8 @@ import org.springframework.stereotype.Service; ...@@ -42,8 +42,8 @@ import org.springframework.stereotype.Service;
public class PayMchNotifyService { public class PayMchNotifyService {
@Autowired private MchNotifyRecordService mchNotifyRecordService; @Autowired private MchNotifyRecordService mchNotifyRecordService;
@Autowired private MchInfoService mchInfoService;
@Autowired private MqQueue4PayOrderMchNotify mqPayOrderMchNotifyQueue; @Autowired private MqQueue4PayOrderMchNotify mqPayOrderMchNotifyQueue;
@Autowired private ConfigContextService configContextService;
/** 商户通知信息, 只有订单是终态,才会发送通知, 如明确成功和明确失败 **/ /** 商户通知信息, 只有订单是终态,才会发送通知, 如明确成功和明确失败 **/
...@@ -64,10 +64,11 @@ public class PayMchNotifyService { ...@@ -64,10 +64,11 @@ public class PayMchNotifyService {
return ; return ;
} }
//构建数据 //商户app私钥
MchInfo mchInfo = mchInfoService.getById(dbPayOrder.getMchNo()); String appSecret = configContextService.getMchAppConfigContext(dbPayOrder.getMchNo(), dbPayOrder.getAppId()).getMchApp().getAppSecret();
// 封装通知url // 封装通知url
String notifyUrl = createNotifyUrl(dbPayOrder, mchInfo.getPrivateKey()); String notifyUrl = createNotifyUrl(dbPayOrder, appSecret);
mchNotifyRecord = new MchNotifyRecord(); mchNotifyRecord = new MchNotifyRecord();
mchNotifyRecord.setOrderId(dbPayOrder.getPayOrderId()); mchNotifyRecord.setOrderId(dbPayOrder.getPayOrderId());
mchNotifyRecord.setOrderType(MchNotifyRecord.TYPE_PAY_ORDER); mchNotifyRecord.setOrderType(MchNotifyRecord.TYPE_PAY_ORDER);
...@@ -93,14 +94,14 @@ public class PayMchNotifyService { ...@@ -93,14 +94,14 @@ public class PayMchNotifyService {
/** /**
* 创建响应URL * 创建响应URL
*/ */
public String createNotifyUrl(PayOrder payOrder, String mchKey) { public String createNotifyUrl(PayOrder payOrder, String appSecret) {
QueryPayOrderRS queryPayOrderRS = QueryPayOrderRS.buildByPayOrder(payOrder); QueryPayOrderRS queryPayOrderRS = QueryPayOrderRS.buildByPayOrder(payOrder);
JSONObject jsonObject = (JSONObject)JSONObject.toJSON(queryPayOrderRS); JSONObject jsonObject = (JSONObject)JSONObject.toJSON(queryPayOrderRS);
jsonObject.put("reqTime", System.currentTimeMillis()); //添加请求时间 jsonObject.put("reqTime", System.currentTimeMillis()); //添加请求时间
// 报文签名 // 报文签名
jsonObject.put("sign", JeepayKit.getSign(jsonObject, mchKey)); jsonObject.put("sign", JeepayKit.getSign(jsonObject, appSecret));
// 生成通知 // 生成通知
return StringKit.appendUrlQuery(payOrder.getNotifyUrl(), jsonObject); return StringKit.appendUrlQuery(payOrder.getNotifyUrl(), jsonObject);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment